X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=examples%2Fparts%2Fhd44780.c;h=8fe194c4693dbc2be5dc655af9ced2c6bc22c07f;hb=fddb2a02e9feadaefaf690b07a69a1556fb96fd1;hp=39550508311aaebec4e97ed4a7d338a3b76cedab;hpb=663049635100d7e6b982330a9a42a937fa2e6a68;p=simavr diff --git a/examples/parts/hd44780.c b/examples/parts/hd44780.c index 3955050..8fe194c 100644 --- a/examples/parts/hd44780.c +++ b/examples/parts/hd44780.c @@ -23,7 +23,7 @@ #include #include #include -#include "sim_cycle_timers.h" +#include "sim_time.h" #include "hd44780.h" @@ -198,7 +198,7 @@ hd44780_process_write( if (comp) b->datapins = (b->datapins & 0xf0) | ((b->pinstate >> IRQ_HD44780_D4) & 0xf); else - b->datapins = (b->datapins & 0xf) | ((b->pinstate >> IRQ_HD44780_D4-4) & 0xf0); + b->datapins = (b->datapins & 0xf) | ((b->pinstate >> (IRQ_HD44780_D4-4)) & 0xf0); write = comp; b->flags ^= (1 << HD44780_FLAG_LOWNIBBLE); } else { // 8 bits @@ -340,8 +340,8 @@ hd44780_pin_changed_hook( b->pinstate = (b->pinstate & ~(1 << irq->irq)) | (value << irq->irq); int eo = old & (1 << IRQ_HD44780_E); int e = b->pinstate & (1 << IRQ_HD44780_E); - // on the E pin rising edge, do stuff otherwise just exit - if (!eo && e) + // on the E pin falling edge, do stuff otherwise just exit + if (eo && !e) avr_cycle_timer_register(b->avr, 1, _hd44780_process_e_pinchange, b); }