|
@ -16,6 +16,9 @@ |
|
|
#define LED_PIN 21 |
|
|
#define LED_PIN 21 |
|
|
#define BUF_LENGTH 1024 |
|
|
#define BUF_LENGTH 1024 |
|
|
|
|
|
|
|
|
|
|
|
#define WIFI_SSID "ssid" |
|
|
|
|
|
#define WIFI_PASSWORD "password" |
|
|
|
|
|
|
|
|
Keyboard keyboard; |
|
|
Keyboard keyboard; |
|
|
SDCard sdcard; |
|
|
SDCard sdcard; |
|
|
Sound sound; |
|
|
Sound sound; |
|
@ -44,13 +47,13 @@ void sd_read_task(void *pvParameter) { |
|
|
|
|
|
|
|
|
void i2s_write_task(void *pvParameter) { |
|
|
void i2s_write_task(void *pvParameter) { |
|
|
for ( ;; ) { |
|
|
for ( ;; ) { |
|
|
TickType_t delay = 10 / portTICK_PERIOD_MS; // max delay: 10ms instead of portMAX_DELAY
|
|
|
//TickType_t delay = 10 / portTICK_PERIOD_MS; // max delay: 10ms instead of portMAX_DELAY
|
|
|
uint16_t *start_ptr = ringbuf.getRead(); |
|
|
uint16_t *start_ptr = ringbuf.getRead(); |
|
|
size_t size_avail = ringbuf.getReadAvail(); |
|
|
size_t size_avail = ringbuf.getReadAvail(); |
|
|
int num_samples = 0; |
|
|
int num_samples = 0; |
|
|
for (int i=0; i<size_avail; i++) { |
|
|
for (int i=0; i<size_avail; i++) { |
|
|
unsigned int sample = ((unsigned short) start_ptr[i] << 16 & 0xffff0000) | ((unsigned short) start_ptr[i]); |
|
|
unsigned int sample = ((unsigned short) start_ptr[i] << 16 & 0xffff0000) | ((unsigned short) start_ptr[i]); |
|
|
int num_pushed_bytes = i2s_push_sample(sound.i2s_num, (char *)&sample, delay); |
|
|
int num_pushed_bytes = i2s_push_sample(sound.i2s_num, (char *)&sample, 0); |
|
|
num_samples += num_pushed_bytes/4; |
|
|
num_samples += num_pushed_bytes/4; |
|
|
} |
|
|
} |
|
|
ringbuf.setRead(num_samples); |
|
|
ringbuf.setRead(num_samples); |
|
|