mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-12 01:25:59 +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
|
class UART : public Interface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
UART(Mutex * mutex=nullptr);
|
UART(UARTSettings & settings, Mutex * mutex=nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get %UART interface settings.
|
* @brief Get %UART interface settings.
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#ifndef STA_CONFIG_HPP
|
#ifndef STA_CONFIG_HPP
|
||||||
#define 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_DEBUGGING_ENABLED
|
||||||
#define STA_PRINTF_USE_STDLIB
|
#define STA_PRINTF_USE_STDLIB
|
||||||
|
|
||||||
#define STA_ASSERT_FORCE
|
// #define STA_ASSERT_FORCE
|
||||||
|
|
||||||
#endif // STA_CONFIG_HPP
|
#endif // STA_CONFIG_HPP
|
@ -21,11 +21,11 @@
|
|||||||
|
|
||||||
#if defined(STA_STM32_SPI_ENABLED) || defined(DOXYGEN)
|
#if defined(STA_STM32_SPI_ENABLED) || defined(DOXYGEN)
|
||||||
|
|
||||||
#include <sta/spi/device.hpp>
|
#include <sta/bus/spi/device.hpp>
|
||||||
#include <sta/spi/spi.hpp>
|
#include <sta/bus/spi/spi.hpp>
|
||||||
|
|
||||||
#include <sta/stm32/clocks.hpp>
|
#include <sta/devices/stm32/clocks.hpp>
|
||||||
#include <sta/stm32/gpio_pin.hpp>
|
#include <sta/devices/stm32/gpio_pin.hpp>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -92,10 +92,7 @@ namespace sta
|
|||||||
* @param intf %SPI interface
|
* @param intf %SPI interface
|
||||||
* @param csPin Device CS pin
|
* @param csPin Device CS pin
|
||||||
*/
|
*/
|
||||||
STM32SPIDevice(STM32SPI * intf, STM32GpioPin csPin);
|
STM32SPIDevice(STM32SPI * intf, STM32GpioPin * csPin);
|
||||||
|
|
||||||
private:
|
|
||||||
STM32GpioPin csPin_; /**< Device CS pin */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ namespace sta
|
|||||||
/**
|
/**
|
||||||
* @param handle STM32 HAL handle
|
* @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 transfer(uint8_t value) override;
|
||||||
void transfer16(uint16_t value) override;
|
void transfer16(uint16_t value) override;
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#if defined(STA_STM32_CAN_ENABLED) || defined(DOXYGEN)
|
#if defined(STA_STM32_CAN_ENABLED) || defined(DOXYGEN)
|
||||||
|
|
||||||
#include <sta/can/controller.hpp>
|
#include <sta/bus/can/controller.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace sta
|
namespace sta
|
||||||
|
@ -50,6 +50,8 @@ namespace sta
|
|||||||
|
|
||||||
void setState(GpioPinState state) override;
|
void setState(GpioPinState state) override;
|
||||||
|
|
||||||
|
GpioPinState getState() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get GPIO port for pin.
|
* @brief Get GPIO port for pin.
|
||||||
*
|
*
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace sta
|
namespace sta
|
||||||
{
|
{
|
||||||
UART::UART(Mutex * mutex)
|
UART::UART(UARTSettings & settings, Mutex * mutex)
|
||||||
: Interface{mutex}
|
: Interface{mutex}, settings_{settings}
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <sta/devices/stm32/bus/spi.hpp>
|
#include <sta/devices/stm32/bus/spi.hpp>
|
||||||
#ifdef STA_STM32_SPI_ENABLED
|
#ifdef STA_STM32_SPI_ENABLED
|
||||||
|
|
||||||
#include <sta/assert.hpp>
|
#include <sta/debug/assert.hpp>
|
||||||
#include <sta/endian.hpp>
|
#include <sta/endian.hpp>
|
||||||
#include <sta/lang.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}
|
: SPI(getSPISettings(handle, pclkFreq), mutex), handle_{handle}
|
||||||
{
|
{
|
||||||
STA_ASSERT(handle != nullptr);
|
STA_ASSERT(handle != nullptr);
|
||||||
@ -157,10 +157,8 @@ namespace sta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STM32SPIDevice::STM32SPIDevice(STM32SPI * intf, STM32GpioPin * csPin)
|
||||||
|
: SPIDevice(intf, csPin)
|
||||||
STM32SPIDevice::STM32SPIDevice(STM32SPI * intf, STM32GpioPin csPin)
|
|
||||||
: SPIDevice(intf, &csPin_), csPin_{csPin}
|
|
||||||
{}
|
{}
|
||||||
} // namespace sta
|
} // namespace sta
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#include <sta/devices/stm32/bus/uart.hpp>
|
#include <sta/devices/stm32/bus/uart.hpp>
|
||||||
#ifdef STA_STM32_UART_ENABLED
|
#ifdef STA_STM32_UART_ENABLED
|
||||||
|
|
||||||
#include <sta/assert.hpp>
|
#include <sta/debug/assert.hpp>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
namespace sta
|
namespace sta
|
||||||
{
|
{
|
||||||
STM32UART::STM32UART(UART_HandleTypeDef * handle, Mutex * mutex)
|
STM32UART::STM32UART(UART_HandleTypeDef * handle, UARTSettings & settings, Mutex * mutex)
|
||||||
: UART{mutex}, handle_{handle}
|
: UART{settings, mutex}, handle_{handle}
|
||||||
{
|
{
|
||||||
STA_ASSERT(handle != nullptr);
|
STA_ASSERT(handle != nullptr);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <sta/devices/stm32/can.hpp>
|
#include <sta/devices/stm32/can.hpp>
|
||||||
#ifdef STA_STM32_CAN_ENABLED
|
#ifdef STA_STM32_CAN_ENABLED
|
||||||
|
|
||||||
#include <sta/assert.hpp>
|
#include <sta/debug/assert.hpp>
|
||||||
#include <sta/lang.hpp>
|
#include <sta/lang.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <sta/devices/stm32/hal.hpp>
|
#include <sta/devices/stm32/hal.hpp>
|
||||||
#include <sta/devices/stm32/clocks.hpp>
|
#include <sta/devices/stm32/clocks.hpp>
|
||||||
|
|
||||||
#include <sta/assert.hpp>
|
#include <sta/debug/assert.hpp>
|
||||||
#include <sta/lang.hpp>
|
#include <sta/lang.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <sta/devices/stm32/gpio_pin.hpp>
|
#include <sta/devices/stm32/gpio_pin.hpp>
|
||||||
#ifdef STA_STM32_GPIO_ENABLED
|
#ifdef STA_STM32_GPIO_ENABLED
|
||||||
|
|
||||||
#include <sta/assert.hpp>
|
#include <sta/debug/assert.hpp>
|
||||||
#include <sta/lang.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);
|
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
|
GPIO_TypeDef * STM32GpioPin::getPort() const
|
||||||
{
|
{
|
||||||
return port_;
|
return port_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user