-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOLEDC.h
81 lines (69 loc) · 3.06 KB
/
OLEDC.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
(c) 2016 Microchip Technology Inc. and its subsidiaries. You may use this
software and any derivatives exclusively with Microchip products.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
TERMS.
*/
#ifndef OLED_C_H
#define OLED_C_H
#include <stdint.h>
#include <stdbool.h>
typedef struct oledc_color_t {
uint8_t red;
uint8_t green;
uint8_t blue;
} oledc_color_t;
typedef enum OLEDC_CMDS {
OLEDC_CMD_SET_COLUMN_ADDRESS = 0x15,
OLEDC_CMD_SET_ROW_ADDRESS = 0x75,
OLEDC_CMD_WRITE_RAM = 0x5C,
OLEDC_CMD_READ_RAM = 0x5D,
OLEDC_CMD_SET_REMAP_DUAL_COM_LINE_MODE = 0xA0,
OLEDC_CMD_SET_DISPLAY_START_LINE = 0xA1,
OLEDC_CMD_SET_DISPLAY_OFFSET = 0xA2,
OLEDC_CMD_SET_DISPLAY_MODE_OFF_BLACK = 0xA4,
OLEDC_CMD_SET_DISPLAY_MODE_OFF_GS60 = 0xA5,
OLEDC_CMD_SET_DISPLAY_MODE_ON = 0xA6,
OLEDC_CMD_SET_DISPLAY_MODE_INVERSE = 0xA7,
OLEDC_CMD_SET_FUNCTION_SELECTION = 0xAB,
OLEDC_CMD_SET_SLEEP_MODE_ON = 0xAE,
OLEDC_CMD_SET_SLEEP_MODE_OFF = 0xAF,
OLEDC_CMD_SET_PHASE_LENGTH = 0xB1,
OLEDC_CMD_DISPLAY_ENHANCEMENT = 0xB2,
OLEDC_CMD_SET_FRONT_CLOCK_DIVIDER_OSC_FREQ = 0xB3,
OLEDC_CMD_SET_GPIO = 0xB5,
OLEDC_CMD_SET_SECOND_PRECHARGE_PERIOD = 0xB6,
OLEDC_CMD_GRAY_SCALE_PULSE_WIDTH_LUT = 0xB8,
OLEDC_CMD_USE_LINEAR_LUT = 0xB9,
OLEDC_CMD_SET_PRECHARGE_VOLTAGE = 0xBB,
OLEDC_CMD_SET_VCOMH_VOLTAGE = 0xBE,
OLEDC_CMD_SET_CONTRAST_CURRENT = 0xC1,
OLEDC_CMD_MASTER_CONTRAST_CURRENT_CONTROL = 0xC7,
OLEDC_CMD_SET_MUX_RATIO = 0xCA,
OLEDC_CMD_SET_COMMAND_LOCK = 0xFD
} OLEDC_COMMAND;
void sendCommand(OLEDC_COMMAND cmd, uint8_t *payload, uint8_t payload_size);
void OLEDC_setRowAddressBounds(uint8_t min, uint8_t max);
void OLEDC_setColumnAddressBounds(uint8_t min, uint8_t max);
void OLEDC_setSleepMode(bool on);
void OLEDC_startReadingDisplay(void);
void OLEDC_stopReadingDisplay(void);
uint16_t OLEDC_readColor(void);
void OLEDC_init(void);
void OLEDC_sendColor(uint8_t r, uint8_t g, uint8_t b);
void OLEDC_sendColorInt(uint16_t raw);
void OLEDC_startWritingDisplay(void);
void OLEDC_stopWritingDisplay(void);
#endif