Exemple #1
0
void lcdWriteBits(__s8 bits, __u8 char_mode)
{
	mcpOutput(pin_rs, char_mode);
	bool z;
	int i;
	for(i=7; i>=4; i--)
	{
		z = CHECK_BIT(bits,i);
		if(z)
			mcpOutput(pin_db[i-4], 1);
		else
			mcpOutput(pin_db[i-4], 0);
	}
	lcdPulseEnable();
	
	for(i=3; i>=0; i--)
	{
		z = CHECK_BIT(bits,i);
		if(z)
			mcpOutput(pin_db[i], 1);
		else
			mcpOutput(pin_db[i], 0);
	}
	lcdPulseEnable();
}
void lcdSendCtl(uint8_t val)
{
  PORTA_LCD_DAT = val;
  A0_off;
  lcdPulseEnable();
  A0_on;

}
void lcdRefreshFast()
{
  REFRESHDURATION1  //Debug function if defined LCDDURATIONSHOW in opentx.h

  static uint8_t change = 0; // toggle left or right lcd writing
  uint8_t *p;
  if (!change){ CS2_off; CS1_on; p = displayBuf; change = 1;} // Right
  else{ CS1_off; CS2_on; p = displayBuf + 64; change = 0;} // Left
  
  for (uint8_t page=0; page < 8; page++) {
    lcdSendCtl(DISPLAY_SET_COLUMN); // Column addr 0
    lcdSendCtl( page | DISPLAY_SET_PAGE); //Page addr
    A0_on;
    for (coord_t x=64; x>0; --x) {
      PORTA_LCD_DAT = *p++;
      lcdPulseEnable();
    }
    p += 64;
  }
  A0_off;
  
  REFRESHDURATION2  //Debug function if defined LCDDURATIONSHOW in opentx.h

}