blob: e2dabf22d4d704b3e080800e51fe5d83194f09f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include "hardware/i2c.h"
namespace display
{
// I2C0 on GPIO8 (SDA) and GPIO9 (SCL) running at 400KHz
constexpr auto I2C_PORT = i2c0;
constexpr unsigned I2C_SDA = 8;
constexpr unsigned I2C_SCL = 9;
void
init()
{
i2c_init(I2C_PORT, 400*1000);
gpio_set_function(I2C_SDA, GPIO_FUNC_I2C);
gpio_set_function(I2C_SCL, GPIO_FUNC_I2C);
gpio_pull_up(I2C_SDA);
gpio_pull_up(I2C_SCL);
}
}
|