Fixup another level of compiler warnings, add _U() definition
This commit is contained in:
@ -172,7 +172,7 @@ uint uart_set_baudrate(uart_inst_t *uart, uint baudrate);
|
||||
*/
|
||||
static inline void uart_set_hw_flow(uart_inst_t *uart, bool cts, bool rts) {
|
||||
hw_write_masked(&uart_get_hw(uart)->cr,
|
||||
(!!cts << UART_UARTCR_CTSEN_LSB) | (!!rts << UART_UARTCR_RTSEN_LSB),
|
||||
(bool_to_bit(cts) << UART_UARTCR_CTSEN_LSB) | (bool_to_bit(rts) << UART_UARTCR_RTSEN_LSB),
|
||||
UART_UARTCR_RTSEN_BITS | UART_UARTCR_CTSEN_BITS);
|
||||
}
|
||||
|
||||
@ -191,10 +191,10 @@ static inline void uart_set_format(uart_inst_t *uart, uint data_bits, uint stop_
|
||||
invalid_params_if(UART, stop_bits != 1 && stop_bits != 2);
|
||||
invalid_params_if(UART, parity != UART_PARITY_NONE && parity != UART_PARITY_EVEN && parity != UART_PARITY_ODD);
|
||||
hw_write_masked(&uart_get_hw(uart)->lcr_h,
|
||||
((data_bits - 5) << UART_UARTLCR_H_WLEN_LSB) |
|
||||
((stop_bits - 1) << UART_UARTLCR_H_STP2_LSB) |
|
||||
((parity != UART_PARITY_NONE) << UART_UARTLCR_H_PEN_LSB) |
|
||||
((parity == UART_PARITY_EVEN) << UART_UARTLCR_H_EPS_LSB),
|
||||
((data_bits - 5u) << UART_UARTLCR_H_WLEN_LSB) |
|
||||
((stop_bits - 1u) << UART_UARTLCR_H_STP2_LSB) |
|
||||
(bool_to_bit(parity != UART_PARITY_NONE) << UART_UARTLCR_H_PEN_LSB) |
|
||||
(bool_to_bit(parity == UART_PARITY_EVEN) << UART_UARTLCR_H_EPS_LSB),
|
||||
UART_UARTLCR_H_WLEN_BITS |
|
||||
UART_UARTLCR_H_STP2_BITS |
|
||||
UART_UARTLCR_H_PEN_BITS |
|
||||
@ -212,8 +212,8 @@ static inline void uart_set_format(uart_inst_t *uart, uint data_bits, uint stop_
|
||||
* \param tx_needs_data If true an interrupt will be fired when the TX FIFO needs data.
|
||||
*/
|
||||
static inline void uart_set_irq_enables(uart_inst_t *uart, bool rx_has_data, bool tx_needs_data) {
|
||||
uart_get_hw(uart)->imsc = (!!tx_needs_data << UART_UARTIMSC_TXIM_LSB) |
|
||||
(!!rx_has_data << UART_UARTIMSC_RXIM_LSB);
|
||||
uart_get_hw(uart)->imsc = (bool_to_bit(tx_needs_data) << UART_UARTIMSC_TXIM_LSB) |
|
||||
(bool_to_bit(rx_has_data) << UART_UARTIMSC_RXIM_LSB);
|
||||
if (rx_has_data) {
|
||||
// Set minimum threshold
|
||||
hw_write_masked(&uart_get_hw(uart)->ifls, 0 << UART_UARTIFLS_RXIFLSEL_LSB,
|
||||
@ -244,7 +244,7 @@ static inline bool uart_is_enabled(uart_inst_t *uart) {
|
||||
*/
|
||||
static inline void uart_set_fifo_enabled(uart_inst_t *uart, bool enabled) {
|
||||
hw_write_masked(&uart_get_hw(uart)->lcr_h,
|
||||
(!!enabled << UART_UARTLCR_H_FEN_LSB),
|
||||
(bool_to_bit(enabled) << UART_UARTLCR_H_FEN_LSB),
|
||||
UART_UARTLCR_H_FEN_BITS);
|
||||
}
|
||||
|
||||
@ -314,7 +314,7 @@ static inline void uart_read_blocking(uart_inst_t *uart, uint8_t *dst, size_t le
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
while (!uart_is_readable(uart))
|
||||
tight_loop_contents();
|
||||
*dst++ = uart_get_hw(uart)->dr;
|
||||
*dst++ = (uint8_t) uart_get_hw(uart)->dr;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user