blob: 4a29366a6eb045bad9084dad64615e5276f6bec6 (
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
|
#include <hardware/i2c.h>
#include <hardware/gpio.h>
#include <pico/error.h>
#include <pico/time.h>
#include "ssd1306.h"
int main() {
gpio_init(20);
gpio_init(21);
gpio_set_function(20, GPIO_FUNC_I2C);
gpio_set_function(21, GPIO_FUNC_I2C);
gpio_set_pulls(20, true, false);
gpio_set_pulls(21, true, false);
i2c_init(i2c0, 400 * 1000);
ssd1306_t display;
ssd_init(&display, i2c0, 0x3C);
ssd_power_on(&display);
ssd_push(&display, SSD1306_CTRL_DATA);
for (int i = 0; i < 8; i++) {
ssd_push(&display, 0xff);
}
ssd_send(&display);
return 0;
}
|