-
Notifications
You must be signed in to change notification settings - Fork 5
/
ssd1306xled.h
64 lines (52 loc) · 1.71 KB
/
ssd1306xled.h
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
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* SSD1306xLED - Drivers for SSD1306 controlled dot matrix OLED/PLED 128x64 displays
*
* @created: 2014-08-12
* @author: Neven Boyanov
*
* Source code available at: https://bitbucket.org/tinusaur/ssd1306xled
*
*/
#include <stdint.h>
#include <Arduino.h>
// #include <avr/pgmspace.h>
// #include <avr/interrupt.h>
#include <util/delay.h>
#ifndef SSD1306XLED_H
#define SSD1306XLED_H
// ----------------------------------------------------------------------------
// -----(+)---------------> // Vcc, Pin 1 on SSD1306 Board
// -----(-)---------------> // GND, Pin 2 on SSD1306 Board
#ifndef SSD1306_SCL
#define SSD1306_SCL PB2 // SCL, Pin 3 on SSD1306 Board
#endif
#ifndef SSD1306_SDA
#define SSD1306_SDA PB0 // SDA, Pin 4 on SSD1306 Board
#endif
#ifndef SSD1306_SA
#define SSD1306_SA 0x78 // Slave address
#endif
// ----------------------------------------------------------------------------
class SSD1306Device
{
public:
SSD1306Device(void);
void ssd1306_init(void);
void ssd1306_xfer_start(void);
void ssd1306_xfer_stop(void);
void ssd1306_send_byte(uint8_t byte);
void ssd1306_send_command(uint8_t command);
void ssd1306_send_data_start(void);
void ssd1306_send_data_stop(void);
void ssd1306_setpos(uint8_t x, uint8_t y);
void ssd1306_fillscreen(uint8_t fill);
void ssd1306_char_font6x8(char ch);
void ssd1306_string_font6x8(char *s);
void ssd1306_draw_bmp(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, const uint8_t bitmap[]);
void ssd1306_send_command_start(void);
void ssd1306_send_command_stop(void);
void ssd1306_char_f8x16(uint8_t x, uint8_t y, const char ch[]);
};
extern SSD1306Device SSD1306;
// ----------------------------------------------------------------------------
#endif