mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-09-28 21:17:33 +00:00
Merge branch 'main' into arduino-support
This commit is contained in:
@@ -31,6 +31,14 @@ namespace sta
|
||||
*/
|
||||
void start();
|
||||
|
||||
/**
|
||||
* @brief Starts conversion of the incoming analog signal in DMA mode.
|
||||
*
|
||||
* @param buffer The buffer to write the converted values to.
|
||||
* @param length The length of the buffer to write the converted values to.
|
||||
*/
|
||||
void startDMA(uint32_t * buffer, size_t length);
|
||||
|
||||
/**
|
||||
* @brief Polls for the converted analog signal.
|
||||
*
|
||||
|
@@ -80,6 +80,14 @@ namespace sta
|
||||
void disableFilter(uint8_t idx) override;
|
||||
void clearFilters() override;
|
||||
|
||||
// Return pending RX FIFOs as iterable container
|
||||
CanPendingRxFifos getPendingRxFifos() override;
|
||||
|
||||
// Const getters
|
||||
uint8_t maxFilterCount() const override;
|
||||
uint8_t maxFifoCount() const override;
|
||||
uint8_t maxPayloadSize() const override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Initialize filter settings.
|
||||
|
@@ -39,7 +39,7 @@ namespace sta
|
||||
*
|
||||
* @param n Index of peripheral clock
|
||||
*/
|
||||
#define STA_STM32_GET_PCLK_FREQ_FN(n) HAL_RCC_GetPCLK ## n ## Freq
|
||||
#define STA_STM32_GET_PCLK_FREQ_FN(n) HAL_RCC_GetPCLK ## n ## Freq
|
||||
|
||||
/**
|
||||
* @brief Internal helper for macro expansion.
|
||||
@@ -47,7 +47,31 @@ namespace sta
|
||||
* @param n PCLK index
|
||||
* @return Function returning PCLK frequency
|
||||
*/
|
||||
#define _STA_STM32_GET_PCLK_FREQ_FN(n) STA_STM32_GET_PCLK_FREQ_FN(n)
|
||||
#define _STA_STM32_GET_PCLK_FREQ_FN(n) STA_STM32_GET_PCLK_FREQ_FN(n)
|
||||
|
||||
/**
|
||||
* @brief Get the PCLK frequency.
|
||||
*
|
||||
* @param n PCLK index
|
||||
* @return The PCLK frequency
|
||||
*/
|
||||
#define _STA_STM32_GET_PCLK_FREQ(n) STA_STM32_GET_PCLK_FREQ_FN(n)()
|
||||
|
||||
/**
|
||||
* @brief Gets the prescaler from APBx to APBx timer clocks.
|
||||
*
|
||||
* @param n PCLK index
|
||||
* @return The prescaler from PCLK to TIM
|
||||
*/
|
||||
#define STA_STM32_GET_PCLK_TIM_PRESCALER(n) STA_STM32_TIM_PCLK_ ## n ## ## _PRESCALER
|
||||
|
||||
/**
|
||||
* @brief Internal helper for macro expansion.
|
||||
*
|
||||
* @param n PCLK index
|
||||
* @return Function returning PCLK frequency
|
||||
*/
|
||||
#define _STA_STM32_GET_PCLK_TIM_PRESCALER(n) STA_STM32_GET_PCLK_TIM_PRESCALER(n)
|
||||
|
||||
/**
|
||||
* @brief Map instance name to PCLK index.
|
||||
@@ -56,52 +80,67 @@ namespace sta
|
||||
* @param idx Instance index
|
||||
* @return PCLK index
|
||||
*/
|
||||
#define _STA_STM32_PCLK_IDX_MAP(type, idx) STA_STM32_ ## type ## _ ## idx ## _PCLK_IDX
|
||||
#define _STA_STM32_PCLK_IDX_MAP(type, idx) STA_STM32_ ## type ## _ ## idx ## _PCLK_IDX
|
||||
// Get HAL handle to PCLK index map macro
|
||||
|
||||
/**
|
||||
* @brief Map instance handle to PCLK index.
|
||||
*
|
||||
* @param handle HAL handle
|
||||
* @return PCLK index
|
||||
*/
|
||||
#define _STA_STM32_HANDLE_PCLK_IDX_MAP(handle) STA_STM32_ ## handle ## _PCLK_IDX
|
||||
|
||||
#define _STA_STM32_HANDLE_PCLK_IDX_MAP(handle) STA_STM32_ ## handle ## _PCLK_IDX
|
||||
|
||||
/**
|
||||
* @brief Get function returning frequency of PCLK used by TIM.
|
||||
* @brief Get a function returning the frequency of PCLK used by TIM.
|
||||
*
|
||||
* @param n TIM index
|
||||
*/
|
||||
#define STA_STM32_GET_TIM_PCLK_FREQ_FN(n) _STA_STM32_GET_PCLK_FREQ_FN(_STA_STM32_PCLK_IDX_MAP(TIM, n))
|
||||
#define STA_STM32_GET_TIM_PCLK_FREQ_FN(n) _STA_STM32_GET_PCLK_FREQ_FN(_STA_STM32_PCLK_IDX_MAP(TIM, n))
|
||||
|
||||
/**
|
||||
* @brief Get function returning frequency of PCLK used by SPI interface.
|
||||
* @brief Internal helper for macro expansion.
|
||||
*
|
||||
* @param n TIM index
|
||||
*/
|
||||
#define _STA_STM32_GET_TIM_PCLK_FREQ_FN(n) STA_STM32_GET_TIM_PCLK_FREQ_FN(n)
|
||||
|
||||
/**
|
||||
* @brief Get a function returning the frequency of PCLK used by SPI interface.
|
||||
*
|
||||
* @param n SPI interface index
|
||||
*/
|
||||
#define STA_STM32_GET_SPI_PCLK_FREQ_FN(n) _STA_STM32_GET_PCLK_FREQ_FN(_STA_STM32_PCLK_IDX_MAP(SPI, n))
|
||||
#define STA_STM32_GET_SPI_PCLK_FREQ_FN(n) _STA_STM32_GET_PCLK_FREQ_FN(_STA_STM32_PCLK_IDX_MAP(SPI, n))
|
||||
|
||||
/**
|
||||
* @brief Get function returning frequency of PCLK used by I2C interface.
|
||||
* @brief Get a function returning the frequency of PCLK used by I2C interface.
|
||||
*
|
||||
* @param n I2C interface index
|
||||
*/
|
||||
#define STA_STM32_GET_I2C_PCLK_FREQ_FN(n) _STA_STM32_GET_PCLK_FREQ_FN(_STA_STM32_PCLK_IDX_MAP(I2C, n))
|
||||
#define STA_STM32_GET_I2C_PCLK_FREQ_FN(n) _STA_STM32_GET_PCLK_FREQ_FN(_STA_STM32_PCLK_IDX_MAP(I2C, n))
|
||||
|
||||
/**
|
||||
* @brief Get function returning frequency of PCLK used by USART interface.
|
||||
* @brief Get a function returning the frequency of PCLK used by USART interface.
|
||||
*
|
||||
* @param n USART interface index
|
||||
*/
|
||||
#define STA_STM32_GET_USART_PCLK_FREQ_FN(n) _STA_STM32_GET_PCLK_FREQ_FN(_STA_STM32_PCLK_IDX_MAP(USART, n))
|
||||
#define STA_STM32_GET_USART_PCLK_FREQ_FN(n) _STA_STM32_GET_PCLK_FREQ_FN(_STA_STM32_PCLK_IDX_MAP(USART, n))
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get function returning frequency of PCLK used by HAL instance.
|
||||
* @brief Get a function returning the frequency of PCLK used by HAL instance.
|
||||
*
|
||||
* @param handle Instance handle
|
||||
*/
|
||||
#define STA_STM32_GET_HANDLE_PCLK_FREQ_FN(handle) _STA_STM32_GET_PCLK_FREQ_FN(_STA_STM32_HANDLE_PCLK_IDX_MAP(handle))
|
||||
#define STA_STM32_GET_HANDLE_PCLK_FREQ_FN(handle) _STA_STM32_GET_PCLK_FREQ_FN(_STA_STM32_HANDLE_PCLK_IDX_MAP(handle))
|
||||
|
||||
/**
|
||||
* @brief Get the PCLK to timer prescaler for TIM given by the handle.
|
||||
*
|
||||
* @param handle TIM handle
|
||||
* @return PCLK-TIM prescaler
|
||||
*/
|
||||
#define STA_STM32_GET_HANDLE_PCLK_TIM_PRESCALER(handle) _STA_STM32_GET_PCLK_TIM_PRESCALER(_STA_STM32_HANDLE_PCLK_IDX_MAP(handle))
|
||||
|
||||
|
||||
/** @} */
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#ifndef STA_CORE_STM32_INIT_HPP
|
||||
#define STA_CORE_STM32_INIT_HPP
|
||||
|
||||
#include <sta/devices/stm32/hal.hpp>
|
||||
|
||||
namespace sta
|
||||
{
|
||||
|
@@ -14,9 +14,10 @@
|
||||
|
||||
#include <sta/devices/stm32/mcu/common.hpp>
|
||||
|
||||
// uart setup
|
||||
// uart/CAN setup
|
||||
#ifdef STA_STM32_ASEAG
|
||||
# define STA_STM32_USART_HANDLE huart1
|
||||
# define STA_STM32_CAN_HANDLE hcan1
|
||||
#else
|
||||
# ifdef STA_STM32_SWD_USART_IDX
|
||||
# define STA_STM32_USART_HANDLE CONCAT(huart, STA_STM32_SWD_USART_IDX)
|
||||
@@ -63,6 +64,11 @@
|
||||
#define STA_STM32_USART_3_PCLK_IDX 1 /**< USART3 to PCLK index */
|
||||
#define STA_STM32_USART_6_PCLK_IDX 2 /**< USART6 to PCLK index */
|
||||
|
||||
// prescaler from APBx to APBx timer clocks
|
||||
#define STA_STM32_TIM_PCLK_1_PRESCALER 2 /**< PCLK1 has prescaler of 2 */
|
||||
#define STA_STM32_TIM_PCLK_2_PRESCALER 2 /**< PCLK2 has prescaler of 1 */
|
||||
|
||||
|
||||
// HAL handle mappings
|
||||
//
|
||||
|
||||
@@ -100,4 +106,4 @@
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif // STA_CORE_STM32_MCU_STM32F407xx_HPP
|
||||
#endif // STA_CORE_STM32_MCU_STM32F407xx_HPP
|
||||
|
@@ -63,8 +63,13 @@
|
||||
#define STA_STM32_USART_2_PCLK_IDX 1 /**< USART2 to PCLK index 1 */
|
||||
#define STA_STM32_USART_6_PCLK_IDX 2 /**< USART6 to PCLK index 2 */
|
||||
|
||||
// prescaler from APBx to APBx timer clocks
|
||||
#define STA_STM32_TIM_PCLK_1_PRESCALER 2 /**< PCLK1 has prescaler of 2 */
|
||||
#define STA_STM32_TIM_PCLK_2_PRESCALER 1 /**< PCLK2 has prescaler of 1 */
|
||||
|
||||
|
||||
// HAL handle mappings
|
||||
//
|
||||
|
||||
// TIM to PCLK
|
||||
#define STA_STM32_htim1_PCLK_IDX STA_STM32_TIM_1_PCLK_IDX /**< HAL TIM1 to PCLK index */
|
||||
|
Reference in New Issue
Block a user