mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-08-06 10:27:34 +00:00
F407-support
This commit is contained in:
61
include/sta/devices/stm32/mcu/template.hpp
Normal file
61
include/sta/devices/stm32/mcu/template.hpp
Normal file
@@ -0,0 +1,61 @@
|
||||
#ifndef STA_CORE_STM32_MCU_TEMPLATE_HPP
|
||||
#define STA_CORE_STM32_MCU_TEMPLATE_HPP
|
||||
|
||||
#ifndef STM32_YOUR_MCU_xx
|
||||
# error "MCU config incompatible"
|
||||
#endif // STM32_YOUR_MCU_xx
|
||||
|
||||
#include <sta/devices/stm32/mcu/common.hpp>
|
||||
|
||||
// Peripheral clock mappings
|
||||
//
|
||||
|
||||
// TIM to PCLK
|
||||
/**
|
||||
* Look up the datasheet for the MCU you are using. There you will find a functional
|
||||
* diagram, where all timers (e.g. "TIM1") are displayed. They are all connected to a
|
||||
* "Advanced Peripheral Bus" (APB). Since there are multiple of them (e.g. APB1 and APB2),
|
||||
* you have to map each timer to the APB it is connected to:
|
||||
*/
|
||||
#define STA_STM32_TIM_1_PCLK_IDX 1
|
||||
// ...
|
||||
|
||||
// SPI to PCLK
|
||||
// Do the same for SPI...
|
||||
#define STA_STM32_SPI_1_PCLK_IDX 2
|
||||
|
||||
// I2C to PCLK
|
||||
// Do the same for I2C...
|
||||
#define STA_STM32_I2C_1_PCLK_IDX 1
|
||||
|
||||
// USART to PCLK
|
||||
// Do the same for USART...
|
||||
#define STA_STM32_USART_1_PCLK_IDX 2
|
||||
|
||||
|
||||
// HAL handle mappings
|
||||
//
|
||||
|
||||
// TIM to PCLK#
|
||||
/**
|
||||
* This section is straightforward. We only map the handles of the different timers
|
||||
* to the corresponding indices we defined before. For example "htim1" is the handle
|
||||
* for TIM1 which means that we need the following mapping:
|
||||
*/
|
||||
#define STA_STM32_htim1_PCLK_IDX STA_STM32_TIM_1_PCLK_IDX
|
||||
|
||||
// SPI to PCLK
|
||||
// Do the same for SPI...
|
||||
#define STA_STM32_hspi1_PCLK_IDX STA_STM32_SPI_1_PCLK_IDX
|
||||
|
||||
// I2C to PCLK
|
||||
// Do the same for I2C...
|
||||
#define STA_STM32_hi2c1_PCLK_IDX STA_STM32_I2C_1_PCLK_IDX
|
||||
|
||||
// USART to PCLK
|
||||
// Do the same for USART...
|
||||
#define STA_STM32_husart1_PCLK_IDX STA_STM32_USART_1_PCLK_IDX
|
||||
|
||||
// Aaaaaaand we're done!
|
||||
|
||||
#endif // STA_CORE_STM32_MCU_TEMPLATE_HPP
|
Reference in New Issue
Block a user