view lcd.h @ 7:9404b9869c27

Make the LCD panel work (timings, GPIOE clock needs to be on, etc) Factor out LCD init (needs more work)
author Daniel O'Connor <darius@dons.net.au>
date Sun, 22 Jan 2012 17:10:51 +1030
parents efa2c22266e3
children 58d76cf522ff
line wrap: on
line source

#ifndef LCD_H_
#define LCD_H_

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);
void		LCD_WR_StartData(uint16_t x, uint16_t y);
void		Delay(__IO uint32_t nCount);

/* Touch controller (TSC2046N) defines */
/* 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);

void		lcd_setpwm(uint16_t val);

#endif