Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit21a17d3

Browse files
committed
updates bitstream to use new IDF API
1 parenteef5eb8 commit21a17d3

File tree

2 files changed

+14
-25
lines changed

2 files changed

+14
-25
lines changed

‎ext_mod/lcd_bus/esp32_src/i2c_bus.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,11 @@
1818
#include<string.h>
1919

2020

21-
2221
mp_lcd_err_ti2c_del(mp_obj_tobj);
2322
mp_lcd_err_ti2c_init(mp_obj_tobj,uint16_twidth,uint16_theight,uint8_tbpp,uint32_tbuffer_size,boolrgb565_byte_swap,uint8_tcmd_bits,uint8_tparam_bits);
2423
mp_lcd_err_ti2c_get_lane_count(mp_obj_tobj,uint8_t*lane_count);
2524

2625

27-
staticuint8_ti2c_bus_count=0;
28-
staticmp_lcd_i2c_bus_obj_t**i2c_bus_objs;
29-
30-
3126
typedefstruct_i2c_obj_t {
3227
mp_obj_base_tbase;
3328
i2c_port_tport :8;

‎micropy_updates/esp32/machine_bitstream.c‎

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -180,23 +180,19 @@ esp_err_t rmt_new_led_strip_encoder(const led_strip_encoder_config_t *config, rm
180180
{
181181
esp_err_tret=ESP_OK;
182182
rmt_led_strip_encoder_t*led_encoder=NULL;
183-
if (!(config&&ret_encoder)) {
184-
returnESP_ERR_INVALID_ARG;
185-
}
183+
if (!(config&&ret_encoder))returnESP_ERR_INVALID_ARG;
186184

187185
led_encoder=rmt_alloc_encoder_mem(sizeof(rmt_led_strip_encoder_t));
188-
if (!led_encoder) {
189-
returnESP_ERR_NO_MEM;
190-
}
186+
if (!led_encoder)returnESP_ERR_NO_MEM;
187+
191188
led_encoder->base.encode=rmt_encode_led_strip;
192189
led_encoder->base.del=rmt_del_led_strip_encoder;
193190
led_encoder->base.reset=rmt_led_strip_encoder_reset;
194191

195192
uint32_tbit0_duration0=0;
196193
uint32_tbit0_duration1=0;
197-
198194
uint32_tbit1_duration0=0;
199-
uint32_tbit2_duration1=0;
195+
uint32_tbit1_duration1=0;
200196

201197
if (config->bit0_duration0<0)bit0_duration0= (uint32_t)(-config->bit0_duration0);
202198
elsebit0_duration0= (uint32_t)config->bit0_duration0;
@@ -223,19 +219,16 @@ esp_err_t rmt_new_led_strip_encoder(const led_strip_encoder_config_t *config, rm
223219
.level1=config->bit1_duration1<0 ?0 :1,
224220
.duration1=bit1_duration1*config->resolution /1000000000,
225221
},
226-
.flags.msb_first=1// WS2812 transfer bit order: G7...G0R7...R0B7...B0
222+
.flags.msb_first=1
227223
};
228224

229225

230-
ret=rmt_new_bytes_encoder(&bytes_encoder_config,&led_encoder->bytes_encoder)
231-
if (err!=ESP_OK) {
232-
gotoerr;
233-
}
226+
ret=rmt_new_bytes_encoder(&bytes_encoder_config,&led_encoder->bytes_encoder);
227+
if (ret!=ESP_OK) gotoerr;
228+
234229
rmt_copy_encoder_config_tcopy_encoder_config= {};
235-
ret=rmt_new_copy_encoder(&copy_encoder_config,&led_encoder->copy_encoder)
236-
if (err!=ESP_OK) {
237-
gotoerr;
238-
}
230+
ret=rmt_new_copy_encoder(&copy_encoder_config,&led_encoder->copy_encoder);
231+
if (ret!=ESP_OK) gotoerr;
239232

240233
uint32_treset_duration;
241234

@@ -262,10 +255,11 @@ esp_err_t rmt_new_led_strip_encoder(const led_strip_encoder_config_t *config, rm
262255
free(led_encoder);
263256
}
264257
returnret;
258+
}
265259

266260

267261
// Use the reserved RMT channel to stream high/low data on the specified pin.
268-
staticvoidmachine_bitstream_high_low_rmt(mp_hal_pin_obj_tpin,uint32_t*timing_ns,constuint8_t*buf,size_tlen,uint8_tchannel_id) {
262+
voidmachine_bitstream_high_low_rmt(mp_hal_pin_obj_tpin,uint32_t*timing_ns,constuint8_t*buf,size_tlen,uint8_tchannel_id) {
269263

270264
((void)channel_id);
271265

@@ -295,11 +289,11 @@ static void machine_bitstream_high_low_rmt(mp_hal_pin_obj_t pin, uint32_t *timin
295289
.loop_count=0,// no transfer loop
296290
};
297291

298-
check_esp_err(rmt_transmit(channel_handle,encoder_handle,buf,len,&tx_config)));
292+
check_esp_err(rmt_transmit(channel_handle,encoder_handle,buf,len,&tx_config));
299293

300294
// Wait 50% longer than we expect (if every bit takes the maximum time).
301295
uint32_ttimeout_ms= (3*len /2)* (1+ (8*MAX(timing_ns[0]+timing_ns[1],timing_ns[2]+timing_ns[3])) /1000);
302-
check_esp_err(rmt_tx_wait_all_done(config.channel,pdMS_TO_TICKS(timeout_ms)));
296+
check_esp_err(rmt_tx_wait_all_done(channel_handle,pdMS_TO_TICKS(timeout_ms)));
303297

304298
// Uninstall the driver.
305299
check_esp_err(rmt_del_led_strip_encoder(encoder_handle));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp