Small fixes for smt32 support

This commit is contained in:
dvdb97
2023-07-16 12:02:45 +02:00
parent 2265131b3f
commit 0d02d57cbb
12 changed files with 29 additions and 27 deletions

View File

@@ -2,8 +2,8 @@
namespace sta
{
UART::UART(Mutex * mutex)
: Interface{mutex}
UART::UART(UARTSettings & settings, Mutex * mutex)
: Interface{mutex}, settings_{settings}
{
}

View File

@@ -1,7 +1,7 @@
#include <sta/devices/stm32/bus/spi.hpp>
#ifdef STA_STM32_SPI_ENABLED
#include <sta/assert.hpp>
#include <sta/debug/assert.hpp>
#include <sta/endian.hpp>
#include <sta/lang.hpp>
@@ -66,7 +66,7 @@ namespace sta
}
STM32SPI::STM32SPI(SPI_HandleTypeDef * handle, uint32_t pclkFreq, Mutex * mutex = nullptr)
STM32SPI::STM32SPI(SPI_HandleTypeDef * handle, uint32_t pclkFreq, Mutex * mutex)
: SPI(getSPISettings(handle, pclkFreq), mutex), handle_{handle}
{
STA_ASSERT(handle != nullptr);
@@ -157,10 +157,8 @@ namespace sta
}
}
STM32SPIDevice::STM32SPIDevice(STM32SPI * intf, STM32GpioPin csPin)
: SPIDevice(intf, &csPin_), csPin_{csPin}
STM32SPIDevice::STM32SPIDevice(STM32SPI * intf, STM32GpioPin * csPin)
: SPIDevice(intf, csPin)
{}
} // namespace sta

View File

@@ -1,13 +1,13 @@
#include <sta/devices/stm32/bus/uart.hpp>
#ifdef STA_STM32_UART_ENABLED
#include <sta/assert.hpp>
#include <sta/debug/assert.hpp>
#include <cstring>
namespace sta
{
STM32UART::STM32UART(UART_HandleTypeDef * handle, Mutex * mutex)
: UART{mutex}, handle_{handle}
STM32UART::STM32UART(UART_HandleTypeDef * handle, UARTSettings & settings, Mutex * mutex)
: UART{settings, mutex}, handle_{handle}
{
STA_ASSERT(handle != nullptr);
}

View File

@@ -1,7 +1,7 @@
#include <sta/devices/stm32/can.hpp>
#ifdef STA_STM32_CAN_ENABLED
#include <sta/assert.hpp>
#include <sta/debug/assert.hpp>
#include <sta/lang.hpp>

View File

@@ -4,7 +4,7 @@
#include <sta/devices/stm32/hal.hpp>
#include <sta/devices/stm32/clocks.hpp>
#include <sta/assert.hpp>
#include <sta/debug/assert.hpp>
#include <sta/lang.hpp>

View File

@@ -1,7 +1,7 @@
#include <sta/devices/stm32/gpio_pin.hpp>
#ifdef STA_STM32_GPIO_ENABLED
#include <sta/assert.hpp>
#include <sta/debug/assert.hpp>
#include <sta/lang.hpp>
@@ -18,6 +18,11 @@ namespace sta
HAL_GPIO_WritePin(port_, pin_, (state == GpioPinState::GPIO_LOW) ? GPIO_PIN_RESET : GPIO_PIN_SET);
}
GpioPinState STM32GpioPin::getState()
{
return HAL_GPIO_ReadPin(port_, pin_) == GPIO_PIN_RESET ? GpioPinState::GPIO_LOW : GpioPinState::GPIO_HIGH;
}
GPIO_TypeDef * STM32GpioPin::getPort() const
{
return port_;