mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-10 16:55:58 +00:00
Small fixes for smt32 support
This commit is contained in:
parent
2265131b3f
commit
0d02d57cbb
@ -9,7 +9,7 @@ namespace sta
|
||||
class UART : public Interface
|
||||
{
|
||||
public:
|
||||
UART(Mutex * mutex=nullptr);
|
||||
UART(UARTSettings & settings, Mutex * mutex=nullptr);
|
||||
|
||||
/**
|
||||
* @brief Get %UART interface settings.
|
||||
|
@ -1,11 +1,11 @@
|
||||
#ifndef STA_CONFIG_HPP
|
||||
#define STA_CONFIG_HPP
|
||||
|
||||
#include <sta/devices/raspi/mcu/common.hpp>
|
||||
#include <sta/devices/stm32/mcu/STM32F411xE.hpp>
|
||||
|
||||
#define STA_DEBUGGING_ENABLED
|
||||
#define STA_PRINTF_USE_STDLIB
|
||||
|
||||
#define STA_ASSERT_FORCE
|
||||
// #define STA_ASSERT_FORCE
|
||||
|
||||
#endif // STA_CONFIG_HPP
|
@ -21,11 +21,11 @@
|
||||
|
||||
#if defined(STA_STM32_SPI_ENABLED) || defined(DOXYGEN)
|
||||
|
||||
#include <sta/spi/device.hpp>
|
||||
#include <sta/spi/spi.hpp>
|
||||
#include <sta/bus/spi/device.hpp>
|
||||
#include <sta/bus/spi/spi.hpp>
|
||||
|
||||
#include <sta/stm32/clocks.hpp>
|
||||
#include <sta/stm32/gpio_pin.hpp>
|
||||
#include <sta/devices/stm32/clocks.hpp>
|
||||
#include <sta/devices/stm32/gpio_pin.hpp>
|
||||
|
||||
|
||||
/**
|
||||
@ -92,10 +92,7 @@ namespace sta
|
||||
* @param intf %SPI interface
|
||||
* @param csPin Device CS pin
|
||||
*/
|
||||
STM32SPIDevice(STM32SPI * intf, STM32GpioPin csPin);
|
||||
|
||||
private:
|
||||
STM32GpioPin csPin_; /**< Device CS pin */
|
||||
STM32SPIDevice(STM32SPI * intf, STM32GpioPin * csPin);
|
||||
};
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ namespace sta
|
||||
/**
|
||||
* @param handle STM32 HAL handle
|
||||
*/
|
||||
STM32UART(UART_HandleTypeDef * handle, Mutex * mutex);
|
||||
STM32UART(UART_HandleTypeDef * handle, UARTSettings & settings, Mutex * mutex);
|
||||
|
||||
void transfer(uint8_t value) override;
|
||||
void transfer16(uint16_t value) override;
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#if defined(STA_STM32_CAN_ENABLED) || defined(DOXYGEN)
|
||||
|
||||
#include <sta/can/controller.hpp>
|
||||
#include <sta/bus/can/controller.hpp>
|
||||
|
||||
|
||||
namespace sta
|
||||
|
@ -50,6 +50,8 @@ namespace sta
|
||||
|
||||
void setState(GpioPinState state) override;
|
||||
|
||||
GpioPinState getState() override;
|
||||
|
||||
/**
|
||||
* @brief Get GPIO port for pin.
|
||||
*
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace sta
|
||||
{
|
||||
UART::UART(Mutex * mutex)
|
||||
: Interface{mutex}
|
||||
UART::UART(UARTSettings & settings, Mutex * mutex)
|
||||
: Interface{mutex}, settings_{settings}
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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>
|
||||
|
||||
|
||||
|
@ -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>
|
||||
|
||||
|
||||
|
@ -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_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user