Esempio n. 1
0
void
lcd_contrast(uint8_t hb)
{
  uint8_t contrast = erb((uint8_t*)EE_CONTRAST);

    
  if(hb == 0xFE) {
    contrast--;
  } else if (hb == 0xFD) {
    contrast++;
  } else if (hb == 0xFC) {
    //keep the eeprom value
  } else {
    contrast = hb;
  }
  if(contrast < 40) contrast = 40;
  if(contrast > 80) contrast = 80;

  ewb((uint8_t*)EE_CONTRAST, contrast);
  lcd_sendcmd (LCD_CMD_SETCON);
  lcd_senddata (contrast);

  DS_P( PSTR("Contrast:") );
  DU(100-(contrast-40)*100/40, 3);
  DC('%');
  DNL();
}
Esempio n. 2
0
void lcd_write_cmdordata(COM_STATUS bank, unsigned char cCmd, int oprand)
{
    rt_uint8_t value = cCmd | oprand;
    GPIO_ResetBits(lcd_gpio_ctrl,lcd_CSB);
    if(bank)
    {
        GPIO_SetBits(lcd_gpio_ctrl,lcd_A0);
    }
    else
    {
        GPIO_ResetBits(lcd_gpio_ctrl,lcd_A0);
    }
    lcd_senddata(value);
    GPIO_SetBits(lcd_gpio_ctrl ,lcd_CSB);
}