Changed directory structure to eventually support multi-MCU family support - added files

This commit is contained in:
2025-08-29 23:06:44 -07:00
parent a0cb980e16
commit 45abfc6c88
19 changed files with 48 additions and 43 deletions

View File

@@ -8,7 +8,7 @@
#include <cstdint>
struct RCC_Peripheral {
struct SHAL_Peripheral {
volatile uint32_t* reg;
uint32_t bitmask;
};

View File

@@ -4,6 +4,8 @@
#include <cassert>
#include <stm32f072xb.h>
#include "SHAL_CORE.h"
enum class Timer_Key { //For STM32F072
S_TIM1,
S_TIM2,
@@ -18,7 +20,7 @@ enum class Timer_Key { //For STM32F072
//Get timer peripheral struct including bus register, enable mask, timer mask
constexpr RCC_Peripheral getTimerRCC(Timer_Key t) {
constexpr SHAL_Peripheral getTimerRCC(Timer_Key t) {
switch(t) {
case Timer_Key::S_TIM1: return {&RCC->APB2ENR, RCC_APB2ENR_TIM1EN};
case Timer_Key::S_TIM2: return {&RCC->APB1ENR, RCC_APB1ENR_TIM2EN};

View File

@@ -2,11 +2,11 @@
// Created by Luca on 8/28/2025.
//
#include "Core/Include/Timer/SHAL_TIM.h"
#include "SHAL_TIM.h"
#include <cassert>
Timer::Timer(Timer_Key t) : timer(t), timer_reg(getTimerRegister(t)){
RCC_Peripheral rcc = getTimerRCC(timer);
SHAL_Peripheral rcc = getTimerRCC(timer);
*rcc.reg |= rcc.bitmask;
}