Skip to content

Commit

Permalink
Merus i2c correction
Browse files Browse the repository at this point in the history
  • Loading branch information
karawin committed Dec 8, 2017
1 parent ab47841 commit d770874
Show file tree
Hide file tree
Showing 17 changed files with 2,891 additions and 2,896 deletions.
Binary file modified build/KaRadio32.bin
Binary file not shown.
Binary file modified build/KaRadio32.elf
Binary file not shown.
5,756 changes: 2,878 additions & 2,878 deletions build/KaRadio32.map

Large diffs are not rendered by default.

Binary file modified build/MerusAudio/MerusAudio.o
Binary file not shown.
Binary file modified build/MerusAudio/libMerusAudio.a
Binary file not shown.
Binary file modified build/audio_renderer/audio_renderer.o
Binary file not shown.
Binary file modified build/audio_renderer/libaudio_renderer.a
Binary file not shown.
Binary file modified build/main/gpio.o
Binary file not shown.
Binary file modified build/main/libmain.a
Binary file not shown.
Binary file modified build/u8g2/csrc/u8g2_esp32_hal.o
Binary file not shown.
Binary file modified build/u8g2/libu8g2.a
Binary file not shown.
Binary file modified build/ucglib/csrc/ucg_esp32_hal.o
Binary file not shown.
Binary file modified build/ucglib/libucglib.a
Binary file not shown.
9 changes: 6 additions & 3 deletions components/MerusAudio/MerusAudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#define I2C_MASTER_NUM I2C_NUM_0 /*!< I2C port number for master dev */
#define I2C_MASTER_TX_BUF_DISABLE 0 /*!< I2C master do not need buffer */
#define I2C_MASTER_RX_BUF_DISABLE 0 /*!< I2C master do not need buffer */
#define I2C_MASTER_FREQ_HZ 100000 /*!< I2C master clock frequency */
#define I2C_MASTER_FREQ_HZ 80000 /*!< I2C master clock frequency */

#define MA12040_ADDR 0x20 /*!< slave address for MA12040 amplifier */

Expand All @@ -47,7 +47,9 @@


void i2c_master_init()
{ int i2c_master_port = I2C_MASTER_NUM;
{
// KaRadio32, I2C may be already configured.
int i2c_master_port = I2C_MASTER_NUM;
i2c_config_t conf;
conf.mode = I2C_MODE_MASTER;
conf.sda_io_num = I2C_MASTER_SDA_IO;
Expand All @@ -58,7 +60,8 @@ void i2c_master_init()
esp_err_t res = i2c_param_config(i2c_master_port, &conf);
printf("Driver param setup : %d\n",res);
res = i2c_driver_install(i2c_master_port, conf.mode, I2C_MASTER_RX_BUF_DISABLE, I2C_MASTER_TX_BUF_DISABLE, 0);
printf("Driver installed : %d\n",res);
if (res != 0) printf("Driver already installed. No problem \n");
else printf("Driver installed : %d\n",res);
//i2c_set_period(i2c_master_port,100,99);
}

Expand Down
9 changes: 0 additions & 9 deletions components/audio_renderer/audio_renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,6 @@ void render_samples(char *buf, uint32_t buf_len, pcm_format_t *buf_desc)
ptr_l += stride;
}
}

/* takes too long
i2s_event_t evt = {0};
if(xQueueReceive(i2s_event_queue, &evt, 0)) {
if(evt.type == I2S_EVENT_TX_DONE) {
ESP_LOGE(TAG, "DMA Buffer Underflow");
}
}
*/
}


Expand Down
11 changes: 6 additions & 5 deletions components/u8g2/csrc/u8g2_esp32_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,20 @@ uint8_t u8g2_esp32_msg_i2c_cb(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *

i2c_config_t conf;
conf.mode = I2C_MODE_MASTER;
ESP_LOGD(TAG, "sda_io_num %d", u8g2_esp32_hal.sda);
conf.sda_io_num = u8g2_esp32_hal.sda;
conf.sda_pullup_en = GPIO_PULLUP_ENABLE;
ESP_LOGD(TAG, "scl_io_num %d", u8g2_esp32_hal.scl);
conf.scl_io_num = u8g2_esp32_hal.scl;
conf.scl_pullup_en = GPIO_PULLUP_ENABLE;
ESP_LOGD(TAG, "clk_speed %d", I2C_MASTER_FREQ_HZ);
conf.master.clk_speed = I2C_MASTER_FREQ_HZ;
ESP_LOGD(TAG, "sda_io_num %d", u8g2_esp32_hal.sda);
ESP_LOGD(TAG, "scl_io_num %d", u8g2_esp32_hal.scl);
ESP_LOGD(TAG, "clk_speed %d", I2C_MASTER_FREQ_HZ);
ESP_LOGD(TAG, "i2c_param_config %d", conf.mode);
ESP_ERROR_CHECK(i2c_param_config(I2C_MASTER_NUM, &conf));
ESP_LOGD(TAG, "i2c_driver_install %d", I2C_MASTER_NUM);
ESP_ERROR_CHECK(i2c_driver_install(I2C_MASTER_NUM, conf.mode, I2C_MASTER_RX_BUF_DISABLE, I2C_MASTER_TX_BUF_DISABLE, 0));
/*
ESP_ERROR_CHECK(i2c_driver_install(I2C_MASTER_NUM, conf.mode, I2C_MASTER_RX_BUF_DISABLE, I2C_MASTER_TX_BUF_DISABLE, 0));

/*
i2c_cmd_handle_t cmd = i2c_cmd_link_create(); // dummy write
ESP_ERROR_CHECK(i2c_master_start(cmd));
ESP_ERROR_CHECK(i2c_master_write_byte(cmd, 0x00 | I2C_MASTER_WRITE, ACK_CHECK_DIS));
Expand Down
2 changes: 1 addition & 1 deletion components/u8g2/csrc/u8g2_esp32_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#define I2C_MASTER_NUM I2C_NUM_0 /*!< I2C port number for master dev */
#define I2C_MASTER_TX_BUF_DISABLE 0 /*!< I2C master do not need buffer */
#define I2C_MASTER_RX_BUF_DISABLE 0 /*!< I2C master do not need buffer */
#define I2C_MASTER_FREQ_HZ 50000 /*!< I2C master clock frequency */
#define I2C_MASTER_FREQ_HZ 80000 /*!< I2C master clock frequency */
#define ACK_CHECK_EN 0x1 /*!< I2C master will check ack from slave*/
#define ACK_CHECK_DIS 0x0 /*!< I2C master will not check ack from slave */

Expand Down

0 comments on commit d770874

Please sign in to comment.