77 lines
2.0 KiB
C
77 lines
2.0 KiB
C
|
|
/*
|
||
|
|
* lcd.h
|
||
|
|
*
|
||
|
|
* Created on: May 27, 2022
|
||
|
|
* Author: Keith.Lloyd
|
||
|
|
*/
|
||
|
|
|
||
|
|
#ifndef LCD_H_
|
||
|
|
#define LCD_H_
|
||
|
|
|
||
|
|
#define LCD_WIDTH_PIXELS 240
|
||
|
|
#define LCD_HEIGHT_PIXELS 128
|
||
|
|
#define LCD_X_CENTER 120
|
||
|
|
#define LCD_Y CENTER 64
|
||
|
|
#define LCD_X_MAX 239
|
||
|
|
#define LCD_Y_MAX 127
|
||
|
|
#define LCD_X_MID 120
|
||
|
|
#define LCD_Y_MID 64
|
||
|
|
#define LCD_X_MIN 0
|
||
|
|
#define LCD_Y_MIN 0
|
||
|
|
|
||
|
|
#define LCD_Y_BITS_PER_PAGE 8 //8 bits per page in Y direction (for draw and get pixel)
|
||
|
|
|
||
|
|
//UC1608 defines: These all require CONTROL MODE
|
||
|
|
//Some commands have the last few bits as arguments. These can be set with SendLcdCommand()
|
||
|
|
#define LCD_SET_COLUMN_LSB 0x00 // last 4 bits are data
|
||
|
|
#define LCD_SET_COLUMN_MSB 0x10 // last 4 bits are data
|
||
|
|
#define LCD_SET_MUX_AND_TC 0x24 // ## 21 last 2 bits are Temperature compensation curve
|
||
|
|
#define LCD_SET_POWER_CONTROL 0x28 // last 3 bits are data ## 2D
|
||
|
|
#define LCD_SET_START_LINE 0x40 // last 6 bits are data
|
||
|
|
#define LCD_SET_GAIN_AND_POT 0x81 // DOUBLE BYTE COMMAND! Send this, then 8 data bits
|
||
|
|
#define LCD_SET_RAM_ADDRESS_CTRL 0x88 //## 89 ? Last 3 bits are the control
|
||
|
|
#define LCD_SET_ALL_PIXELS 0xA4 //# Actually off A5 = On Set all pixels - last bit is on/off
|
||
|
|
#define LCD_SYSTEM_RESET 0xE2 // # must delay min 15mS after use
|
||
|
|
#define LCD_SET_DISPLAY_ENABLE 0xAE // # last bit is arg (on/off)
|
||
|
|
#define LCD_SET_BIAS_RATIO 0xE8 // last 2 bits are data
|
||
|
|
#define LCD_SET_PAGE_ADDRESS 0xB0 //last 4 bits are data
|
||
|
|
|
||
|
|
|
||
|
|
typedef enum {
|
||
|
|
LCD_DRAW_SET,
|
||
|
|
LCD_DRAW_CLEAR,
|
||
|
|
LCD_DRAW_XOR
|
||
|
|
}LCD_DRAWMODE_t;
|
||
|
|
|
||
|
|
|
||
|
|
//UM1608 Data / Control line
|
||
|
|
typedef enum {
|
||
|
|
LCD_CDLINE_CONTROL = 0,
|
||
|
|
LCD_CDLINE_DATA = 1
|
||
|
|
}LCD_CDLINE_t;
|
||
|
|
|
||
|
|
|
||
|
|
void LCD_Init(void);
|
||
|
|
void Display_Update(void);
|
||
|
|
void LCD_Update(void);
|
||
|
|
void LCD_Clear(void);
|
||
|
|
void LCD_DrawPixel(int16_t x, int16_t y, LCD_DRAWMODE_t mode);
|
||
|
|
uint8_t LCD_GetPixel(int16_t x0, int16_t y0);
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
#if 0 //UC1608
|
||
|
|
|
||
|
|
#define UC1608_DATA 1
|
||
|
|
#define UC1608_CMD 0
|
||
|
|
|
||
|
|
int uc1608_send(struct spi_config *config,unsigned char *data, int len,uint8_t mode,uint8_t cmdPin);
|
||
|
|
void uc1608_setup(struct spi_config *config,uint8_t cmdPin);
|
||
|
|
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#endif /* LCD_H_ */
|