Ejemplo n.º 1
0
/** Initialise the LCD
 *
 * Sets up the pins required to communicate with the LCD screen and then does
 * the actual chipset initialisation. The pin numbers to use are defined in
 * @ref hardware.h.
 */
void lcdInit() {
  LCD_SCK_SET_OUTPUT();
  LCD_MOSI_SET_OUTPUT();
  LCD_CD_SET_OUTPUT();

  LCD_SCK_LOW();
  LCD_MOSI_LOW();
  LCD_CD_LOW();

#if defined(LCD_USE_PROGRAM_RESET) 
  LCD_RESET_SET_OUTPUT();
  LCD_RESET_LOW();
  // Do a hard reset on the LCD
  waitReset();
  //PORTB |= (1 << LCD_RESET);
  LCD_RESET_HIGH();
#endif

  // Initialise the LCD
  lcdCommand(0x21);  // LCD Extended Commands.
  lcdCommand(0x80|LCD_CONTRAST_VALUE);  // Set LCD Vop (Contrast).
  lcdCommand(0x04);  // Set Temp coefficent.
  lcdCommand(0x14);  // LCD bias mode 1:48.
  lcdCommand(0x20);  // LCD Normal commands
  lcdCommand(0x08 | 0x04);  // Normal display, horizontal addressing
}
Ejemplo n.º 2
0
bool OneWireSlave::waitForRequest(bool ignore_errors) {
    errno = ONEWIRE_NO_ERROR;
    for (;;) {
        if (!waitReset(0) )
            continue;
        if (!presence() )
            continue;
        if (recvAndProcessCmd() )
            return TRUE;
        else if ((errno == ONEWIRE_NO_ERROR) || ignore_errors)
            continue;
        else
            return FALSE;
    }
}
Ejemplo n.º 3
0
bool OneWireSlave::waitReset() {
    return waitReset(1000);
}