Cleanup
This commit is contained in:
parent
87cb0cf93a
commit
7b03447b18
1 changed files with 5 additions and 10 deletions
|
@ -27,13 +27,15 @@ i2c_master_bus_config_t i2c_bus_config = {
|
||||||
.glitch_ignore_cnt = 7,
|
.glitch_ignore_cnt = 7,
|
||||||
.flags.enable_internal_pullup = true,
|
.flags.enable_internal_pullup = true,
|
||||||
};
|
};
|
||||||
i2c_master_bus_handle_t bus_handle;
|
|
||||||
|
i2c_master_bus_handle_t bus_handle;
|
||||||
|
|
||||||
i2c_device_config_t chipconfig = {
|
i2c_device_config_t chipconfig = {
|
||||||
.scl_speed_hz = 100000,
|
.scl_speed_hz = 100000,
|
||||||
.device_address = 0b00100010 >> 1,
|
.device_address = 0b00100010 >> 1,
|
||||||
};
|
};
|
||||||
static const char TAG[] = "i2c-eeprom";
|
i2c_master_dev_handle_t i2c_dev;
|
||||||
|
|
||||||
static void i2s_example_read_task(void *args)
|
static void i2s_example_read_task(void *args)
|
||||||
{
|
{
|
||||||
uint8_t *r_buf = (uint8_t *)calloc(1, EXAMPLE_BUFF_SIZE);
|
uint8_t *r_buf = (uint8_t *)calloc(1, EXAMPLE_BUFF_SIZE);
|
||||||
|
@ -138,15 +140,12 @@ static void i2s_example_init_std_duplex(void)
|
||||||
ESP_ERROR_CHECK(i2s_channel_init_std_mode(rx_chan, &std_cfg));
|
ESP_ERROR_CHECK(i2s_channel_init_std_mode(rx_chan, &std_cfg));
|
||||||
}
|
}
|
||||||
|
|
||||||
i2c_master_dev_handle_t i2c_dev;
|
|
||||||
|
|
||||||
void app_main(void)
|
void app_main(void)
|
||||||
{
|
{
|
||||||
i2s_example_init_std_duplex();
|
i2s_example_init_std_duplex();
|
||||||
ESP_ERROR_CHECK(i2c_new_master_bus(&i2c_bus_config, &bus_handle));
|
ESP_ERROR_CHECK(i2c_new_master_bus(&i2c_bus_config, &bus_handle));
|
||||||
int ret;
|
|
||||||
|
|
||||||
ESP_GOTO_ON_ERROR(i2c_master_bus_add_device(bus_handle, &chipconfig, &i2c_dev), err, TAG, "i2c new bus failed");
|
ESP_ERROR_CHECK(i2c_master_bus_add_device(bus_handle, &chipconfig, &i2c_dev));
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
|
@ -164,8 +163,4 @@ void app_main(void)
|
||||||
/* Step 3: Create writing and reading task, enable and start the channels */
|
/* Step 3: Create writing and reading task, enable and start the channels */
|
||||||
xTaskCreate(i2s_example_read_task, "i2s_example_read_task", 4096, NULL, 5, NULL);
|
xTaskCreate(i2s_example_read_task, "i2s_example_read_task", 4096, NULL, 5, NULL);
|
||||||
xTaskCreate(i2s_example_write_task, "i2s_example_write_task", 4096, NULL, 5, NULL);
|
xTaskCreate(i2s_example_write_task, "i2s_example_write_task", 4096, NULL, 5, NULL);
|
||||||
|
|
||||||
err:
|
|
||||||
printf("Error\n");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue