Rp2040/Core/twi_arch.h
Go to the documentation of this file.
1 /*
2  * twi_arch.h - Platform-specific code
3  *
4  * See Sming/Core/si2c.cpp
5  *
6  */
7 
8 #pragma once
9 
10 #include <hardware/gpio.h>
11 #include <pico.h>
12 
13 //Enable SDA (becomes output and since GPO is 0 for the pin, it will pull the line low)
14 #define SDA_LOW() gpio_set_dir(twi_sda, true)
15 //Disable SDA (becomes input and since it has pullup it will go high)
16 #define SDA_HIGH() gpio_set_dir(twi_sda, false)
17 #define SDA_READ() gpio_get(twi_sda)
18 #define SCL_LOW() gpio_set_dir(twi_scl, true)
19 #define SCL_HIGH() gpio_set_dir(twi_scl, false)
20 #define SCL_READ() gpio_get(twi_scl)
21 
22 #define DEFAULT_SDA_PIN PICO_DEFAULT_I2C_SDA_PIN
23 #define DEFAULT_SCL_PIN PICO_DEFAULT_I2C_SCL_PIN