diff options
Diffstat (limited to 'keyboards/chibios_test/boards/GENERIC_STM32_F103/board.h')
| -rw-r--r-- | keyboards/chibios_test/boards/GENERIC_STM32_F103/board.h | 332 |
1 files changed, 166 insertions, 166 deletions
diff --git a/keyboards/chibios_test/boards/GENERIC_STM32_F103/board.h b/keyboards/chibios_test/boards/GENERIC_STM32_F103/board.h index 7253e7782..b31d74307 100644 --- a/keyboards/chibios_test/boards/GENERIC_STM32_F103/board.h +++ b/keyboards/chibios_test/boards/GENERIC_STM32_F103/board.h | |||
| @@ -1,166 +1,166 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio | 2 | ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio |
| 3 | 3 | ||
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); | 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. | 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at | 6 | You may obtain a copy of the License at |
| 7 | 7 | ||
| 8 | http://www.apache.org/licenses/LICENSE-2.0 | 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | 9 | ||
| 10 | Unless required by applicable law or agreed to in writing, software | 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, | 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and | 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. | 14 | limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #ifndef _BOARD_H_ | 17 | #ifndef _BOARD_H_ |
| 18 | #define _BOARD_H_ | 18 | #define _BOARD_H_ |
| 19 | 19 | ||
| 20 | /* | 20 | /* |
| 21 | * Setup for a Generic STM32F103 board. | 21 | * Setup for a Generic STM32F103 board. |
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | /* | 24 | /* |
| 25 | * Board identifier. | 25 | * Board identifier. |
| 26 | */ | 26 | */ |
| 27 | #define BOARD_GENERIC_STM32_F103 | 27 | #define BOARD_GENERIC_STM32_F103 |
| 28 | #define BOARD_NAME "Generic STM32F103x board" | 28 | #define BOARD_NAME "Generic STM32F103x board" |
| 29 | 29 | ||
| 30 | /* | 30 | /* |
| 31 | * Board frequencies. | 31 | * Board frequencies. |
| 32 | */ | 32 | */ |
| 33 | #define STM32_LSECLK 32768 | 33 | #define STM32_LSECLK 32768 |
| 34 | #define STM32_HSECLK 8000000 | 34 | #define STM32_HSECLK 8000000 |
| 35 | 35 | ||
| 36 | /* | 36 | /* |
| 37 | * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h. | 37 | * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h. |
| 38 | */ | 38 | */ |
| 39 | #define STM32F103xB | 39 | #define STM32F103xB |
| 40 | 40 | ||
| 41 | /* | 41 | /* |
| 42 | * IO pins assignments | 42 | * IO pins assignments |
| 43 | */ | 43 | */ |
| 44 | 44 | ||
| 45 | /* on-board */ | 45 | /* on-board */ |
| 46 | 46 | ||
| 47 | #define GPIOC_LED 13 | 47 | #define GPIOC_LED 13 |
| 48 | #define GPIOD_OSC_IN 0 | 48 | #define GPIOD_OSC_IN 0 |
| 49 | #define GPIOD_OSC_OUT 1 | 49 | #define GPIOD_OSC_OUT 1 |
| 50 | 50 | ||
| 51 | /* In case your board has a "USB enable" hardware | 51 | /* In case your board has a "USB enable" hardware |
| 52 | controlled by a pin, define it here. (It could be just | 52 | controlled by a pin, define it here. (It could be just |
| 53 | a 1.5k resistor connected to D+ line.) | 53 | a 1.5k resistor connected to D+ line.) |
| 54 | */ | 54 | */ |
| 55 | /* | 55 | /* |
| 56 | #define GPIOB_USB_DISC 10 | 56 | #define GPIOB_USB_DISC 10 |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | /* | 59 | /* |
| 60 | * I/O ports initial setup, this configuration is established soon after reset | 60 | * I/O ports initial setup, this configuration is established soon after reset |
| 61 | * in the initialization code. | 61 | * in the initialization code. |
| 62 | * | 62 | * |
| 63 | * The digits have the following meaning: | 63 | * The digits have the following meaning: |
| 64 | * 0 - Analog input. | 64 | * 0 - Analog input. |
| 65 | * 1 - Push Pull output 10MHz. | 65 | * 1 - Push Pull output 10MHz. |
| 66 | * 2 - Push Pull output 2MHz. | 66 | * 2 - Push Pull output 2MHz. |
| 67 | * 3 - Push Pull output 50MHz. | 67 | * 3 - Push Pull output 50MHz. |
| 68 | * 4 - Digital input. | 68 | * 4 - Digital input. |
| 69 | * 5 - Open Drain output 10MHz. | 69 | * 5 - Open Drain output 10MHz. |
| 70 | * 6 - Open Drain output 2MHz. | 70 | * 6 - Open Drain output 2MHz. |
| 71 | * 7 - Open Drain output 50MHz. | 71 | * 7 - Open Drain output 50MHz. |
| 72 | * 8 - Digital input with PullUp or PullDown resistor depending on ODR. | 72 | * 8 - Digital input with PullUp or PullDown resistor depending on ODR. |
| 73 | * 9 - Alternate Push Pull output 10MHz. | 73 | * 9 - Alternate Push Pull output 10MHz. |
| 74 | * A - Alternate Push Pull output 2MHz. | 74 | * A - Alternate Push Pull output 2MHz. |
| 75 | * B - Alternate Push Pull output 50MHz. | 75 | * B - Alternate Push Pull output 50MHz. |
| 76 | * C - Reserved. | 76 | * C - Reserved. |
| 77 | * D - Alternate Open Drain output 10MHz. | 77 | * D - Alternate Open Drain output 10MHz. |
| 78 | * E - Alternate Open Drain output 2MHz. | 78 | * E - Alternate Open Drain output 2MHz. |
| 79 | * F - Alternate Open Drain output 50MHz. | 79 | * F - Alternate Open Drain output 50MHz. |
| 80 | * Please refer to the STM32 Reference Manual for details. | 80 | * Please refer to the STM32 Reference Manual for details. |
| 81 | */ | 81 | */ |
| 82 | 82 | ||
| 83 | /* | 83 | /* |
| 84 | * Port A setup. | 84 | * Port A setup. |
| 85 | * Everything input with pull-up except: | 85 | * Everything input with pull-up except: |
| 86 | * PA2 - Alternate output (USART2 TX). | 86 | * PA2 - Alternate output (USART2 TX). |
| 87 | * PA3 - Normal input (USART2 RX). | 87 | * PA3 - Normal input (USART2 RX). |
| 88 | * PA9 - Alternate output (USART1 TX). | 88 | * PA9 - Alternate output (USART1 TX). |
| 89 | * PA10 - Normal input (USART1 RX). | 89 | * PA10 - Normal input (USART1 RX). |
| 90 | */ | 90 | */ |
| 91 | #define VAL_GPIOACRL 0x88884B88 /* PA7...PA0 */ | 91 | #define VAL_GPIOACRL 0x88884B88 /* PA7...PA0 */ |
| 92 | #define VAL_GPIOACRH 0x888884B8 /* PA15...PA8 */ | 92 | #define VAL_GPIOACRH 0x888884B8 /* PA15...PA8 */ |
| 93 | #define VAL_GPIOAODR 0xFFFFFFFF | 93 | #define VAL_GPIOAODR 0xFFFFFFFF |
| 94 | 94 | ||
| 95 | /* | 95 | /* |
| 96 | * Port B setup. | 96 | * Port B setup. |
| 97 | * Everything input with pull-up except: | 97 | * Everything input with pull-up except: |
| 98 | * PB10 - Push Pull output (USB switch). | 98 | * PB10 - Push Pull output (USB switch). |
| 99 | */ | 99 | */ |
| 100 | #define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */ | 100 | #define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */ |
| 101 | #define VAL_GPIOBCRH 0x88888388 /* PB15...PB8 */ | 101 | #define VAL_GPIOBCRH 0x88888388 /* PB15...PB8 */ |
| 102 | #define VAL_GPIOBODR 0xFFFFFFFF | 102 | #define VAL_GPIOBODR 0xFFFFFFFF |
| 103 | 103 | ||
| 104 | /* | 104 | /* |
| 105 | * Port C setup. | 105 | * Port C setup. |
| 106 | * Everything input with pull-up except: | 106 | * Everything input with pull-up except: |
| 107 | * PC13 - Push Pull output (LED). | 107 | * PC13 - Push Pull output (LED). |
| 108 | */ | 108 | */ |
| 109 | #define VAL_GPIOCCRL 0x88888888 /* PC7...PC0 */ | 109 | #define VAL_GPIOCCRL 0x88888888 /* PC7...PC0 */ |
| 110 | #define VAL_GPIOCCRH 0x88388888 /* PC15...PC8 */ | 110 | #define VAL_GPIOCCRH 0x88388888 /* PC15...PC8 */ |
| 111 | #define VAL_GPIOCODR 0xFFFFFFFF | 111 | #define VAL_GPIOCODR 0xFFFFFFFF |
| 112 | 112 | ||
| 113 | /* | 113 | /* |
| 114 | * Port D setup. | 114 | * Port D setup. |
| 115 | * Everything input with pull-up except: | 115 | * Everything input with pull-up except: |
| 116 | * PD0 - Normal input (XTAL). | 116 | * PD0 - Normal input (XTAL). |
| 117 | * PD1 - Normal input (XTAL). | 117 | * PD1 - Normal input (XTAL). |
| 118 | */ | 118 | */ |
| 119 | #define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */ | 119 | #define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */ |
| 120 | #define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */ | 120 | #define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */ |
| 121 | #define VAL_GPIODODR 0xFFFFFFFF | 121 | #define VAL_GPIODODR 0xFFFFFFFF |
| 122 | 122 | ||
| 123 | /* | 123 | /* |
| 124 | * Port E setup. | 124 | * Port E setup. |
| 125 | * Everything input with pull-up except: | 125 | * Everything input with pull-up except: |
| 126 | */ | 126 | */ |
| 127 | #define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */ | 127 | #define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */ |
| 128 | #define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */ | 128 | #define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */ |
| 129 | #define VAL_GPIOEODR 0xFFFFFFFF | 129 | #define VAL_GPIOEODR 0xFFFFFFFF |
| 130 | 130 | ||
| 131 | /* | 131 | /* |
| 132 | * USB bus activation macro, required by the USB driver. | 132 | * USB bus activation macro, required by the USB driver. |
| 133 | */ | 133 | */ |
| 134 | /* The point is that most of the generic STM32F103* boards | 134 | /* The point is that most of the generic STM32F103* boards |
| 135 | have a 1.5k resistor connected on one end to the D+ line | 135 | have a 1.5k resistor connected on one end to the D+ line |
| 136 | and on the other end to some pin. Or even a slightly more | 136 | and on the other end to some pin. Or even a slightly more |
| 137 | complicated "USB enable" circuit, controlled by a pin. | 137 | complicated "USB enable" circuit, controlled by a pin. |
| 138 | That should go here. | 138 | That should go here. |
| 139 | 139 | ||
| 140 | However on some boards (e.g. one that I have), there's no | 140 | However on some boards (e.g. one that I have), there's no |
| 141 | such hardware. In which case it's better to not do anything. | 141 | such hardware. In which case it's better to not do anything. |
| 142 | */ | 142 | */ |
| 143 | /* | 143 | /* |
| 144 | #define usb_lld_connect_bus(usbp) palClearPad(GPIOB, GPIOB_USB_DISC) | 144 | #define usb_lld_connect_bus(usbp) palClearPad(GPIOB, GPIOB_USB_DISC) |
| 145 | */ | 145 | */ |
| 146 | #define usb_lld_connect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_INPUT); | 146 | #define usb_lld_connect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_INPUT); |
| 147 | 147 | ||
| 148 | /* | 148 | /* |
| 149 | * USB bus de-activation macro, required by the USB driver. | 149 | * USB bus de-activation macro, required by the USB driver. |
| 150 | */ | 150 | */ |
| 151 | /* | 151 | /* |
| 152 | #define usb_lld_disconnect_bus(usbp) palSetPad(GPIOB, GPIOB_USB_DISC) | 152 | #define usb_lld_disconnect_bus(usbp) palSetPad(GPIOB, GPIOB_USB_DISC) |
| 153 | */ | 153 | */ |
| 154 | #define usb_lld_disconnect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_OUTPUT_PUSHPULL); palClearPad(GPIOA, 12); | 154 | #define usb_lld_disconnect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_OUTPUT_PUSHPULL); palClearPad(GPIOA, 12); |
| 155 | 155 | ||
| 156 | #if !defined(_FROM_ASM_) | 156 | #if !defined(_FROM_ASM_) |
| 157 | #ifdef __cplusplus | 157 | #ifdef __cplusplus |
| 158 | extern "C" { | 158 | extern "C" { |
| 159 | #endif | 159 | #endif |
| 160 | void boardInit(void); | 160 | void boardInit(void); |
| 161 | #ifdef __cplusplus | 161 | #ifdef __cplusplus |
| 162 | } | 162 | } |
| 163 | #endif | 163 | #endif |
| 164 | #endif /* _FROM_ASM_ */ | 164 | #endif /* _FROM_ASM_ */ |
| 165 | 165 | ||
| 166 | #endif /* _BOARD_H_ */ | 166 | #endif /* _BOARD_H_ */ |
