Esp32/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 <hal/gpio_types.h>
11 #define gpio_drive_cap_t uint32_t
12 #include <hal/gpio_ll.h>
13 
14 //Enable SDA (becomes output and since GPO is 0 for the pin, it will pull the line low)
15 #define SDA_LOW() gpio_ll_output_enable(&GPIO, gpio_num_t(twi_sda))
16 //Disable SDA (becomes input and since it has pullup it will go high)
17 #define SDA_HIGH() gpio_ll_output_disable(&GPIO, gpio_num_t(twi_sda))
18 #define SDA_READ() (gpio_ll_get_level(&GPIO, gpio_num_t(twi_sda)) != 0)
19 #define SCL_LOW() gpio_ll_output_enable(&GPIO, gpio_num_t(twi_scl))
20 #define SCL_HIGH() gpio_ll_output_disable(&GPIO, gpio_num_t(twi_scl))
21 #define SCL_READ() (gpio_ll_get_level(&GPIO, gpio_num_t(twi_scl)) != 0)
22 
23 #define DEFAULT_SDA_PIN 21
24 #define DEFAULT_SCL_PIN 22