chore(hal): remove StdPeriph (#5023)
Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com> Co-authored-by: Malte Langermann <malte@langermann.net> Co-authored-by: 3djc <3djc@gh.com> Co-authored-by: Richard Li <richard.li@ces.hk>
This commit is contained in:
co-authored by
raphaelcoeffic
Malte Langermann
3djc
Richard Li
parent
fea402a6e3
commit
6579905088
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "stm32_adc.h"
|
||||
#include "stm32_gpio.h"
|
||||
|
||||
#include "stm32_gpio_driver.h"
|
||||
#include "stm32_ws2812.h"
|
||||
@@ -34,6 +35,7 @@
|
||||
#include "hal/abnormal_reboot.h"
|
||||
#include "hal/watchdog_driver.h"
|
||||
#include "hal/usb_driver.h"
|
||||
#include "hal/gpio.h"
|
||||
|
||||
#include "globals.h"
|
||||
#include "sdcard.h"
|
||||
@@ -72,24 +74,8 @@ void delay_self(int count)
|
||||
for (; count > 0; count--);
|
||||
}
|
||||
}
|
||||
#define RCC_AHB1PeriphMinimum (PWR_RCC_AHB1Periph |\
|
||||
LCD_RCC_AHB1Periph |\
|
||||
BACKLIGHT_RCC_AHB1Periph |\
|
||||
SDRAM_RCC_AHB1Periph \
|
||||
)
|
||||
#define RCC_AHB1PeriphOther (AUDIO_RCC_AHB1Periph |\
|
||||
TELEMETRY_RCC_AHB1Periph |\
|
||||
HAPTIC_RCC_AHB1Periph |\
|
||||
INTMODULE_RCC_AHB1Periph |\
|
||||
EXTMODULE_RCC_AHB1Periph \
|
||||
)
|
||||
#define RCC_AHB3PeriphMinimum (SDRAM_RCC_AHB3Periph)
|
||||
#define RCC_APB1PeriphMinimum (BACKLIGHT_RCC_APB1Periph)
|
||||
#define RCC_APB1PeriphOther (TELEMETRY_RCC_APB1Periph |\
|
||||
AUDIO_RCC_APB1Periph \
|
||||
)
|
||||
#define RCC_AHB1PeriphMinimum (LCD_RCC_AHB1Periph)
|
||||
#define RCC_APB2PeriphMinimum (LCD_RCC_APB2Periph)
|
||||
#define RCC_APB2PeriphOther (HAPTIC_RCC_APB2Periph)
|
||||
|
||||
void ledStripOff()
|
||||
{
|
||||
@@ -102,14 +88,7 @@ void ledStripOff()
|
||||
void boardBootloaderInit()
|
||||
{
|
||||
// USB charger status pins
|
||||
stm32_gpio_enable_clock(UCHARGER_GPIO);
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||
GPIO_InitStructure.GPIO_Pin = UCHARGER_GPIO_PIN;
|
||||
GPIO_Init(UCHARGER_GPIO, &GPIO_InitStructure);
|
||||
gpio_init(UCHARGER_GPIO, GPIO_IN, GPIO_PIN_SPEED_LOW);
|
||||
}
|
||||
|
||||
void boardInit()
|
||||
@@ -119,11 +98,8 @@ void boardInit()
|
||||
#endif
|
||||
|
||||
#if !defined(SIMU)
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1PeriphMinimum | RCC_AHB1PeriphOther, ENABLE);
|
||||
RCC_AHB3PeriphClockCmd(RCC_AHB3PeriphMinimum, ENABLE);
|
||||
RCC_APB1PeriphClockCmd(RCC_APB1PeriphMinimum | RCC_APB1PeriphOther, ENABLE);
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2PeriphMinimum | RCC_APB2PeriphOther, ENABLE);
|
||||
|
||||
LL_AHB1_GRP1_EnableClock(RCC_AHB1PeriphMinimum);
|
||||
LL_APB2_GRP1_EnableClock(RCC_APB2PeriphMinimum);
|
||||
// enable interrupts
|
||||
__enable_irq();
|
||||
#endif
|
||||
@@ -195,13 +171,13 @@ void boardInit()
|
||||
lcdSetInitalFrameBuffer(lcdFront->getData());
|
||||
|
||||
#if defined(DEBUG)
|
||||
DBGMCU_APB1PeriphConfig(
|
||||
/* DBGMCU_APB1PeriphConfig(
|
||||
DBGMCU_IWDG_STOP | DBGMCU_TIM1_STOP | DBGMCU_TIM2_STOP |
|
||||
DBGMCU_TIM3_STOP | DBGMCU_TIM4_STOP | DBGMCU_TIM5_STOP |
|
||||
DBGMCU_TIM6_STOP | DBGMCU_TIM7_STOP | DBGMCU_TIM8_STOP |
|
||||
DBGMCU_TIM9_STOP | DBGMCU_TIM10_STOP | DBGMCU_TIM11_STOP |
|
||||
DBGMCU_TIM12_STOP | DBGMCU_TIM13_STOP | DBGMCU_TIM14_STOP,
|
||||
ENABLE);
|
||||
ENABLE);*/
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -263,8 +239,7 @@ int usbPlugged()
|
||||
static uint8_t debouncedState = 0;
|
||||
static uint8_t lastState = 0;
|
||||
|
||||
uint8_t state = GPIO_ReadInputDataBit(UCHARGER_GPIO, UCHARGER_GPIO_PIN);
|
||||
|
||||
uint8_t state = gpio_read(UCHARGER_GPIO) ? 1 : 0;
|
||||
if (state == lastState)
|
||||
debouncedState = state;
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user