51 static const int lineStart[] = { 0, 0x40, 0x14, 0x54 };
61 int ticks = CORE_CLOCK / 1000000 * period;
63 for (
int i = 0; i < ticks; i++)
69 chThdSleepMicroseconds(period);
74 #define LCD_PORT_EXP_ADDR 0x20 100 data & 0x20 ? 1 : 0);
101 writePad(
"lcd", CONFIG(HD44780_db4),
102 data & 0x10 ? 1 : 0);
104 writePad(
"lcd", CONFIG(HD44780_e), 1);
106 writePad(
"lcd", CONFIG(HD44780_e), 0);
124 palClearPad(
getHwPort(
"lcd", CONFIG(HD44780_rs)),
getHwPin(
"lcd", CONFIG(HD44780_rs)));
132 palSetPad(
getHwPort(
"lcd", CONFIG(HD44780_rs)),
getHwPin(
"lcd", CONFIG(HD44780_rs)));
138 palClearPad(
getHwPort(
"lcd", CONFIG(HD44780_rs)),
getHwPin(
"lcd", CONFIG(HD44780_rs)));
146 efiAssertVoid(
CUSTOM_ERR_6657, row <= engineConfiguration->HD44780height,
"invalid row");
181 while (*
string != 0x00)
186 static void lcdInfo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
187 efiPrintf(
"HD44780 RS=%s",
hwPortname(CONFIG(HD44780_rs)));
188 efiPrintf(
"HD44780 E=%s",
hwPortname(CONFIG(HD44780_e)));
189 efiPrintf(
"HD44780 D4=%s",
hwPortname(CONFIG(HD44780_db4)));
190 efiPrintf(
"HD44780 D5=%s",
hwPortname(CONFIG(HD44780_db5)));
191 efiPrintf(
"HD44780 D6=%s",
hwPortname(CONFIG(HD44780_db6)));
192 efiPrintf(
"HD44780 D7=%s",
hwPortname(CONFIG(HD44780_db7)));
207 efiSetPadMode(
"lcd RS", CONFIG(HD44780_rs), PAL_MODE_OUTPUT_PUSHPULL);
208 efiSetPadMode(
"lcd E", CONFIG(HD44780_e), PAL_MODE_OUTPUT_PUSHPULL);
209 efiSetPadMode(
"lcd DB4", CONFIG(HD44780_db4), PAL_MODE_OUTPUT_PUSHPULL);
210 efiSetPadMode(
"lcd DB5", CONFIG(HD44780_db5), PAL_MODE_OUTPUT_PUSHPULL);
211 efiSetPadMode(
"lcd DB6", CONFIG(HD44780_db6), PAL_MODE_OUTPUT_PUSHPULL);
212 efiSetPadMode(
"lcd DB7", CONFIG(HD44780_db7), PAL_MODE_OUTPUT_PUSHPULL);
214 writePad(
"lcd", CONFIG(HD44780_rs), 0);
215 writePad(
"lcd", CONFIG(HD44780_e), 0);
216 writePad(
"lcd", CONFIG(HD44780_db4), 0);
217 writePad(
"lcd", CONFIG(HD44780_db5), 0);
218 writePad(
"lcd", CONFIG(HD44780_db6), 0);
219 writePad(
"lcd", CONFIG(HD44780_db7), 0);
243 chThdSleepMilliseconds(20);
245 chThdSleepMilliseconds(1);
250 chThdSleepMicroseconds(40);
254 chThdSleepMicroseconds(40);
257 chThdSleepMicroseconds(40);
260 chThdSleepMilliseconds(2);
263 chThdSleepMilliseconds(2);
268 efiPrintf(
"lcd_HD44780_init() done");
int getCurrentHD44780row(void)
void efiSetPadMode(const char *msg, brain_pin_e brainPin, iomode_t mode)
static bool lcd_HD44780_is_enabled(void)
static void lcdInfo(DECLARE_ENGINE_PARAMETER_SIGNATURE)
int getCurrentHD44780column(void)
EXTERNC ioportmask_t getHwPin(const char *msg, brain_pin_e brainPin)
static void lcd_HD44780_write_data(uint8_t data)
display_mode_e displayMode
static void writePad(const char *msg, brain_pin_e pin, int bit)
bool isBrainPinValid(brain_pin_e brainPin)
static void lcd_HD44780_write_command(uint8_t data)
void lcd_HD44780_print_char(char data)
const char * hwPortname(brain_pin_e brainPin)
void efiSetPadUnused(brain_pin_e brainPin)
void lcdShowPanicMessage(char *message)
EXTERNC ioportid_t getHwPort(const char *msg, brain_pin_e brainPin)
void lcd_HD44780_set_position(uint8_t row, uint8_t column)
engine_configuration_s & activeConfiguration
engine_configuration_s * engineConfiguration
static int BUSY_WAIT_DELAY
static void lcdSleep(int period)
static void lcd_HD44780_write(uint8_t data)
bool warning(obd_code_e code, const char *fmt,...)
static const int lineStart[]
void addConsoleAction(const char *token, Void callback)
Register console action without parameters.
void lcd_HD44780_print_string(const char *string)