@@ -58,9 +58,9 @@ MP_REGISTER_ROOT_POINTER(struct _esp32_pcnt_obj_t *esp32_pcnt_obj_head);
58
58
59
59
// Once off installation of the PCNT ISR service (using the default service).
60
60
// Persists across soft reset.
61
- STATIC bool pcnt_isr_service_installed = false;
61
+ static bool pcnt_isr_service_installed = false;
62
62
63
- STATIC mp_obj_t esp32_pcnt_deinit (mp_obj_t self_in );
63
+ static mp_obj_t esp32_pcnt_deinit (mp_obj_t self_in );
64
64
65
65
void esp32_pcnt_deinit_all (void ) {
66
66
esp32_pcnt_obj_t * * pcnt = & MP_STATE_PORT (esp32_pcnt_obj_head );
@@ -70,7 +70,7 @@ void esp32_pcnt_deinit_all(void) {
70
70
}
71
71
}
72
72
73
- STATIC void esp32_pcnt_init_helper (esp32_pcnt_obj_t * self , size_t n_pos_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
73
+ static void esp32_pcnt_init_helper (esp32_pcnt_obj_t * self , size_t n_pos_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
74
74
enum {
75
75
ARG_channel ,
76
76
ARG_pin ,
@@ -225,7 +225,7 @@ STATIC void esp32_pcnt_init_helper(esp32_pcnt_obj_t *self, size_t n_pos_args, co
225
225
}
226
226
227
227
// Disable any events, and remove the ISR handler for this unit.
228
- STATIC void esp32_pcnt_disable_events_for_unit (esp32_pcnt_obj_t * self ) {
228
+ static void esp32_pcnt_disable_events_for_unit (esp32_pcnt_obj_t * self ) {
229
229
if (!self -> irq ) {
230
230
return ;
231
231
}
@@ -241,7 +241,7 @@ STATIC void esp32_pcnt_disable_events_for_unit(esp32_pcnt_obj_t *self) {
241
241
self -> irq -> trigger = 0 ;
242
242
}
243
243
244
- STATIC mp_obj_t esp32_pcnt_make_new (const mp_obj_type_t * type , size_t n_pos_args , size_t n_kw_args , const mp_obj_t * args ) {
244
+ static mp_obj_t esp32_pcnt_make_new (const mp_obj_type_t * type , size_t n_pos_args , size_t n_kw_args , const mp_obj_t * args ) {
245
245
if (n_pos_args < 1 ) {
246
246
mp_raise_TypeError (MP_ERROR_TEXT ("id" ));
247
247
}
@@ -289,19 +289,19 @@ STATIC mp_obj_t esp32_pcnt_make_new(const mp_obj_type_t *type, size_t n_pos_args
289
289
return MP_OBJ_FROM_PTR (self );
290
290
}
291
291
292
- STATIC void esp32_pcnt_print (const mp_print_t * print , mp_obj_t self_in , mp_print_kind_t kind ) {
292
+ static void esp32_pcnt_print (const mp_print_t * print , mp_obj_t self_in , mp_print_kind_t kind ) {
293
293
esp32_pcnt_obj_t * self = MP_OBJ_TO_PTR (self_in );
294
294
mp_printf (print , "PCNT(%u)" , self -> unit );
295
295
}
296
296
297
- STATIC mp_obj_t esp32_pcnt_init (size_t n_pos_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
297
+ static mp_obj_t esp32_pcnt_init (size_t n_pos_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
298
298
esp32_pcnt_obj_t * self = MP_OBJ_TO_PTR (pos_args [0 ]);
299
299
esp32_pcnt_init_helper (self , n_pos_args - 1 , pos_args + 1 , kw_args );
300
300
return mp_const_none ;
301
301
}
302
- STATIC MP_DEFINE_CONST_FUN_OBJ_KW (esp32_pcnt_init_obj , 1 , esp32_pcnt_init );
302
+ static MP_DEFINE_CONST_FUN_OBJ_KW (esp32_pcnt_init_obj , 1 , esp32_pcnt_init ) ;
303
303
304
- STATIC mp_obj_t esp32_pcnt_deinit (mp_obj_t self_in ) {
304
+ static mp_obj_t esp32_pcnt_deinit (mp_obj_t self_in ) {
305
305
esp32_pcnt_obj_t * self = MP_OBJ_TO_PTR (self_in );
306
306
307
307
// Remove IRQ and events.
@@ -333,9 +333,9 @@ STATIC mp_obj_t esp32_pcnt_deinit(mp_obj_t self_in) {
333
333
334
334
return mp_const_none ;
335
335
}
336
- STATIC MP_DEFINE_CONST_FUN_OBJ_1 (esp32_pcnt_deinit_obj , esp32_pcnt_deinit );
336
+ static MP_DEFINE_CONST_FUN_OBJ_1 (esp32_pcnt_deinit_obj , esp32_pcnt_deinit ) ;
337
337
338
- STATIC mp_obj_t esp32_pcnt_value (size_t n_args , const mp_obj_t * pos_args ) {
338
+ static mp_obj_t esp32_pcnt_value (size_t n_args , const mp_obj_t * pos_args ) {
339
339
esp32_pcnt_obj_t * self = MP_OBJ_TO_PTR (pos_args [0 ]);
340
340
341
341
// Optionally use pcnt.value(True) to clear the counter but only support a
@@ -369,9 +369,9 @@ STATIC mp_obj_t esp32_pcnt_value(size_t n_args, const mp_obj_t *pos_args) {
369
369
370
370
return MP_OBJ_NEW_SMALL_INT (value );
371
371
}
372
- STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (esp32_pcnt_value_obj , 1 , 2 , esp32_pcnt_value );
372
+ static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (esp32_pcnt_value_obj , 1 , 2 , esp32_pcnt_value ) ;
373
373
374
- STATIC mp_uint_t esp32_pcnt_irq_trigger (mp_obj_t self_in , mp_uint_t new_trigger ) {
374
+ static mp_uint_t esp32_pcnt_irq_trigger (mp_obj_t self_in , mp_uint_t new_trigger ) {
375
375
esp32_pcnt_obj_t * self = MP_OBJ_TO_PTR (self_in );
376
376
self -> irq -> trigger = new_trigger ;
377
377
for (pcnt_evt_type_t evt_type = PCNT_EVT_THRES_1 ; evt_type <= PCNT_EVT_ZERO ; evt_type <<= 1 ) {
@@ -384,7 +384,7 @@ STATIC mp_uint_t esp32_pcnt_irq_trigger(mp_obj_t self_in, mp_uint_t new_trigger)
384
384
return 0 ;
385
385
}
386
386
387
- STATIC mp_uint_t esp32_pcnt_irq_info (mp_obj_t self_in , mp_uint_t info_type ) {
387
+ static mp_uint_t esp32_pcnt_irq_info (mp_obj_t self_in , mp_uint_t info_type ) {
388
388
esp32_pcnt_obj_t * self = MP_OBJ_TO_PTR (self_in );
389
389
if (info_type == MP_IRQ_INFO_FLAGS ) {
390
390
// Atomically get-and-clear the flags.
@@ -399,12 +399,12 @@ STATIC mp_uint_t esp32_pcnt_irq_info(mp_obj_t self_in, mp_uint_t info_type) {
399
399
return 0 ;
400
400
}
401
401
402
- STATIC const mp_irq_methods_t esp32_pcnt_irq_methods = {
402
+ static const mp_irq_methods_t esp32_pcnt_irq_methods = {
403
403
.trigger = esp32_pcnt_irq_trigger ,
404
404
.info = esp32_pcnt_irq_info ,
405
405
};
406
406
407
- STATIC IRAM_ATTR void esp32_pcnt_intr_handler (void * arg ) {
407
+ static IRAM_ATTR void esp32_pcnt_intr_handler (void * arg ) {
408
408
esp32_pcnt_obj_t * self = (esp32_pcnt_obj_t * )arg ;
409
409
pcnt_unit_t unit = self -> unit ;
410
410
uint32_t status ;
@@ -415,7 +415,7 @@ STATIC IRAM_ATTR void esp32_pcnt_intr_handler(void *arg) {
415
415
mp_irq_handler (& self -> irq -> base );
416
416
}
417
417
418
- STATIC mp_obj_t esp32_pcnt_irq (size_t n_pos_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
418
+ static mp_obj_t esp32_pcnt_irq (size_t n_pos_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
419
419
enum { ARG_handler , ARG_trigger };
420
420
static const mp_arg_t allowed_args [] = {
421
421
{ MP_QSTR_handler , MP_ARG_OBJ , {.u_obj = mp_const_none } },
@@ -460,23 +460,23 @@ STATIC mp_obj_t esp32_pcnt_irq(size_t n_pos_args, const mp_obj_t *pos_args, mp_m
460
460
461
461
return MP_OBJ_FROM_PTR (self -> irq );
462
462
}
463
- STATIC MP_DEFINE_CONST_FUN_OBJ_KW (esp32_pcnt_irq_obj , 1 , esp32_pcnt_irq );
463
+ static MP_DEFINE_CONST_FUN_OBJ_KW (esp32_pcnt_irq_obj , 1 , esp32_pcnt_irq ) ;
464
464
465
- STATIC mp_obj_t esp32_pcnt_start (mp_obj_t self_in ) {
465
+ static mp_obj_t esp32_pcnt_start (mp_obj_t self_in ) {
466
466
esp32_pcnt_obj_t * self = MP_OBJ_TO_PTR (self_in );
467
467
check_esp_err (pcnt_counter_resume (self -> unit ));
468
468
return mp_const_none ;
469
469
}
470
- STATIC MP_DEFINE_CONST_FUN_OBJ_1 (esp32_pcnt_start_obj , esp32_pcnt_start );
470
+ static MP_DEFINE_CONST_FUN_OBJ_1 (esp32_pcnt_start_obj , esp32_pcnt_start ) ;
471
471
472
- STATIC mp_obj_t esp32_pcnt_stop (mp_obj_t self_in ) {
472
+ static mp_obj_t esp32_pcnt_stop (mp_obj_t self_in ) {
473
473
esp32_pcnt_obj_t * self = MP_OBJ_TO_PTR (self_in );
474
474
check_esp_err (pcnt_counter_pause (self -> unit ));
475
475
return mp_const_none ;
476
476
}
477
- STATIC MP_DEFINE_CONST_FUN_OBJ_1 (esp32_pcnt_stop_obj , esp32_pcnt_stop );
477
+ static MP_DEFINE_CONST_FUN_OBJ_1 (esp32_pcnt_stop_obj , esp32_pcnt_stop ) ;
478
478
479
- STATIC const mp_rom_map_elem_t esp32_pcnt_locals_dict_table [] = {
479
+ static const mp_rom_map_elem_t esp32_pcnt_locals_dict_table [] = {
480
480
// Methods
481
481
{ MP_ROM_QSTR (MP_QSTR_init ), MP_ROM_PTR (& esp32_pcnt_init_obj ) },
482
482
{ MP_ROM_QSTR (MP_QSTR_value ), MP_ROM_PTR (& esp32_pcnt_value_obj ) },
@@ -499,7 +499,7 @@ STATIC const mp_rom_map_elem_t esp32_pcnt_locals_dict_table[] = {
499
499
{ MP_ROM_QSTR (MP_QSTR_IRQ_MIN ), MP_ROM_INT (PCNT_EVT_L_LIM ) },
500
500
{ MP_ROM_QSTR (MP_QSTR_IRQ_MAX ), MP_ROM_INT (PCNT_EVT_H_LIM ) },
501
501
};
502
- STATIC MP_DEFINE_CONST_DICT (esp32_pcnt_locals_dict , esp32_pcnt_locals_dict_table );
502
+ static MP_DEFINE_CONST_DICT (esp32_pcnt_locals_dict , esp32_pcnt_locals_dict_table ) ;
503
503
504
504
MP_DEFINE_CONST_OBJ_TYPE (
505
505
esp32_pcnt_type ,
0 commit comments