PinOut: USARTn_TX / USARTn_RX
Mode: Asynchronous
template <class T>
T: 送受信するデータ型
UART( UART_HandleTypeDef *huart );
UART( UART_HandleTypeDef &huart );
ピンを設定します
// 例 UART<uint16_t> uart(&huart2); UART<uint16_t> uart(huart2);
HAL_StatusTypeDef transmit( const T &data, uint32_t timeout ) const noexcept;HAL_UART_Transmit() の結果を返します
// 例 uint16_t data = 0xAC; uart.transmit(data, 0x0F); uart.transmit(0x35, 0x0F); // 変数ではなくリテラルも使用可能
HAL_StatusTypeDef receive( T &data, uint32_t timeout ) const noexcept;HAL_UART_Receive() の結果を返します
// 例 uint16_t data; uart.receive(data, 0x0F);