@@ -79,7 +79,7 @@ static void i2s_fill_buffer(i2s_t *self) {
79
79
80
80
size_t bytes_written = 0 ;
81
81
do {
82
- ESP_CALL_RAISE (i2s_write (self -> instance , signed_samples , sizeof (signed_samples ), & bytes_written , 0 ));
82
+ CHECK_ESP_RESULT (i2s_write (self -> instance , signed_samples , sizeof (signed_samples ), & bytes_written , 0 ));
83
83
} while (bytes_written != 0 );
84
84
return ;
85
85
}
@@ -107,9 +107,9 @@ static void i2s_fill_buffer(i2s_t *self) {
107
107
size_t bytecount = self -> sample_end - self -> sample_data ;
108
108
if (self -> samples_signed && self -> channel_count == 2 ) {
109
109
if (self -> bytes_per_sample == 2 ) {
110
- ESP_CALL_RAISE (i2s_write (self -> instance , self -> sample_data , bytecount , & bytes_written , 0 ));
110
+ CHECK_ESP_RESULT (i2s_write (self -> instance , self -> sample_data , bytecount , & bytes_written , 0 ));
111
111
} else {
112
- ESP_CALL_RAISE (i2s_write_expand (self -> instance , self -> sample_data , bytecount , 8 , 16 , & bytes_written , 0 ));
112
+ CHECK_ESP_RESULT (i2s_write_expand (self -> instance , self -> sample_data , bytecount , 8 , 16 , & bytes_written , 0 ));
113
113
}
114
114
} else {
115
115
const size_t bytes_per_output_frame = 4 ;
@@ -138,7 +138,7 @@ static void i2s_fill_buffer(i2s_t *self) {
138
138
}
139
139
}
140
140
size_t expanded_bytes_written = 0 ;
141
- ESP_CALL_RAISE (i2s_write (self -> instance , signed_samples , bytes_per_output_frame * framecount , & expanded_bytes_written , 0 ));
141
+ CHECK_ESP_RESULT (i2s_write (self -> instance , signed_samples , bytes_per_output_frame * framecount , & expanded_bytes_written , 0 ));
142
142
assert (expanded_bytes_written % 4 == 0 );
143
143
bytes_written = expanded_bytes_written / bytes_per_output_frame * bytes_per_input_frame ;
144
144
}
@@ -179,7 +179,7 @@ void port_i2s_allocate_init(i2s_t *self, bool left_justified) {
179
179
.dma_buf_len = 128 , // in _frames_, so 128 is 512 bytes per dma buf
180
180
.use_apll = false,
181
181
};
182
- ESP_CALL_RAISE (i2s_driver_install (self -> instance , & i2s_config , I2S_QUEUE_SIZE , & i2s_queues [self -> instance ]));
182
+ CHECK_ESP_RESULT (i2s_driver_install (self -> instance , & i2s_config , I2S_QUEUE_SIZE , & i2s_queues [self -> instance ]));
183
183
184
184
if (!xTaskCreate (i2s_event_task , "I2S_task" , 3 * configMINIMAL_STACK_SIZE , self , CONFIG_PTHREAD_TASK_PRIO_DEFAULT , & i2s_tasks [self -> instance ])) {
185
185
mp_raise_OSError_msg (translate ("xTaskCreate failed" ));
@@ -210,7 +210,7 @@ void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) {
210
210
211
211
audiosample_reset_buffer (self -> sample , false, 0 );
212
212
213
- ESP_CALL_RAISE (i2s_set_sample_rates (self -> instance , audiosample_sample_rate (sample )));
213
+ CHECK_ESP_RESULT (i2s_set_sample_rates (self -> instance , audiosample_sample_rate (sample )));
214
214
215
215
background_callback_add (& self -> callback , i2s_callback_fun , self );
216
216
}
@@ -233,13 +233,13 @@ void port_i2s_stop(i2s_t *self) {
233
233
void port_i2s_pause (i2s_t * self ) {
234
234
if (!self -> paused ) {
235
235
self -> paused = true;
236
- ESP_CALL_RAISE (i2s_stop (self -> instance ));
236
+ CHECK_ESP_RESULT (i2s_stop (self -> instance ));
237
237
}
238
238
}
239
239
240
240
void port_i2s_resume (i2s_t * self ) {
241
241
if (self -> paused ) {
242
242
self -> paused = false;
243
- ESP_CALL_RAISE (i2s_start (self -> instance ));
243
+ CHECK_ESP_RESULT (i2s_start (self -> instance ));
244
244
}
245
245
}
0 commit comments