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