mühendiss_eem
Üye
- Katılım
- 19 Ocak 2018
- Mesajlar
- 57
- Puanları
- 1
void glcd_pixel(int x, int y, int color)
#ifdef FAST_GLCD
{
int* p;
int16_t temp;
temp = y;
temp /=8;
temp *= 64;
temp += x;
if(x > 63)
{
// p = displayData.right;
// *p++ = (temp - 64);
p =( displayData.right + temp - 64);
}
else
{
p =(displayData.left + temp);
// p =displayData.left ;
// *p++ =temp;
}
if(color)
{
HAL_IS_BIT_SET(*p, y%8);
// bit_set(*p, y%8);
}
else
{
// bit_clear(*p, y%8);
HAL_IS_BIT_CLR(*p, y%8);
}
}
#else
{
// Glcd_DisplayChar(H);
int data;
int side = GLCD_LEFT; // Stores which chip to use on the LCD
if(x > 63) // Check for first or second display area
{
x -= 64;
side = GLCD_RIGHT;
}
HAL_IS_BIT_CLR(x,7);
HAL_IS_BIT_SET(x,6);
// DWT_Delay(10);
HAL_GPIO_WritePin(GLCD_DI, GPIO_PIN_RESET);
glcd_writeByte(side, x); // Set the horizontal address
glcd_writeByte(side, (y/8 & 0xBF) | 0xB8); // Set the vertical page address 0xBF) | 0xB8
// output_high(GLCD_DI); // Set for data
//DWT_Delay(10); ////
HAL_GPIO_WritePin(GLCD_DI, GPIO_PIN_SET);
glcd_readByte(side); // Need two reads to get data
data = glcd_readByte(side); // at new address
if(color == ON)
{
HAL_IS_BIT_SET(data, y%8);
// bit_set(data, y%8); // Turn the pixel on
}
else // or
{
HAL_IS_BIT_CLR(data, y%8);
// bit_clear(data, y%8); // turn the pixel off
}
HAL_GPIO_WritePin(GLCD_DI, GPIO_PIN_RESET);
glcd_writeByte(side, x); // Set the horizontal address
HAL_GPIO_WritePin(GLCD_DI, GPIO_PIN_SET);
glcd_writeByte(side, data); // Write the pixel data
}
#endif
bu kod ile pixele yazmaya çalışıyorum fakat hiç bir şekilde yazmıyor neden olabilir
#ifdef FAST_GLCD
{
int* p;
int16_t temp;
temp = y;
temp /=8;
temp *= 64;
temp += x;
if(x > 63)
{
// p = displayData.right;
// *p++ = (temp - 64);
p =( displayData.right + temp - 64);
}
else
{
p =(displayData.left + temp);
// p =displayData.left ;
// *p++ =temp;
}
if(color)
{
HAL_IS_BIT_SET(*p, y%8);
// bit_set(*p, y%8);
}
else
{
// bit_clear(*p, y%8);
HAL_IS_BIT_CLR(*p, y%8);
}
}
#else
{
// Glcd_DisplayChar(H);
int data;
int side = GLCD_LEFT; // Stores which chip to use on the LCD
if(x > 63) // Check for first or second display area
{
x -= 64;
side = GLCD_RIGHT;
}
HAL_IS_BIT_CLR(x,7);
HAL_IS_BIT_SET(x,6);
// DWT_Delay(10);
HAL_GPIO_WritePin(GLCD_DI, GPIO_PIN_RESET);
glcd_writeByte(side, x); // Set the horizontal address
glcd_writeByte(side, (y/8 & 0xBF) | 0xB8); // Set the vertical page address 0xBF) | 0xB8
// output_high(GLCD_DI); // Set for data
//DWT_Delay(10); ////
HAL_GPIO_WritePin(GLCD_DI, GPIO_PIN_SET);
glcd_readByte(side); // Need two reads to get data
data = glcd_readByte(side); // at new address
if(color == ON)
{
HAL_IS_BIT_SET(data, y%8);
// bit_set(data, y%8); // Turn the pixel on
}
else // or
{
HAL_IS_BIT_CLR(data, y%8);
// bit_clear(data, y%8); // turn the pixel off
}
HAL_GPIO_WritePin(GLCD_DI, GPIO_PIN_RESET);
glcd_writeByte(side, x); // Set the horizontal address
HAL_GPIO_WritePin(GLCD_DI, GPIO_PIN_SET);
glcd_writeByte(side, data); // Write the pixel data
}
#endif
bu kod ile pixele yazmaya çalışıyorum fakat hiç bir şekilde yazmıyor neden olabilir