summaryrefslogtreecommitdiff
path: root/include/fe_config_backend.h
blob: e0d6690c4b10eb6b5d8f975a90ea235041a61687 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef __FE_CONFIG_BACKEND_H__
#define __FE_CONFIG_BACKEND_H__

#include <fe_global.h>

#define FE_CONFIG_GPIOA RCC_AHBENR_GPIOAEN, GPIOA
#define FE_CONFIG_GPIOB RCC_AHBENR_GPIOBEN, GPIOB
#define FE_CONFIG_GPIOC RCC_AHBENR_GPIOCEN, GPIOC
#define FE_CONFIG_GPIOD RCC_AHBENR_GPIODEN, GPIOD
#define FE_CONFIG_GPIOF RCC_AHBENR_GPIOFEN, GPIOF

enum fe_config_usart {
    FE_CONFIG_USART1_PB7,
    FE_CONFIG_USART_COUNT
};

struct fe_config_gpiodef {
    uint32_t rcc_ahbenr_flags;
    GPIO_TypeDef *gpio;
    int pin_number; 
};

struct fe_config_def {
    struct fe_config_gpiodef bootloader_enable_pin;
    int bootloader_enable_level;

    struct fe_config_gpiodef signature_disable_pin;
    int signature_disable_level;

    enum fe_config_usart usart;
    int baudrate;
    
    const char *welcome_string;
};

extern const struct fe_config_def fe_config;

void gpio_config(GPIO_TypeDef *gpio, int pin, int mode, int speed, int pullups, int alt);

#endif /* __FE_CONFIG_BACKEND_H__ */