ATY_LIB V2_102_230218
ATY_LIB for general devices or ALGO
 
Loading...
Searching...
No Matches
ssd1306.h
Go to the documentation of this file.
1// Copyright 2021 IOsetting <iosetting(at)outlook.com>
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef __FW_SSD1306_H__
16#define __FW_SSD1306_H__
17
18
19#include "fw_hal.h"
20#include "string.h"
21
22/* I2C address
23* address: 7 bit slave address, left aligned, bits 7:1 are used, LSB bit is not used
24*/
25#ifndef SSD1306_I2C_ADDR
26#define SSD1306_I2C_ADDR 0x78
27//#define SSD1306_I2C_ADDR 0x7A
28#endif
29
30/* SSD1306 settings */
31/* SSD1306 width in pixels */
32#ifndef SSD1306_WIDTH
33#define SSD1306_WIDTH 128
34#endif
35/* SSD1306 LCD height in pixels */
36#ifndef SSD1306_HEIGHT
37#define SSD1306_HEIGHT 64
38#endif
39
40#ifndef SSD1306_TIMEOUT
41#define SSD1306_TIMEOUT 20000
42#endif
43
45#define SSD1306_COLOR_BLACK 0x00
47#define SSD1306_COLOR_WHITE 0x01
48
49
54void SSD1306_WriteCommand(uint8_t command);
55
61
65void SSD1306_Init(void);
66
71void SSD1306_UpdateScreen(void);
72
77void SSD1306_ToggleInvert(void);
78
84void SSD1306_Fill(uint8_t Color);
85
95
103
115
116
117#endif
__CODE int8_t dat[20]
unsigned short uint16_t
Definition: fw_types.h:19
unsigned char uint8_t
Definition: fw_types.h:18
volatile int16_t y
Definition: main.c:34
volatile int16_t x
Definition: main.c:34
void SSD1306_WriteCommand(uint8_t command)
Writes single byte command to slave.
Definition: ssd1306.c:34
void SSD1306_ToggleInvert(void)
Toggles pixels invertion inside internal RAM.
Definition: ssd1306.c:167
void SSD1306_GotoXY(uint16_t x, uint16_t y)
Sets cursor pointer to desired location for strings.
Definition: ssd1306.c:216
void SSD1306_DrawPixel(uint16_t x, uint16_t y, uint8_t color)
Draws pixel at desired location.
Definition: ssd1306.c:191
void SSD1306_Init(void)
Definition: ssd1306.c:44
void SSD1306_UpdateScreen(void)
Updates buffer from internal RAM to LCD.
Definition: ssd1306.c:162
void SSD1306_DrawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t c)
Draws line on LCD.
Definition: ssd1306.c:223
void SSD1306_WriteData(uint8_t dat)
Writes single byte data to slave.
Definition: ssd1306.c:39
void SSD1306_Fill(uint8_t Color)
Fills entire LCD with desired color.
Definition: ssd1306.c:181