[lcd] add support for operating on virtual framebuffers
Current implementation contains full support for: - transparent switching between direct and framebuffer rendering modes - writing characters to framebuffers - loading frame from memory to physical display As well as partial support for instruction writes including: - resetting the display (clears memory, sets cursor at 0:0, switches to increment mode) - switching between increment/decrement modes - setting cursor position
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#define DISPLAY_RW ((uint16_t) (0x1U << 10))
|
||||
#define DISPLAY_ENA ((uint16_t) (0x1U << 11))
|
||||
|
||||
#define DISPLAY_FRAMES_AVAILABLE 14
|
||||
|
||||
#define DISPLAY_POLL_UNTIL_READY do { while (display_read_status() & 0x80) {} } while (0)
|
||||
|
||||
#define DISPLAY_SET_INCREMENT do { display_write_instruction_byte(0x06); } while (0)
|
||||
@@ -16,11 +18,16 @@
|
||||
|
||||
#define DISPLAY_CLEAR do { display_write_instruction_byte(0x01); } while (0)
|
||||
|
||||
struct Display_emu_state {
|
||||
size_t cursor_offset:5;
|
||||
size_t next:1;
|
||||
};
|
||||
|
||||
void display_init(void);
|
||||
uint8_t display_read_status(void);
|
||||
void display_write_instruction_byte(uint8_t code);
|
||||
void display_write_data_byte(uint8_t code);
|
||||
void display_write_data_seq(char *codes);
|
||||
void display_to_framebuffer(void);
|
||||
void display_to_direct(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -32,6 +32,8 @@ extern "C" {
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user