Version 1.0.0
Initial version.
This commit is contained in:
		
							
								
								
									
										2
									
								
								main/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								main/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| idf_build_get_property(project_dir PROJECT_DIR) | ||||
| idf_component_register(SRCS "main.c" INCLUDE_DIRS "" REQUIRES driver) | ||||
							
								
								
									
										26
									
								
								main/main.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								main/main.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| #include "driver/i2c_master.h" | ||||
| #include "freertos/FreeRTOS.h" | ||||
| #include "freertos/task.h" | ||||
|  | ||||
| #define I2C_PORT (I2C_NUM_MAX - 1) | ||||
|  | ||||
| void app_main(void) | ||||
| { | ||||
|     i2c_master_bus_config_t i2c_bus_config = { | ||||
|         .clk_source = I2C_CLK_SRC_DEFAULT, | ||||
|         .i2c_port = I2C_PORT, | ||||
|         .scl_io_num = GPIO_NUM_22, // In accordance with used chip. | ||||
|         .sda_io_num = GPIO_NUM_21, // In accordance with used chip. | ||||
|         .glitch_ignore_cnt = 7, | ||||
|         .flags.enable_internal_pullup = true, | ||||
|     }; | ||||
|     i2c_master_bus_handle_t i2c_bus_handle; | ||||
|     i2c_new_master_bus(&i2c_bus_config, &i2c_bus_handle); | ||||
|     for (uint8_t i = 0; i <= 127; ++i) | ||||
|     { | ||||
|         if (i2c_master_probe(i2c_bus_handle, i, 1000 / portTICK_PERIOD_MS) == ESP_OK) | ||||
|         { | ||||
|             printf("Address 0x%02X\n", i); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user