mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-10 16:55:58 +00:00
Merge branch 'main' into delay_fixup
This commit is contained in:
commit
7aac2badc5
@ -38,6 +38,24 @@ namespace sta
|
|||||||
*/
|
*/
|
||||||
virtual void setState(GpioPinState state) = 0;
|
virtual void setState(GpioPinState state) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the GPIO pin to high.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void setHigh();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the GPIO pin to low.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void setLow();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the GPIO pin to the opposite of the current state.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void toggle();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get pin input state.
|
* @brief Get pin input state.
|
||||||
*
|
*
|
||||||
|
@ -166,6 +166,7 @@ namespace sta
|
|||||||
config->FilterScale = CAN_FILTERSCALE_32BIT;
|
config->FilterScale = CAN_FILTERSCALE_32BIT;
|
||||||
config->FilterActivation = CAN_FILTER_DISABLE;
|
config->FilterActivation = CAN_FILTER_DISABLE;
|
||||||
config->SlaveStartFilterBank = MAX_FILTER_COUNT;
|
config->SlaveStartFilterBank = MAX_FILTER_COUNT;
|
||||||
|
HAL_CAN_ConfigFilter(handle_, config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,16 +204,16 @@ namespace sta
|
|||||||
} // namespace sta
|
} // namespace sta
|
||||||
|
|
||||||
|
|
||||||
#ifdef STA_STM32_CAN_GLOBAL
|
#ifdef STA_STM32_CAN_HANDLE
|
||||||
|
|
||||||
#include <can.h>
|
#include <can.h>
|
||||||
|
|
||||||
namespace sta
|
namespace sta
|
||||||
{
|
{
|
||||||
STM32CanController CanBus(&STA_STM32_CAN_GLOBAL);
|
STM32CanController CanBus(&STA_STM32_CAN_HANDLE);
|
||||||
|
|
||||||
STA_WEAK
|
STA_WEAK
|
||||||
void CanBus_RxPendingCallback()
|
void CanBus_RxPendingCallback(uint32_t fifo)
|
||||||
{}
|
{}
|
||||||
} // namespace sta
|
} // namespace sta
|
||||||
|
|
||||||
@ -221,17 +222,17 @@ extern "C"
|
|||||||
{
|
{
|
||||||
void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)
|
void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)
|
||||||
{
|
{
|
||||||
if (hcan == &STA_STM32_CAN_GLOBAL)
|
if (hcan == &STA_STM32_CAN_HANDLE)
|
||||||
{
|
{
|
||||||
sta::CanBus_RxPendingCallback();
|
sta::CanBus_RxPendingCallback(CAN_RX_FIFO0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HAL_CAN_RxFifo1MsgPendingCallback(CAN_HandleTypeDef *hcan)
|
void HAL_CAN_RxFifo1MsgPendingCallback(CAN_HandleTypeDef *hcan)
|
||||||
{
|
{
|
||||||
if (hcan == &STA_STM32_CAN_GLOBAL)
|
if (hcan == &STA_STM32_CAN_HANDLE)
|
||||||
{
|
{
|
||||||
sta::CanBus_RxPendingCallback();
|
sta::CanBus_RxPendingCallback(CAN_RX_FIFO1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
20
src/gpio_pin.cpp
Normal file
20
src/gpio_pin.cpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#include <sta/gpio_pin.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
namespace sta
|
||||||
|
{
|
||||||
|
void GpioPin::setHigh()
|
||||||
|
{
|
||||||
|
setState(GpioPinState::GPIO_HIGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpioPin::setLow()
|
||||||
|
{
|
||||||
|
setState(GpioPinState::GPIO_LOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpioPin::toggle()
|
||||||
|
{
|
||||||
|
setState(getState() == GpioPinState::GPIO_HIGH ? GpioPinState::GPIO_LOW : GpioPinState::GPIO_HIGH);
|
||||||
|
}
|
||||||
|
} // namespace sta
|
Loading…
x
Reference in New Issue
Block a user