Skip to content

Commit

Permalink
Pre 2.2 R2
Browse files Browse the repository at this point in the history
  • Loading branch information
karawin committed Feb 20, 2022
1 parent d88aa03 commit 78dd085
Show file tree
Hide file tree
Showing 53 changed files with 5,500 additions and 1,237 deletions.
Binary file removed binaries/ESPlay.bin
Binary file not shown.
Binary file modified binaries/KaRadio32.bin
Binary file not shown.
Binary file removed binaries/standard_adb.bin
Binary file not shown.
Binary file removed binaries/standard_adbnoled.bin
Binary file not shown.
Binary file removed binaries/standard_minimal.bin
Binary file not shown.
Binary file removed binaries/standard_touch.bin
Binary file not shown.
Binary file modified boards/build/pattern.bin
Binary file not shown.
Empty file added boards/build/radiva52.bin
Empty file.
Binary file not shown.
66 changes: 66 additions & 0 deletions boards/standard_psram_bat.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
key,type,encoding,value
label_space,namespace,,
L_LABEL,data,string,standard_psram.csv
L_COMMENT,data,string,This is the standard configuration for a wrover.
gpio_space,namespace,,
K_SPI,data,u8,2
P_MISO,data,u8,19
P_MOSI,data,u8,23
P_CLK,data,u8,18
P_XCS,data,u8,32
P_RST,data,u8,12
P_XDCS,data,u8,33
P_DREQ,data,u8,34
P_ENC0_A,data,u8,15
P_ENC0_B,data,u8,27
P_ENC0_BTN,data,u8,5
P_ENC1_A,data,u8,255
P_ENC1_B,data,u8,27
P_ENC1_BTN,data,u8,5
P_BTN0_A,data,u8,255
P_BTN0_B,data,u8,255
P_BTN0_C,data,u8,255
P_BTN1_A,data,u8,255
P_BTN1_B,data,u8,255
P_BTN1_C,data,u8,255
P_I2C_SCL,data,u8,14
P_I2C_SDA,data,u8,13
P_I2C_RST,data,u8,2
P_LCD_CS,data,u8,13
P_LCD_A0,data,u8,14
P_LCD_RST,data,u8,2
P_IR_SIGNAL,data,u8,255
P_I2S_LRCK,data,u8,25
P_I2S_BCLK,data,u8,26
P_I2S_DATA,data,u8,22
P_TOUCH_CS,data,u8,255
P_JOY_0,data,u8,255
P_JOY_1,data,u8,255
P_LED_GPIO,data,u8,4
P_ADC_KBD,data,u8,255
P_ADC_BAT,data,u8,32
P_BACKLIGHT,data,u8,255
option_space,namespace,,
O_LCD_TYPE,data,u8,255
O_LCD_ROTA,data,u8,255
O_LCD_OUT,data,u32,255
O_DDMM_FLAG,data,u8,255
custom_ir_space,namespace,,
K_UP,data,string,
K_LEFT,data,string,
K_OK,data,string,
K_RIGHT,data,string,
K_DOWN,data,string,
K_0,data,string,
K_1,data,string,
K_2,data,string,
K_3,data,string,
K_4,data,string,
K_5,data,string,
K_6,data,string,
K_7,data,string,
K_8,data,string,
K_9,data,string,
K_STAR,data,string,
K_DIESE,data,string,
K_INFO,data,string,
6 changes: 3 additions & 3 deletions components/audio_player/audio_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ static int start_decoder_task(player_t *player)
case OCTET_STREAM: // probably .aac
if (!bigSram())
{
ESP_LOGE(TAG, "aac mime not supported on WROOM cpu, type: %d", player->media_stream->content_type);
ESP_LOGE(TAG, "aac not supported on WROOM cpu");
spiRamFifoReset();
clientDisconnect("AAC Not played");
clientDisconnect("no AAC");
return -1;
}

Expand Down Expand Up @@ -116,7 +116,7 @@ int audio_stream_consumer(const char *recv_buf, ssize_t bytes_read)
t = 0;
// buffer is filled, start decoder
if (start_decoder_task(player_instance) != 0) {
ESP_LOGE(TAG, "failed to start decoder task");
ESP_LOGE(TAG, "Decoder task failed");
audio_player_stop();
clientDisconnect("decoder failed");
return -1;
Expand Down
41 changes: 23 additions & 18 deletions components/audio_renderer/audio_renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
#include "app_main.h"
#include "MerusAudio.h"

//#include "freertos/FreeRTOS.h"

//#include "common_component.h"


#include "audio_player.h"
#include "audio_renderer.h"

Expand Down Expand Up @@ -166,12 +171,12 @@ static void render_i2s_samples(char *buf, uint32_t buf_len, pcm_format_t *buf_de
size_t bytes_written = 0;
while((bytes_left > 0) ) {//&& (renderer_status == RUNNING)) {
res = i2s_write(renderer_instance->i2s_num, buf, bytes_left,& bytes_written,3);
if (res != ESP_OK) {
/* if (res != ESP_OK) {
ESP_LOGE(TAG, "i2s_write error %d",res);
}
} */
bytes_left -= bytes_written;
buf += bytes_written;
if (bytes_left != 0) printf("%d/%d\n",bytes_written,buf_len);
// if (bytes_left != 0) printf("%d/%d\n",bytes_written,buf_len);
//vTaskDelay(1);
}
}
Expand Down Expand Up @@ -286,7 +291,7 @@ static void render_i2s_samples(char *buf, uint32_t buf_len, pcm_format_t *buf_de
free (outBuf8);
}

static bool IRAM_ATTR set_sample_rate(int hz)
static bool set_sample_rate(int hz)
{
// if (!i2sOn) return false;
if (hz < 32000) return false;
Expand All @@ -310,7 +315,7 @@ static bool IRAM_ATTR set_sample_rate(int hz)
}


static inline void IRAM_ATTR change_volume16(int16_t *buffer, size_t num_samples)
static inline void change_volume16(int16_t *buffer, size_t num_samples)
{
volatile uint32_t mult = renderer_instance->volume;

Expand All @@ -324,7 +329,7 @@ static inline void IRAM_ATTR change_volume16(int16_t *buffer, size_t num_samples
}
}

static void IRAM_ATTR encode_spdif(uint32_t *spdif_buffer, int16_t *buffer, size_t num_samples, pcm_format_t *buf_desc)
static void encode_spdif(uint32_t *spdif_buffer, int16_t *buffer, size_t num_samples, pcm_format_t *buf_desc)
{
// pointer to left / right sample positio
int16_t *ptr_l = buffer;
Expand Down Expand Up @@ -435,7 +440,7 @@ static void IRAM_ATTR render_spdif_samples(const void *buf, uint32_t buf_len, pc

// ESP_LOGI(TAG, "render_spdif_samples len: %d, bytes_cnt: %d",buf_len,bytes_cnt);

uint32_t *spdif_buffer = malloc(bytes_cnt);
uint32_t *spdif_buffer = heap_caps_malloc(bytes_cnt, MALLOC_CAP_DMA);
if (spdif_buffer == NULL)
{
ESP_LOGE(TAG, "malloc buf failed len:%d ",buf_len);
Expand Down Expand Up @@ -470,7 +475,7 @@ void IRAM_ATTR render_samples(char *buf, uint32_t buf_len, pcm_format_t *buf_des
render_i2s_samples(buf, buf_len, buf_desc);
}

void IRAM_ATTR renderer_zero_dma_buffer()
void renderer_zero_dma_buffer()
{
i2s_zero_dma_buffer(renderer_instance->i2s_num);
}
Expand Down Expand Up @@ -540,7 +545,7 @@ bool init_i2s(/*renderer_config_t *config*/)


i2s_mode_t mode = I2S_MODE_MASTER | I2S_MODE_TX;
i2s_comm_format_t comm_fmt = I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB;
i2s_comm_format_t comm_fmt = I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB ;
i2s_bits_per_sample_t bit_depth = config->bit_depth;
int sample_rate = config->sample_rate;
int use_apll = 0;
Expand All @@ -551,7 +556,7 @@ bool init_i2s(/*renderer_config_t *config*/)
{
config->bit_depth = I2S_BITS_PER_SAMPLE_16BIT;
mode = mode | I2S_MODE_DAC_BUILT_IN;
comm_fmt = I2S_COMM_FORMAT_I2S_MSB;
// comm_fmt = I2S_COMM_FORMAT_I2S_MSB;
}
else if(config->output_mode == PDM)
{
Expand All @@ -571,9 +576,9 @@ bool init_i2s(/*renderer_config_t *config*/)
// don't do it for PDM
if(out_info.revision > 0) {
use_apll = 1;
ESP_LOGI(TAG, "chip revision %d, enabling APLL", out_info.revision);
ESP_LOGD(TAG, "chip rev. %d, enabling APLL", out_info.revision);
} else
ESP_LOGI(TAG, "chip revision %d, cannot enable APLL", out_info.revision);
ESP_LOGD(TAG, "chip rev. %d, cannot enable APLL", out_info.revision);
}
/*
* Allocate just enough to decode AAC+, which has huge frame sizes.
Expand All @@ -584,17 +589,18 @@ bool init_i2s(/*renderer_config_t *config*/)
* 16 bit: 32 * 256 = 8192 bytes
* 32 bit: 32 * 256 = 16384 bytes
*/
int bc = bigSram()?10:8;
int bc = bigSram()?16:8;
int bl = bigSram()?256:128;
i2s_config_t i2s_config = {
.mode = mode, // Only TX
.sample_rate = sample_rate,
.bits_per_sample = bit_depth,
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, // 2-channels
.communication_format = comm_fmt,
.dma_buf_count = bc, // number of buffers, 128 max. 16
// .dma_buf_len = bigSram()?256:128, // size of each buffer 128
.dma_buf_len = 512, // size of each buffer 128
// .intr_alloc_flags = ESP_INTR_FLAG_LEVEL1, // lowest level 1
.dma_buf_len = bl, // size of each buffer 128
// .dma_buf_len = 128, // size of each buffer 128
// .intr_alloc_flags = ESP_INTR_FLAG_LEVEL3,
.intr_alloc_flags = 0 , // default
.tx_desc_auto_clear = true,
.use_apll = use_apll
Expand Down Expand Up @@ -650,5 +656,4 @@ bool init_i2s(/*renderer_config_t *config*/)

i2s_stop(config->i2s_num);
return true;
}

}
Loading

0 comments on commit 78dd085

Please sign in to comment.