Initial commit
This commit is contained in:
32
src/xf/port/idf-stm32cube/README.md
Normal file
32
src/xf/port/idf-stm32cube/README.md
Normal file
@ -0,0 +1,32 @@
|
||||
# XF Port - IDF Stm32Cube
|
||||
|
||||
This port folder contains specific classes for the _IDF Stm32Cube_
|
||||
XF port.
|
||||
|
||||
# Classes used by the _IDF Stm32Cube_ Port
|
||||
|
||||
| Class name | File location | Define to set |
|
||||
|--|--|--|
|
||||
| XF | xf/port/default/xf-default.cpp | USE_XF_DEFAULT_IMPLEMENTATION |
|
||||
| XFDispatcherDefault | xf/port/default/dispatcher-default.cpp | USE_XF_DISPATCHER_DEFAULT_IMPLEMENTATION |
|
||||
| XFTimeoutManagerDefault | xf/port/default/timeoutmanager-default.cpp | USE_XF_TIMEOUTMANAGER_DEFAULT_IMPLEMENTATION |
|
||||
| XFResourceFactoryDefault | xf/port/default/resourcefactory-default.cpp | USE_XF_RESOURCE_FACTORY_DEFAULT_IMPLEMENTATION |
|
||||
| XFMutexDefault | xf/port/default-idf/mutex-default.cpp | USE_XF_MUTEX_DEFAULT_IDF_IMPLEMENTATION |
|
||||
| XFEventQueueDefault | xf/port/default-idf/eventqueue-default.cpp | USE_XF_EVENT_QUEUE_DEFAULT_IDF_IMPLEMENTATION |
|
||||
| Port Functions | xf/port/idf-stm32cube/port-functions.cpp | USE_XF_PORT_IDF_STM32CUBE_PORT_FUNCTIONS_IMPLEMENTATION |
|
||||
|
||||
# Example _config/xf-config.h_ File
|
||||
```c++
|
||||
#define USE_XF_DEFAULT_IMPLEMENTATION 1
|
||||
#define USE_XF_DISPATCHER_DEFAULT_IMPLEMENTATION 1
|
||||
#define USE_XF_TIMEOUTMANAGER_DEFAULT_IMPLEMENTATION 1
|
||||
#define USE_XF_RESOURCE_FACTORY_DEFAULT_IMPLEMENTATION 1
|
||||
#define USE_XF_MUTEX_DEFAULT_IDF_IMPLEMENTATION 1
|
||||
#define USE_XF_EVENT_QUEUE_DEFAULT_IDF_IMPLEMENTATION 1
|
||||
#define USE_XF_PORT_IDF_STM32CUBE_PORT_FUNCTIONS_IMPLEMENTATION 1
|
||||
|
||||
#include "default-idf/eventqueue-default.h"
|
||||
#ifdef __cplusplus
|
||||
using XFEventQueue = XFEventQueueDefault;
|
||||
#endif // __cplusplus
|
||||
```
|
BIN
src/xf/port/idf-stm32cube/README.pdf
Normal file
BIN
src/xf/port/idf-stm32cube/README.pdf
Normal file
Binary file not shown.
63
src/xf/port/idf-stm32cube/port-functions.cpp
Normal file
63
src/xf/port/idf-stm32cube/port-functions.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
#include <config/xf-config.h>
|
||||
|
||||
#if (USE_XF_PORT_IDF_STM32CUBE_PORT_FUNCTIONS_IMPLEMENTATION != 0)
|
||||
|
||||
#include <cassert>
|
||||
#include "mcu/mcu.h"
|
||||
#include "critical/critical.h"
|
||||
#include "xf/xf.h"
|
||||
#include "xf/interface/timeoutmanager.h"
|
||||
#include "xf/port/port-functions.h"
|
||||
|
||||
using interface::XFTimeoutManager;
|
||||
|
||||
/**
|
||||
* For this port the following port functions need to be implemented:
|
||||
* - XF_startTimeoutManagerTimer()
|
||||
* - XF_tick()
|
||||
* - XF_tickIntervalInMilliseconds()
|
||||
|
||||
* In the XF_startTimeoutManagerTimer() function no code needs to
|
||||
* be implemented because the SysTick peripheral is already initialized
|
||||
* be the STM32CubeMX HAL.
|
||||
* This means that changes in 'tickInterval' needs to be handled elsewhere
|
||||
* using the XF_tickIntervalInMilliseconds() function.
|
||||
*/
|
||||
|
||||
void XF_startTimeoutManagerTimer(uint32_t tickInterval)
|
||||
{
|
||||
(void)tickInterval;
|
||||
|
||||
// SysTick gets already started by the STM32CubeMX HAL.
|
||||
// So nothing to do here.
|
||||
}
|
||||
|
||||
/**
|
||||
* SysTick_Handler() function is already implemented in the STM32CubeMX generated
|
||||
* code (see Src/stm32fxxx_it.c file). Therefore, we must provide here a function
|
||||
* which can be explicitly called in SysTick_Handler() to tick the XF.
|
||||
*/
|
||||
void XF_tick()
|
||||
{
|
||||
critical_setInIsr(true); // Tell critical section we are in an ISR
|
||||
if (XF::isRunning()) // Call tick only if XF is running
|
||||
{
|
||||
XFTimeoutManager::getInstance()->tick(); // Call framework hook tick function
|
||||
}
|
||||
critical_setInIsr(false); // Tell critical section we are leaving the ISR
|
||||
}
|
||||
|
||||
/**
|
||||
* C function wrapping getTickInterval() method of XFTimeoutManager.
|
||||
*/
|
||||
int32_t XF_tickIntervalInMilliseconds()
|
||||
{
|
||||
return XFTimeoutManager::getInstance()->getTickInterval();
|
||||
}
|
||||
|
||||
bool XF_isRunning()
|
||||
{
|
||||
return XF::isRunning();
|
||||
}
|
||||
|
||||
#endif // USE_XF_PORT_IDF_STM32CUBE_PORT_FUNCTIONS_IMPLEMENTATION
|
7
src/xf/port/idf-stm32cube/port-idf-stm32cube.dox
Normal file
7
src/xf/port/idf-stm32cube/port-idf-stm32cube.dox
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
/** @defgroup port_idf_stm32cube IDF STM32Cube Port Classes
|
||||
*
|
||||
* XF port classes for the `IDF STM32Cube` port.
|
||||
*
|
||||
* For the `IDF STM32Cube` port only default port classes are used.
|
||||
*/
|
Reference in New Issue
Block a user