stm32f4-uart-bootloader

Simple UART bootloader for STM32F4 MCU's
git clone git://git.mdnr.space/stm32f4-uart-bootloader
Log | Files | Refs | Submodules | README | LICENSE

drv-gpio.h (3236B)


      1 #ifndef __RES_GPIO_H__
      2 #define __RES_GPIO_H__
      3 
      4 #include <libopencm3/stm32/gpio.h>
      5 #include <libopencm3/stm32/rcc.h>
      6 
      7 #define ST_LED0_PORT GPIOD
      8 #define ST_LED0_PIN GPIO14
      9 #define ST_LED1_PORT GPIOD
     10 #define ST_LED1_PIN GPIO15
     11 #define ST_LED2_PORT GPIOG
     12 #define ST_LED2_PIN GPIO2
     13 #define ST_LED3_PORT GPIOG
     14 #define ST_LED3_PIN GPIO3
     15 
     16 #define CH0_LED0_PORT GPIOA
     17 #define CH0_LED0_PIN GPIO6
     18 #define CH0_LED1_PORT GPIOA
     19 #define CH0_LED1_PIN GPIO5
     20 #define CH1_LED0_PORT GPIOB
     21 #define CH1_LED0_PIN GPIO0
     22 #define CH1_LED1_PORT GPIOC
     23 #define CH1_LED1_PIN GPIO5
     24 #define CH2_LED0_PORT GPIOF
     25 #define CH2_LED0_PIN GPIO12
     26 #define CH2_LED1_PORT GPIOF
     27 #define CH2_LED1_PIN GPIO11
     28 #define CH3_LED0_PORT GPIOF
     29 #define CH3_LED0_PIN GPIO14
     30 #define CH3_LED1_PORT GPIOF
     31 #define CH3_LED1_PIN GPIO13
     32 #define CH4_LED0_PORT GPIOG
     33 #define CH4_LED0_PIN GPIO0
     34 #define CH4_LED1_PORT GPIOF
     35 #define CH4_LED1_PIN GPIO15
     36 #define CH5_LED0_PORT GPIOE
     37 #define CH5_LED0_PIN GPIO10
     38 #define CH5_LED1_PORT GPIOE
     39 #define CH5_LED1_PIN GPIO8
     40 #define CH6_LED0_PORT GPIOE
     41 #define CH6_LED0_PIN GPIO15
     42 #define CH6_LED1_PORT GPIOE
     43 #define CH6_LED1_PIN GPIO12
     44 #define CH7_LED0_PORT GPIOB
     45 #define CH7_LED0_PIN GPIO14
     46 #define CH7_LED1_PORT GPIOB
     47 #define CH7_LED1_PIN GPIO13
     48 
     49 #define CH0_EN_PORT GPIOC
     50 #define CH0_EN_PIN GPIO4
     51 #define CH1_EN_PORT GPIOA
     52 #define CH1_EN_PIN GPIO7
     53 #define CH2_EN_PORT GPIOB
     54 #define CH2_EN_PIN GPIO2
     55 #define CH3_EN_PORT GPIOB
     56 #define CH3_EN_PIN GPIO1
     57 #define CH4_EN_PORT GPIOE
     58 #define CH4_EN_PIN GPIO7
     59 #define CH5_EN_PORT GPIOG
     60 #define CH5_EN_PIN GPIO1
     61 #define CH6_EN_PORT GPIOB
     62 #define CH6_EN_PIN GPIO12
     63 #define CH7_EN_PORT GPIOB
     64 #define CH7_EN_PIN GPIO11
     65 
     66 #define MUX_IN_A_PORT GPIOD
     67 #define MUX_IN_A_PIN GPIO8
     68 #define MUX_IN_B_PORT GPIOD
     69 #define MUX_IN_B_PIN GPIO9
     70 #define MUX_IN_C_PORT GPIOD
     71 #define MUX_IN_C_PIN GPIO10
     72 
     73 #define MUX_OUT0_PORT GPIOE
     74 #define MUX_OUT0_PIN GPIO9
     75 #define MUX_OUT1_PORT GPIOE
     76 #define MUX_OUT1_PIN GPIO11
     77 #define MUX_OUT2_PORT GPIOE
     78 #define MUX_OUT2_PIN GPIO13
     79 #define MUX_OUT3_PORT GPIOE
     80 #define MUX_OUT3_PIN GPIO14
     81 
     82 #define GSM_PORT GPIOD
     83 #define GSM_RX_PIN GPIO5
     84 #define GSM_TX_PIN GPIO6
     85 
     86 #define SERIAL_PORT GPIOA
     87 #define SERIAL_RX_PIN GPIO10
     88 #define SERIAL_TX_PIN GPIO9
     89 
     90 #define DBG0_PORT GPIOE
     91 #define DBG0_PIN GPIO1
     92 #define DBG1_PORT GPIOE
     93 #define DBG1_PIN GPIO0
     94 #define DBG2_PORT GPIOB
     95 #define DBG2_PIN GPIO9
     96 #define DBG3_PORT GPIOB
     97 #define DBG3_PIN GPIO8
     98 #define DBG4_PORT GPIOB
     99 #define DBG4_PIN GPIO5
    100 #define DBG5_PORT GPIOG
    101 #define DBG5_PIN GPIO15
    102 #define DBG6_PORT GPIOG
    103 #define DBG6_PIN GPIO14
    104 #define DBG7_PORT GPIOG
    105 #define DBG7_PIN GPIO13
    106 
    107 #define ACTIVE_CH0_PORT GPIOC
    108 #define ACTIVE_CH0_PIN GPIO4
    109 #define ACTIVE_CH1_PORT GPIOA
    110 #define ACTIVE_CH1_PIN GPIO7
    111 #define ACTIVE_CH2_PORT GPIOB
    112 #define ACTIVE_CH2_PIN GPIO2
    113 #define ACTIVE_CH3_PORT GPIOB
    114 #define ACTIVE_CH3_PIN GPIO1
    115 #define ACTIVE_CH4_PORT GPIOE
    116 #define ACTIVE_CH4_PIN GPIO7
    117 #define ACTIVE_CH5_PORT GPIOG
    118 #define ACTIVE_CH5_PIN GPIO1
    119 #define ACTIVE_CH6_PORT GPIOB
    120 #define ACTIVE_CH6_PIN GPIO12
    121 #define ACTIVE_CH7_PORT GPIOB
    122 #define ACTIVE_CH7_PIN GPIO11
    123 
    124 typedef struct {
    125     uint32_t port;
    126     uint16_t pin;
    127 } GPIO_t;
    128 
    129 // Interface:
    130 void res_gpio_setup(void);
    131 
    132 void res_gpio_write_pin(uint32_t port, uint16_t pin, bool value);
    133 #endif // __RES_GPIO_H__