Mercurial > ~darius > hgwebdir.cgi > stm32temp
diff lcd.h @ 4:2c87e30c982d
Add LCD init, touch screen writing etc..
PWM of LCD backlight doesn't work yet though..
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Tue, 03 Jan 2012 22:37:18 +1030 |
parents | 74e9b3baac1e |
children | efa2c22266e3 |
line wrap: on
line diff
--- a/lcd.h Sun Jan 01 11:01:13 2012 +1030 +++ b/lcd.h Tue Jan 03 22:37:18 2012 +1030 @@ -1,7 +1,52 @@ #ifndef LCD_H_ #define LCD_H_ -void LCD_init(void); +void LCD_init(void); +void LCD_WR_Reg(uint16_t index, uint16_t val); +uint16_t LCD_RD_Reg(uint16_t index); +uint16_t LCD_RD_Data(int first); +void LCD_WR_Data(uint16_t val); + +/* Mode/channel select defines */ +#define TP_READ_SEL(chan, mode, ref, pd) (0x80 | (((chan) & 0x07) << 4) | (((mode) & 0x01) << 3) | (((ref) & 0x01) << 2) | ((pd) & 0x03)) + +/* Channel select */ +#define TP_CHAN_TEMP0 0 +#define TP_CHAN_Y 1 +#define TP_CHAN_VBAT 2 +#define TP_CHAN_Z1 3 +#define TP_CHAN_Z2 4 +#define TP_CHAN_X 5 +#define TP_CHAN_AUX 6 +#define TP_CHAN_TEMP1 7 + +/* Mode select */ +#define TP_MODE_12 0 +#define TP_MODE_8 1 + +/* Reference type */ +#define TP_REF_DIFF 0 +#define TP_REF_SER 1 + +/* Power down mode */ +#define TP_PD_AUTO 0 +#define TP_PD_REF_OFF 1 +#define TP_PD_REF_ON 2 +#define TP_PD_ON 3 + +uint16_t TPRead(uint8_t type); + +uint16_t FlashReadID(void); +uint8_t FlashReadStatus(void); + +#define FL_BP0 (1<<2) +#define FL_BP1 (1<<3) +#define FL_BP2 (1<<4) +#define FL_BP3 (1<<5) +#define FL_BPL (1<<7) +void FlashWriteStatus(uint8_t status); + +void FlashWriteCtl(int enable); #endif