From 3fb2c7d40268f4429ac03793020de4817530e6c6 Mon Sep 17 00:00:00 2001 From: devsaurus Date: Thu, 18 Oct 2018 22:47:39 +0200 Subject: [PATCH] fix intr_alloc setting re-enable i2s.read() --- components/modules/i2s.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/modules/i2s.c b/components/modules/i2s.c index 32c5d19f..c9b673ba 100644 --- a/components/modules/i2s.c +++ b/components/modules/i2s.c @@ -158,7 +158,7 @@ static int node_i2s_start( lua_State *L ) lua_getfield (L, 2, "buffer_len"); i2s_config.dma_buf_len = luaL_optint(L, -1, i2s_config.sample_rate / 100); // - i2s_config.intr_alloc_flags = ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_IRAM; + i2s_config.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1; // lua_getfield (L, 2, "bck_pin"); pin_config.bck_io_num = luaL_optint(L, -1, I2S_PIN_NO_CHANGE); @@ -269,10 +269,10 @@ static int node_i2s_read( lua_State *L ) I2S_CHECK_ID( i2s_id ); size_t bytes = luaL_checkinteger( L, 2 ); - //int wait_ms = luaL_optint(L, 3, 0); + int wait_ms = luaL_optint(L, 3, 0); char * data = luaM_malloc( L, bytes ); - size_t read = 0; - //read = i2s_read_bytes(i2s_id, data, bytes, wait_ms / portTICK_RATE_MS); + size_t read; + i2s_read(i2s_id, data, bytes, &read, wait_ms / portTICK_RATE_MS); lua_pushlstring(L, data, read); luaM_free(L, data);