view lcd.h @ 5:efa2c22266e3

PWM control LED backlight. Not sure why the AFIO clock needs to be on for this but not, say USART.
author Daniel O'Connor <darius@dons.net.au>
date Fri, 06 Jan 2012 09:46:28 +1030
parents 2c87e30c982d
children 9404b9869c27
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);

/* 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