Temporary workaround for FW1.27
All checks were successful
continuous-integration/drone/push Build is passing
gitea/skullc-peripherals/pipeline/head This commit looks good

This commit is contained in:
Erki 2022-09-06 23:38:33 +03:00
parent 6e22b02e92
commit d10675e3ec

View File

@ -262,10 +262,30 @@ struct SpiRegisters
#ifdef HAL_UART_MODULE_ENABLED #ifdef HAL_UART_MODULE_ENABLED
namespace _Details
{
/**
* @hack: Temporary workarounds to make the HAL compile for FW1.27. ST made it so that only UART libraries
* are const-correct. The others remain unconst. So these wrappers will exist until we're no longer partially
* const-correct.
*/
inline HAL_StatusTypeDef uartTransmit(UART_HandleTypeDef *huart, std::uint8_t *data, const std::uint16_t size, const std::uint32_t timeout)
{
return HAL_UART_Transmit(huart, data, size, timeout);
}
inline HAL_StatusTypeDef uartTransmitDma(UART_HandleTypeDef *huart, std::uint8_t *data, const std::uint16_t size)
{
return HAL_UART_Transmit_DMA(huart, data, size);
}
}
using UartInterface = using UartInterface =
SerialInterface<UART_HandleTypeDef, HAL_UART_Transmit, HAL_UART_Receive>; SerialInterface<UART_HandleTypeDef, _Details::uartTransmit, HAL_UART_Receive>;
using UartInterfaceDMA = using UartInterfaceDMA =
SerialInterfaceAsync<UART_HandleTypeDef, HAL_UART_Transmit_DMA, SerialInterfaceAsync<UART_HandleTypeDef, _Details::uartTransmitDma,
HAL_UART_Receive_DMA>; HAL_UART_Receive_DMA>;
#endif// HAL_UART_MODULE_ENABLED #endif// HAL_UART_MODULE_ENABLED