35 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| #ifndef __LCD
 | |
| #define __LCD
 | |
| 
 | |
| #include <stdint.h>
 | |
| 
 | |
| #define DISPLAY_RS  ((uint16_t) (0x1U << 7))
 | |
| #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)
 | |
| #define DISPLAY_SET_DECREMENT do { display_write_instruction_byte(0x04); } while (0)
 | |
| 
 | |
| #define DISPLAY_SET_CURSOR(line, position) do { display_write_instruction_byte(0x80 | (line << 6) | position); } while (0)
 | |
| 
 | |
| #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);
 | |
| 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);
 | |
| void display_load(uint32_t frame_no);
 | |
| 
 | |
| #endif
 |