@@ -96,7 +96,7 @@ static uint32_t timeout_ms = 0;
9696static uint8_t uarts_active = 0 ;
9797static uart_status_t uart_status [NUM_UARTS ];
9898static volatile int uart_err ;
99- // static uint8_t uart_never_reset_mask = 0;
99+ static uint8_t uart_never_reset_mask = 0 ;
100100
101101static int isValidBaudrate (uint32_t baudrate ) {
102102 switch (baudrate ) {
@@ -167,8 +167,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
167167 const mcu_pin_obj_t * rts , const mcu_pin_obj_t * cts ,
168168 const mcu_pin_obj_t * rs485_dir , bool rs485_invert ,
169169 uint32_t baudrate , uint8_t bits , busio_uart_parity_t parity , uint8_t stop ,
170- mp_float_t timeout , uint16_t receiver_buffer_size , byte * receiver_buffer ,
171- bool sigint_enabled ) {
170+ mp_float_t timeout , bool sigint_enabled ) {
172171 int err , temp ;
173172
174173 // Check for NULL Pointers && valid UART settings
@@ -236,21 +235,6 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
236235 self -> baudrate = baudrate ;
237236 self -> error = E_NO_ERROR ;
238237
239- // Initialize ringbuffer for receiving data
240- // FIXME: Either the use the ringbuf or get rid of it!
241- if (self -> rx_pin ) {
242- // if given a ringbuff, use that
243- if (receiver_buffer ) {
244- ringbuf_init (& self -> ringbuf , receiver_buffer , receiver_buffer_size );
245- }
246- // else create one and attach it
247- else {
248- if (!ringbuf_alloc (& self -> ringbuf , receiver_buffer_size )) {
249- m_malloc_fail (receiver_buffer_size );
250- }
251- }
252- }
253-
254238 // Indicate to this module that the UART is active
255239 uarts_active |= (1 << self -> uart_id );
256240
@@ -277,6 +261,7 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) {
277261 // First disable the ISR to avoid pre-emption
278262 NVIC_DisableIRQ (UART0_IRQn );
279263
264+ // Shutdown the UART Controller
280265 MXC_UART_Shutdown (self -> uart_regs );
281266 self -> error = E_UNINITIALIZED ;
282267
@@ -307,7 +292,7 @@ bool common_hal_busio_uart_deinited(busio_uart_obj_t *self) {
307292 };
308293}
309294
310- // Read characters. len is in characters NOT bytes!
295+ // Read characters. len is in characters.
311296size_t common_hal_busio_uart_read (busio_uart_obj_t * self ,
312297 uint8_t * data , size_t len , int * errcode ) {
313298 int err ;
@@ -474,7 +459,7 @@ void common_hal_busio_uart_never_reset(busio_uart_obj_t *self) {
474459 common_hal_never_reset_pin (self -> rx_pin );
475460 common_hal_never_reset_pin (self -> cts_pin );
476461 common_hal_never_reset_pin (self -> rts_pin );
477- // uart_never_reset_mask |= ( 1 << (self->uart_id) );
462+ uart_never_reset_mask |= (1 << (self -> uart_id ));
478463}
479464
480465#endif // CIRCUITPY_BUSIO_UART
0 commit comments