Addition of stubs for rs485/CTS/RTS handling on non-implemented chips
This commit is contained in:
parent
f0e5341b0f
commit
490a808bf6
@ -52,9 +52,12 @@ static void usart_async_rxc_callback(const struct usart_async_descriptor *const
|
||||
}
|
||||
|
||||
void common_hal_busio_uart_construct(busio_uart_obj_t *self,
|
||||
const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx, uint32_t baudrate,
|
||||
uint8_t bits, uart_parity_t parity, uint8_t stop, mp_float_t timeout,
|
||||
uint16_t receiver_buffer_size) {
|
||||
const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx,
|
||||
const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts,
|
||||
const mcu_pin_obj_t * rs485_dir, bool rs485_invert,
|
||||
uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop,
|
||||
mp_float_t timeout, uint16_t receiver_buffer_size) {
|
||||
|
||||
Sercom* sercom = NULL;
|
||||
uint8_t sercom_index = 255; // Unset index
|
||||
uint32_t rx_pinmux = 0;
|
||||
@ -62,6 +65,10 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
|
||||
uint32_t tx_pinmux = 0;
|
||||
uint8_t tx_pad = 255; // Unset pad
|
||||
|
||||
if ((rts != mp_const_none) || (cts != mp_const_none) || (rs485_dir != mp_const_none) || (rs485_invert == true)) {
|
||||
mp_raise_ValueError(translate("RTS/CTS/RS485 Not yet supported on this device"));
|
||||
}
|
||||
|
||||
if (bits > 8) {
|
||||
mp_raise_NotImplementedError(translate("bytes > 8 bits not supported"));
|
||||
}
|
||||
|
@ -53,11 +53,17 @@ STATIC busio_uart_dev_t busio_uart_dev[] = {
|
||||
};
|
||||
|
||||
void common_hal_busio_uart_construct(busio_uart_obj_t *self,
|
||||
const mcu_pin_obj_t *tx, const mcu_pin_obj_t *rx, uint32_t baudrate,
|
||||
uint8_t bits, uart_parity_t parity, uint8_t stop, mp_float_t timeout,
|
||||
uint16_t receiver_buffer_size) {
|
||||
const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx,
|
||||
const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts,
|
||||
const mcu_pin_obj_t * rs485_dir, bool rs485_invert,
|
||||
uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop,
|
||||
mp_float_t timeout, uint16_t receiver_buffer_size) {
|
||||
struct termios tio;
|
||||
|
||||
if ((rts != mp_const_none) || (cts != mp_const_none) || (rs485_dir != mp_const_none) || (rs485_invert == true)) {
|
||||
mp_raise_ValueError(translate("RTS/CTS/RS485 Not yet supported on this device"));
|
||||
}
|
||||
|
||||
if (bits != 8) {
|
||||
mp_raise_ValueError(translate("Could not initialize UART"));
|
||||
}
|
||||
|
@ -128,10 +128,17 @@ void uart_reset(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_busio_uart_construct (busio_uart_obj_t *self,
|
||||
const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx, uint32_t baudrate,
|
||||
uint8_t bits, uart_parity_t parity, uint8_t stop, mp_float_t timeout,
|
||||
uint16_t receiver_buffer_size) {
|
||||
void common_hal_busio_uart_construct(busio_uart_obj_t *self,
|
||||
const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx,
|
||||
const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts,
|
||||
const mcu_pin_obj_t * rs485_dir, bool rs485_invert,
|
||||
uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop,
|
||||
mp_float_t timeout, uint16_t receiver_buffer_size) {
|
||||
|
||||
if ((rts != mp_const_none) || (cts != mp_const_none) || (rs485_dir != mp_const_none) || (rs485_invert == true)) {
|
||||
mp_raise_ValueError(translate("RTS/CTS/RS485 Not yet supported on this device"));
|
||||
}
|
||||
|
||||
// Find a free UART peripheral.
|
||||
self->uarte = NULL;
|
||||
for (size_t i = 0 ; i < MP_ARRAY_SIZE(nrfx_uartes); i++) {
|
||||
|
@ -71,10 +71,12 @@ void uart_reset(void) {
|
||||
uart_clock_disable(ALL_UARTS);
|
||||
}
|
||||
|
||||
void common_hal_busio_uart_construct(busio_uart_obj_t* self,
|
||||
const mcu_pin_obj_t* tx, const mcu_pin_obj_t* rx, uint32_t baudrate,
|
||||
uint8_t bits, uart_parity_t parity, uint8_t stop, mp_float_t timeout,
|
||||
uint16_t receiver_buffer_size) {
|
||||
void common_hal_busio_uart_construct(busio_uart_obj_t *self,
|
||||
const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx,
|
||||
const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts,
|
||||
const mcu_pin_obj_t * rs485_dir, bool rs485_invert,
|
||||
uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop,
|
||||
mp_float_t timeout, uint16_t receiver_buffer_size) {
|
||||
|
||||
//match pins to UART objects
|
||||
USART_TypeDef * USARTx;
|
||||
@ -84,6 +86,10 @@ void common_hal_busio_uart_construct(busio_uart_obj_t* self,
|
||||
bool uart_taken = false;
|
||||
uint8_t uart_index = 0; //origin 0 corrected
|
||||
|
||||
if ((rts != mp_const_none) || (cts != mp_const_none) || (rs485_dir != mp_const_none) || (rs485_invert == true)) {
|
||||
mp_raise_ValueError(translate("RTS/CTS/RS485 Not yet supported on this device"));
|
||||
}
|
||||
|
||||
//Can have both pins, or either
|
||||
if ((tx != mp_const_none) && (rx != mp_const_none)) {
|
||||
//normal find loop if both pins exist
|
||||
|
Loading…
Reference in New Issue
Block a user