mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-08-08 03:22:21 +00:00
i2c io
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
idf_component_register(SRCS "i2c_io.c" "i2c_multidevice.c"
|
||||
PRIV_REQUIRES spi_flash
|
||||
INCLUDE_DIRS "")
|
||||
REQUIRES driver
|
||||
INCLUDE_DIRS ".")
|
||||
|
@@ -0,0 +1 @@
|
||||
#include "i2c_io.h"
|
@@ -2,6 +2,8 @@
|
||||
#define I2C_IO_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "driver/i2c_master.h"
|
||||
|
||||
typedef struct {
|
||||
@@ -13,10 +15,10 @@ typedef struct {
|
||||
i2c_master_bus_config_t bus_config = {
|
||||
.clk_source = I2C_CLK_SRC_DEFAULT,
|
||||
.i2c_port = I2C_NUM_0, // Use I2C_NUM_1 for second port
|
||||
.scl_io_num = GPIO_NUM_22, // Your SCL pin
|
||||
.sda_io_num = GPIO_NUM_21, // Your SDA pin
|
||||
.scl_io_num = 22, // Your SCL pin
|
||||
.sda_io_num = 21, // Your SDA pin
|
||||
.glitch_ignore_cnt = 7,
|
||||
.flags.enable_internal_pullup = true
|
||||
.flags.enable_internal_pullup = true,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -20,6 +20,8 @@
|
||||
#include "esp_flash.h"
|
||||
#include "esp_system.h"
|
||||
|
||||
#include "i2c_io.h"
|
||||
|
||||
SemaphoreHandle_t xMutex;
|
||||
QueueHandle_t xQueue, xQueue1, xQueue2;
|
||||
typedef struct {
|
||||
|
Reference in New Issue
Block a user