diff lcd.h @ 8:58d76cf522ff

Split out code into separate files.
author Daniel O'Connor <darius@dons.net.au>
date Sat, 04 Feb 2012 13:29:31 +1030
parents 9404b9869c27
children be0a1ac64d97
line wrap: on
line diff
--- a/lcd.h	Sun Jan 22 17:10:51 2012 +1030
+++ b/lcd.h	Sat Feb 04 13:29:31 2012 +1030
@@ -1,57 +1,20 @@
-#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
+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		lcd_setpwm(uint16_t val);
+void		lcd_pixel(uint16_t x, uint16_t y, uint16_t colour);
+void		lcd_circle(uint16_t x0, uint16_t y0, uint16_t radius, uint16_t colour);
+void		lcd_line(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t colour);
 
-/* 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);
+#define LCD_HEIGHT	240
+#define LCD_WIDTH	320
 
-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
-
+#define RGB24_565(R, G, B) (((((R) >> 3) & 0x1f) << 11) | ((((G) >> 2) & 0x3f) << 5) | (((B) >> 3) & 0x1f))
+#define LCD_WHITE	RGB24_565(255, 255, 255)
+#define LCD_BLACK	RGB24_565(0, 0, 0)
+#define LCD_RED		RGB24_565(255, 0, 0)
+#define LCD_GREEN	RGB24_565(0, 255, 0)
+#define LCD_BLUE	RGB24_565(0, 0, 255)