Added alternate function inits for USART

This commit is contained in:
2025-09-07 21:30:32 -07:00
parent 84ab921291
commit b2c41e2cb4
21 changed files with 182 additions and 70 deletions

View File

@@ -2,8 +2,8 @@
// Created by Luca on 9/6/2025.
//
#ifndef SHMINGO_HAL_SHAL_GPIO_REG_H
#define SHMINGO_HAL_SHAL_GPIO_REG_H
#ifndef SHAL_GPIO_REG_H
#define SHAL_GPIO_REG_H
#if defined(STM32F030x6)
#include "stm32f030x6.h"

View File

@@ -2,8 +2,8 @@
// Created by Luca on 8/29/2025.
//
#ifndef SHMINGO_HAL_SHAL_GPIO_REG_F072XB_H
#define SHMINGO_HAL_SHAL_GPIO_REG_F072XB_H
#ifndef SHAL_GPIO_REG_F072XB_H
#define SHAL_GPIO_REG_F072XB_H
#include <stm32f072xb.h>
#include <cassert>
@@ -31,7 +31,7 @@ enum class GPIO_Key : uint8_t {
constexpr SHAL_Peripheral getGPIORegister(const GPIO_Key g){
constexpr SHAL_GPIO_Peripheral getGPIORegister(const GPIO_Key g){
switch(g) {
case GPIO_Key::A0: return {GPIOA,0};
case GPIO_Key::A1: return {GPIOA,1};
@@ -84,7 +84,7 @@ constexpr SHAL_Peripheral getGPIORegister(const GPIO_Key g){
case GPIO_Key::INVALID:
case GPIO_Key::NUM_GPIO:
assert(false);
return SHAL_Peripheral(nullptr,0); //Unreachable
return SHAL_GPIO_Peripheral(nullptr,0); //Unreachable
}
__builtin_unreachable();
}
@@ -143,7 +143,7 @@ constexpr SHAL_EXTIO_Register getGPIOEXTICR(const GPIO_Key g){
case GPIO_Key::INVALID:
case GPIO_Key::NUM_GPIO:
assert(false);
return SHAL_EXTIO_Register(nullptr,0); //Unreachable
return SHAL_EXTIO_Register(nullptr,0, EXTI4_15_IRQn); //Unreachable
}
__builtin_unreachable();
}

View File

@@ -2,8 +2,8 @@
// Created by Luca on 9/6/2025.
//
#ifndef SHMINGO_HAL_SHAL_GPIO_TYPES_H
#define SHMINGO_HAL_SHAL_GPIO_TYPES_H
#ifndef SHAL_GPIO_TYPES_H
#define SHAL_GPIO_TYPES_H
#include "SHAL_CORE.h"
@@ -14,6 +14,16 @@ struct SHAL_EXTIO_Register{
IRQn_Type IRQN;
};
struct SHAL_GPIO_Peripheral {
GPIO_TypeDef * reg;
unsigned long global_offset;
};
struct SHAL_Peripheral_Register {
volatile uint32_t* reg;
unsigned long offset;
};
#endif //SHMINGO_HAL_SHAL_GPIO_TYPES_H