mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-09-28 21:17:33 +00:00
Add type size assertions
This commit is contained in:
@@ -28,6 +28,8 @@ namespace sta
|
|||||||
|
|
||||||
void HalSpiInterface::transfer16(uint16_t value)
|
void HalSpiInterface::transfer16(uint16_t value)
|
||||||
{
|
{
|
||||||
|
static_assert(sizeof(uint16_t) == 2);
|
||||||
|
|
||||||
HAL_SPI_Transmit(handle_, reinterpret_cast<uint8_t *>(&value), 2, HAL_MAX_DELAY);
|
HAL_SPI_Transmit(handle_, reinterpret_cast<uint8_t *>(&value), 2, HAL_MAX_DELAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,6 +44,8 @@ namespace sta
|
|||||||
|
|
||||||
void HalSpiInterface::fill32(uint32_t value, size_t count)
|
void HalSpiInterface::fill32(uint32_t value, size_t count)
|
||||||
{
|
{
|
||||||
|
static_assert(sizeof(uint32_t) == 4);
|
||||||
|
|
||||||
for (size_t i = 0; i < count; ++i)
|
for (size_t i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
HAL_SPI_Transmit(handle_, reinterpret_cast<uint8_t *>(&value), 4, HAL_MAX_DELAY);
|
HAL_SPI_Transmit(handle_, reinterpret_cast<uint8_t *>(&value), 4, HAL_MAX_DELAY);
|
||||||
|
Reference in New Issue
Block a user