@@ -523,16 +523,26 @@ STATIC mp_obj_t mach_uart_wait_tx_done(mp_obj_t self_in, mp_obj_t timeout_ms) {
523
523
}
524
524
STATIC MP_DEFINE_CONST_FUN_OBJ_2 (mach_uart_wait_tx_done_obj , mach_uart_wait_tx_done );
525
525
526
- STATIC mp_obj_t mach_uart_sendbreak (mp_obj_t self_in , mp_obj_t bits ) {
527
- mach_uart_obj_t * self = self_in ;
526
+ STATIC mp_obj_t mach_uart_sendbreak (mp_uint_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
527
+
528
+ STATIC const mp_arg_t mach_uart_sendbreak_args [] = {
529
+ { MP_QSTR_bits , MP_ARG_INT , {.u_int = 13 } }
530
+ };
531
+
532
+ mp_arg_val_t args [MP_ARRAY_SIZE (mach_uart_sendbreak_args )];
533
+ mp_arg_parse_all (n_args - 1 , pos_args + 1 , kw_args , MP_ARRAY_SIZE (args ), & mach_uart_sendbreak_args [0 ], args );
534
+
535
+ mach_uart_obj_t * self = pos_args [0 ];
536
+ mp_int_t bits = args [0 ].u_int ;
537
+
528
538
MACH_UART_CHECK_INIT (self )
529
539
pin_obj_t * pin = (pin_obj_t * )((mp_obj_t * )self -> pins )[0 ];
530
540
531
541
uint32_t isrmask = MICROPY_BEGIN_ATOMIC_SECTION ();
532
542
533
543
// only if the bus is initialized
534
544
if (self -> config .baud_rate > 0 ) {
535
- uint32_t delay = (((mp_obj_get_int ( bits ) + 1 ) * 1000000 ) / self -> config .baud_rate ) & 0x7FFF ;
545
+ uint32_t delay = (((bits + 1 ) * 1000000 ) / self -> config .baud_rate ) & 0x7FFF ;
536
546
537
547
if (self -> n_pins == 1 ) {
538
548
// make it UART Tx
@@ -559,7 +569,7 @@ STATIC mp_obj_t mach_uart_sendbreak(mp_obj_t self_in, mp_obj_t bits) {
559
569
560
570
return mp_const_none ;
561
571
}
562
- STATIC MP_DEFINE_CONST_FUN_OBJ_2 (mach_uart_sendbreak_obj , mach_uart_sendbreak );
572
+ STATIC MP_DEFINE_CONST_FUN_OBJ_KW (mach_uart_sendbreak_obj , 1 , mach_uart_sendbreak );
563
573
564
574
STATIC const mp_map_elem_t mach_uart_locals_dict_table [] = {
565
575
// instance methods
0 commit comments