//----------------------------------------------------------------------------- static void lcd_HD44780_write(uint8_t data) { if (engineConfiguration->displayMode == DM_HD44780) { palWritePad(HD44780_PORT_DB7, HD44780_PIN_DB7, data & 0x80 ? 1 : 0); palWritePad(HD44780_PORT_DB6, HD44780_PIN_DB6, data & 0x40 ? 1 : 0); palWritePad(HD44780_PORT_DB5, HD44780_PIN_DB5, data & 0x20 ? 1 : 0); palWritePad(HD44780_PORT_DB4, HD44780_PIN_DB4, data & 0x10 ? 1 : 0); palSetPad(HD44780_PORT_E, HD44780_PIN_E); // En high lcdSleep(10); // enable pulse must be >450ns palClearPad(HD44780_PORT_E, HD44780_PIN_E); // En low lcdSleep(40); // commands need > 37us to settle } else { // LCD D4_pin -> P4 // LCD D5_pin -> P5 // LCD D6_pin -> P6 // LCD D7_pin -> P7 // LCD Pin RS -> P0 // LCD Pin RW -> P1 // LCD Pin E -> P2 i2cAcquireBus(&I2CD1); txbuf[0] = 4; i2cMasterTransmit(&I2CD1, LCD_PORT_EXP_ADDR, txbuf, 1, NULL, 0); lcdSleep(10); // enable pulse must be >450ns txbuf[0] = 0; i2cMasterTransmit(&I2CD1, LCD_PORT_EXP_ADDR, txbuf, 1, NULL, 0); i2cReleaseBus(&I2CD1); } }
//----------------------------------------------------------------------------- static void lcd_HD44780_write(uint8_t data) { if (engineConfiguration->displayMode == DM_HD44780) { palWritePad(getHwPort(boardConfiguration->HD44780_db7), getHwPin(boardConfiguration->HD44780_db7), data & 0x80 ? 1 : 0); palWritePad(getHwPort(boardConfiguration->HD44780_db6), getHwPin(boardConfiguration->HD44780_db6), data & 0x40 ? 1 : 0); palWritePad(getHwPort(boardConfiguration->HD44780_db5), getHwPin(boardConfiguration->HD44780_db5), data & 0x20 ? 1 : 0); palWritePad(getHwPort(boardConfiguration->HD44780_db4), getHwPin(boardConfiguration->HD44780_db4), data & 0x10 ? 1 : 0); palSetPad(getHwPort(boardConfiguration->HD44780_e), getHwPin(boardConfiguration->HD44780_e)); // En high lcdSleep(10); // enable pulse must be >450ns palClearPad(getHwPort(boardConfiguration->HD44780_e), getHwPin(boardConfiguration->HD44780_e)); // En low lcdSleep(40); // commands need > 37us to settle } else { // LCD D4_pin -> P4 // LCD D5_pin -> P5 // LCD D6_pin -> P6 // LCD D7_pin -> P7 // LCD Pin RS -> P0 // LCD Pin RW -> P1 // LCD Pin E -> P2 // todo: finish all this stuff // i2cAcquireBus(&I2CD1); // // txbuf[0] = 4; // i2cMasterTransmit(&I2CD1, LCD_PORT_EXP_ADDR, txbuf, 1, NULL, 0); // lcdSleep(10); // enable pulse must be >450ns // // txbuf[0] = 0; // i2cMasterTransmit(&I2CD1, LCD_PORT_EXP_ADDR, txbuf, 1, NULL, 0); // // i2cReleaseBus(&I2CD1); } }