summaryrefslogtreecommitdiffstats
path: root/m168_firmware/lcd.h
blob: e094ae6dd6a2fa449437422bc7aa5f53ec24d0e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef WIFI_LCD_H_
#define WIFI_LCD_H_

#include "util.h"

#include <stdint.h>
#include <avr/pgmspace.h>


/* Number of pixel columns */
#define LCD_NR_COLUMNS		96
/* Number of lines */
#define LCD_NR_LINES		4
/* Number of pixel columns per char */
#define LCD_PIXCOLS_PER_CHAR	6
/* Number of characters in a row */
#define LCD_NR_CHARCOLUMNS	(LCD_NR_COLUMNS / LCD_PIXCOLS_PER_CHAR)


#define LCD_BUFFER_SIZE		(LCD_NR_COLUMNS * LCD_NR_LINES)
extern uint8_t lcd_buffer[LCD_BUFFER_SIZE];
extern uint16_t lcd_cursor;


void lcd_init(void);

/* Print a string from RAM memory */
void printmem(const char *string, uint8_t length);
/* Print a NUL terminated string from EEPROM */
void printee(const eeprom_char *eeprom_string);
/* Print a NUL terminated string from flash memory */
void print(const prog_char *flash_string);
/* Print a number in hexadecimal */
void printhex(uint8_t number);
/* Print a number in decimal */
void printdec(uint16_t number);

void lcd_char_out(uint8_t c);
void lcd_clear_buffer(void);
void lcd_commit(void);

void lcd_backlight_on(void);
void lcd_backlight_off(void);

static inline void lcd_charcursor(uint8_t line, uint8_t column)
{
	lcd_cursor = (line * LCD_NR_COLUMNS) +
		     (column * LCD_PIXCOLS_PER_CHAR);
}

#endif /* WIFI_LCD_H_ */
bues.ch cgit interface