X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=boards%2Fek-lpc-p2378%2Fhw%2Fhw_lcd_32122a.h;fp=boards%2Fek-lpc-p2378%2Fhw%2Fhw_lcd_32122a.h;h=6ec29c5cdeeb2d749e627cda074237b2423f293b;hb=6e0b59dab1ec92a0911eb5e8ebde34d96bb4739d;hp=0000000000000000000000000000000000000000;hpb=09a3f9313415b1a6faa1ffddec075e3cea6ba090;p=bertos.git diff --git a/boards/ek-lpc-p2378/hw/hw_lcd_32122a.h b/boards/ek-lpc-p2378/hw/hw_lcd_32122a.h new file mode 100644 index 00000000..6ec29c5c --- /dev/null +++ b/boards/ek-lpc-p2378/hw/hw_lcd_32122a.h @@ -0,0 +1,155 @@ +/** + * \file + * + * + * \brief Displaytech 32122A LCD driver + * + * \author Bernie Innocenti + * \author Stefano Fedrigo + * + */ + +#ifndef HW_LCD_32122A_H +#define HW_LCD_32122A_H + +#include +#include + +#warning TODO:This is an example implementation, you must implement it! + +/** + * Predefined LCD PWM contrast values + */ +#define LCD_DEF_PWM 145 +#define LCD_MAX_PWM 505 +#define LCD_MIN_PWM 130 +#define LCD_PWM_CH 0 + + +/** + * \name LCD I/O pins/ports + * @{ + */ +#define LCD_RS /* Implement me! */ +#define LCD_RW /* Implement me! */ +#define LCD_PE_E1 /* Implement me! */ +#define LCD_PE_E2 /* Implement me! */ +#define LCD_DB0 /* Implement me! */ +#define LCD_DB1 /* Implement me! */ +#define LCD_DB2 /* Implement me! */ +#define LCD_DB3 /* Implement me! */ +#define LCD_DB4 /* Implement me! */ +#define LCD_DB5 /* Implement me! */ +#define LCD_DB6 /* Implement me! */ +#define LCD_DB7 /* Implement me! */ +#define LCD_PF_DB0 /* Implment me! */ +/*@}*/ + +/** + * \name LCD bus control macros + * @{ + */ +#define LCD_CLR_A0 do { /* Implement me! */ } while (0) +#define LCD_SET_A0 do { /* Implement me! */ } while (0) +#define LCD_CLR_RD do { /* Implement me! */ } while (0) +#define LCD_SET_RD do { /* Implement me! */ } while (0) +#define LCD_CLR_E1 do { /* Implement me! */ } while (0) +#define LCD_SET_E1 do { /* Implement me! */ } while (0) +#define LCD_CLR_E2 do { /* Implement me! */ } while (0) +#define LCD_SET_E2 do { /* Implement me! */ } while (0) +#define LCD_SET_E(x) do { (void)x; /* Implement me! */ } while (0) +#define LCD_CLR_E(x) do { (void)x; /* Implement me! */ } while (0) +/*@}*/ + +/** + * \name Chip select bits for LCD_SET_E() + * @{ + */ +#define LCDF_E1 ( 0/* Implement me! */) +#define LCDF_E2 ( 0/* Implement me! */) +/*@}*/ +/** Read from the LCD data bus (DB[0-7]) */ +#define LCD_WRITE(x) ((void)x)/* Implement me! */ +/** Write to the LCD data bus (DB[0-7]) */ +#define LCD_READ (0 /* Implement me! */ ) + +/** Set data bus direction to output (write to display) */ +#define LCD_DB_OUT /* Implement me! */ + +/** Set data bus direction to input (read from display) */ +#define LCD_DB_IN /* Implement me! */ + +/** Delay for write (Enable pulse width, 220ns) */ +#define LCD_DELAY_WRITE \ + do { \ + NOP; \ + NOP; \ + NOP; \ + NOP; \ + NOP; \ + } while (0) + +/** Delay for read (Data ouput delay time, 120ns) */ +#define LCD_DELAY_READ \ + do { \ + NOP; \ + NOP; \ + NOP; \ + NOP; \ + } while (0) + + +#define LCD_32122_RESET() do { /* Implement me! */ } while (0) + +INLINE void lcd_32122a_hw_bus_init(void) +{ + cpu_flags_t flags; + IRQ_SAVE_DISABLE(flags); + + /* + * Here set bus pin! + * to init a lcd device. + * + */ + + /* + * Data bus is in output state most of the time: + * LCD r/w functions assume it is left in output state + */ + LCD_DB_OUT; + + + IRQ_RESTORE(flags); +} + +#endif /* HW_LCD_32122A_H */ +