Updated library to work with the FRDM KL25Z board. Original code downloaded from DFRobot. Warning. For the 5 way switch to work correctly the LCD4884 shiled needs to be modified. The PCB line between resistor 202 and 102 just bellow the RED power LED needs to be cut and a connection from the 202 resistor to the 3V3 pin needs to be made.
Dependents: 10A_ClassProject_MegnaticGame
Fork of LCD4884 by
LCD4884.h@4:c6ce6c885358, 2015-12-08 (annotated)
- Committer:
- 1918june
- Date:
- Tue Dec 08 16:11:19 2015 +0000
- Revision:
- 4:c6ce6c885358
- Parent:
- 3:6a7641ddd544
vdvad
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
COX | 0:28f3c9274ea7 | 1 | /* |
COX | 0:28f3c9274ea7 | 2 | Modified by COX |
COX | 0:28f3c9274ea7 | 3 | version 0.1 |
COX | 0:28f3c9274ea7 | 4 | |
COX | 0:28f3c9274ea7 | 5 | Editor : COX |
COX | 0:28f3c9274ea7 | 6 | Date : 06.03.2013 |
COX | 0:28f3c9274ea7 | 7 | |
COX | 0:28f3c9274ea7 | 8 | * |
COX | 0:28f3c9274ea7 | 9 | * Update DFRobot source to work on FRDM KL25Z |
COX | 0:28f3c9274ea7 | 10 | * |
COX | 0:28f3c9274ea7 | 11 | */ |
COX | 0:28f3c9274ea7 | 12 | |
COX | 0:28f3c9274ea7 | 13 | #ifndef LCD4884_h |
COX | 0:28f3c9274ea7 | 14 | #define LCD4884_h |
COX | 0:28f3c9274ea7 | 15 | |
COX | 0:28f3c9274ea7 | 16 | #include "mbed.h" |
COX | 0:28f3c9274ea7 | 17 | |
COX | 0:28f3c9274ea7 | 18 | // SPI Interface --- (on arduino Arduino Digital Pin 2,3,4,5,6) |
1918june | 4:c6ce6c885358 | 19 | #define SPI_SCK PC_10 //Serial Clock(Master Output) |
1918june | 4:c6ce6c885358 | 20 | #define SPI_MOSI PC_12 //Master Output,Slave Input |
1918june | 4:c6ce6c885358 | 21 | #define LCD_DC PC_11 //Data/Command(command active low) |
1918june | 4:c6ce6c885358 | 22 | #define SPI_CS PD_2 //Chip Select,Slave Transmit Enable(active low,Master Output) |
1918june | 4:c6ce6c885358 | 23 | #define LCD_RST D8 //One Reset button |
1918june | 4:c6ce6c885358 | 24 | #define LCD_BL D2 //PWM Backlit control (Arduino DIO Pin 7) |
COX | 0:28f3c9274ea7 | 25 | |
COX | 0:28f3c9274ea7 | 26 | |
COX | 0:28f3c9274ea7 | 27 | //display mode -- normal / highlight |
COX | 0:28f3c9274ea7 | 28 | #define MENU_NORMAL 0 |
COX | 0:28f3c9274ea7 | 29 | #define MENU_HIGHLIGHT 1 |
COX | 0:28f3c9274ea7 | 30 | #define OFF 0 |
COX | 0:28f3c9274ea7 | 31 | #define ON 1 |
COX | 0:28f3c9274ea7 | 32 | #define LOW 0 |
COX | 0:28f3c9274ea7 | 33 | #define HIGH 1 |
COX | 0:28f3c9274ea7 | 34 | #define ONE_US 0.000001 |
COX | 0:28f3c9274ea7 | 35 | #define LCD_INITIAL_BRIGHTNESS 1 |
COX | 0:28f3c9274ea7 | 36 | |
COX | 0:28f3c9274ea7 | 37 | namespace mbed { |
COX | 0:28f3c9274ea7 | 38 | |
COX | 0:28f3c9274ea7 | 39 | class LCD4884 |
COX | 0:28f3c9274ea7 | 40 | { |
COX | 0:28f3c9274ea7 | 41 | public: |
COX | 0:28f3c9274ea7 | 42 | LCD4884(); |
COX | 0:28f3c9274ea7 | 43 | void LCD_init(void); |
COX | 0:28f3c9274ea7 | 44 | void backlight(float dat); |
COX | 0:28f3c9274ea7 | 45 | void LCD_write_byte(unsigned char dat, unsigned char dat_type); |
COX | 0:28f3c9274ea7 | 46 | void LCD_draw_bmp_pixel(unsigned char X,unsigned char Y,unsigned char *map,unsigned char Pix_x,unsigned char Pix_y); |
COX | 0:28f3c9274ea7 | 47 | void LCD_write_string(unsigned char X,unsigned char Y,char *s, char mode); |
COX | 0:28f3c9274ea7 | 48 | void LCD_prop_write_string(unsigned char X,unsigned char Y,char *s, char mode); |
COX | 0:28f3c9274ea7 | 49 | void LCD_write_chinese(unsigned char X, unsigned char Y,unsigned char *c,unsigned char ch_with,unsigned char num,unsigned char line,unsigned char row); |
COX | 0:28f3c9274ea7 | 50 | void LCD_write_string_big ( unsigned char X,unsigned char Y, char *string, char mode ); |
COX | 0:28f3c9274ea7 | 51 | void LCD_write_char_big (unsigned char X,unsigned char Y, unsigned char ch, char mode); |
COX | 0:28f3c9274ea7 | 52 | void LCD_write_char(unsigned char c, char mode); |
COX | 0:28f3c9274ea7 | 53 | unsigned char LCD_prop_write_char(unsigned char c, char mode); |
COX | 0:28f3c9274ea7 | 54 | void LCD_set_XY(unsigned char X, unsigned char Y); |
COX | 0:28f3c9274ea7 | 55 | void LCD_clear(void); |
COX | 0:28f3c9274ea7 | 56 | }; |
COX | 0:28f3c9274ea7 | 57 | } |
COX | 0:28f3c9274ea7 | 58 | extern LCD4884 lcd; |
COX | 0:28f3c9274ea7 | 59 | |
COX | 0:28f3c9274ea7 | 60 | #endif |
COX | 0:28f3c9274ea7 | 61 |