Re: DSPIY 2560 - Proto 1
Posté : ven. 13 janv. 2017 14:08
Merci beaucoup, je regarde tout ça en détail dans la soirée
Code : Tout sélectionner
void lcd_Line(unsigned char orientation,unsigned char fin)
{
unsigned char n;
if(orientation==Hor)
{
for(n=lcd_x;n!=fin;n++)glcd_Dot(n,lcd_y,XOR);
}
else
{
for(n=lcd_y;n!=fin;n++)glcd_Dot(lcd_x,n,XOR);
}
}
Code : Tout sélectionner
void glcd_Dot(uint8_t x, uint8_t y, uint8_t mode)
{
// here 2*1 setup - TODO: for 2*2 setting
uint8_t bitnum, bitmask, yByte;
//if ( (x>=GLCD_RIGHT) || (y>=GLCD_BOTTOM) ) return;
yByte = y >> 3; // / 8
bitnum = y & 0x07;
bitmask = glcd_MaskArray[bitnum];
switch (mode) {
case SET:
glcd_Buffer[yByte][x] |= bitmask;
break;
case CLEAR:
glcd_Buffer[yByte][x] &= ~bitmask;
break;
case XOR:
glcd_Buffer[yByte][x] ^= bitmask;
break;
default: break;
}
}
Code : Tout sélectionner
void lcd_update()
{
unsigned char x;
for(x=0; x!=4; x++)
{
lcd_pageX(x<<3);
lcd_addressY(0);
GPIOSetValue(Port_A0,Pin_A0,1);
GPIOSetValue(Port_CS1,Pin_CS1,0);
if(D01_ECRAN>2)
{SPI_Send(0,1);SPI_Send(0,1);SPI_Send(0,1);SPI_Send(0,1);}
SPI_Send((uint8_t *)glcd_Buffer[x],128);//128);
}
GPIOSetValue(Port_CS1,Pin_CS1,1);
lcd_addressY(0);
lcd_pageX(0);
}
Code : Tout sélectionner
//========================================================================================
// set Y adresse LCD position horizontale [0-63] (auto-incrementee a chaque
// lecture/ecriture)
//========================================================================================
void lcd_addressY(unsigned char adr)
{
//lcd_putcmd(0x10|((adr>>4)&0xf));
//lcd_putcmd(0x0|(adr&0xf));
lcd_putcmd(0x0+adr%16);
lcd_putcmd(0x10+adr/16);
}
//========================================================================================
// set X page LCD position verticale [0-7] (par paquets de 8)
//========================================================================================
void lcd_pageX(unsigned char adr)
{
lcd_putcmd(0xb0 | ((adr>>3) & 0x07) );
//lcd_putcmd(0xb0|(adr>>3));
}
Code : Tout sélectionner
uint8_t glcd_Buffer[8][128];