Selaa lähdekoodia

Convert to UNIX line endings

Clara Hobbs 7 vuotta sitten
vanhempi
commit
bad7e2511b
8 muutettua tiedostoa jossa 2432 lisäystä ja 2432 poistoa
  1. 212
    212
      Makefile
  2. 107
    107
      boards/PD_BUDDY/board.c
  3. 916
    916
      boards/PD_BUDDY/board.h
  4. 5
    5
      boards/PD_BUDDY/board.mk
  5. 499
    499
      chconf.h
  6. 381
    381
      halconf.h
  7. 247
    247
      mcuconf.h
  8. 65
    65
      src/main.c

+ 212
- 212
Makefile Näytä tiedosto

@@ -1,212 +1,212 @@
1
-##############################################################################
2
-# Build global options
3
-# NOTE: Can be overridden externally.
4
-#
5
-
6
-# Compiler options here.
7
-ifeq ($(USE_OPT),)
8
-  USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
9
-endif
10
-
11
-# C specific options here (added to USE_OPT).
12
-ifeq ($(USE_COPT),)
13
-  USE_COPT = 
14
-endif
15
-
16
-# C++ specific options here (added to USE_OPT).
17
-ifeq ($(USE_CPPOPT),)
18
-  USE_CPPOPT = -fno-rtti
19
-endif
20
-
21
-# Enable this if you want the linker to remove unused code and data
22
-ifeq ($(USE_LINK_GC),)
23
-  USE_LINK_GC = yes
24
-endif
25
-
26
-# Linker extra options here.
27
-ifeq ($(USE_LDOPT),)
28
-  USE_LDOPT = 
29
-endif
30
-
31
-# Enable this if you want link time optimizations (LTO)
32
-ifeq ($(USE_LTO),)
33
-  USE_LTO = yes
34
-endif
35
-
36
-# If enabled, this option allows to compile the application in THUMB mode.
37
-ifeq ($(USE_THUMB),)
38
-  USE_THUMB = yes
39
-endif
40
-
41
-# Enable this if you want to see the full log while compiling.
42
-ifeq ($(USE_VERBOSE_COMPILE),)
43
-  USE_VERBOSE_COMPILE = no
44
-endif
45
-
46
-# If enabled, this option makes the build process faster by not compiling
47
-# modules not used in the current configuration.
48
-ifeq ($(USE_SMART_BUILD),)
49
-  USE_SMART_BUILD = yes
50
-endif
51
-
52
-#
53
-# Build global options
54
-##############################################################################
55
-
56
-##############################################################################
57
-# Architecture or project specific options
58
-#
59
-
60
-# Stack size to be allocated to the Cortex-M process stack. This stack is
61
-# the stack used by the main() thread.
62
-ifeq ($(USE_PROCESS_STACKSIZE),)
63
-  USE_PROCESS_STACKSIZE = 0x200
64
-endif
65
-
66
-# Stack size to the allocated to the Cortex-M main/exceptions stack. This
67
-# stack is used for processing interrupts and exceptions.
68
-ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
69
-  USE_EXCEPTIONS_STACKSIZE = 0x400
70
-endif
71
-
72
-#
73
-# Architecture or project specific options
74
-##############################################################################
75
-
76
-##############################################################################
77
-# Project, sources and paths
78
-#
79
-
80
-# Define project name here
81
-PROJECT = pd-buddy-firmware
82
-
83
-# Imported source files and paths
84
-CHIBIOS = ChibiOS
85
-# Startup files.
86
-include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_stm32f0xx.mk
87
-# HAL-OSAL files (optional).
88
-include $(CHIBIOS)/os/hal/hal.mk
89
-include $(CHIBIOS)/os/hal/ports/STM32/STM32F0xx/platform.mk
90
-include $(CHIBIOS)/../boards/PD_BUDDY/board.mk
91
-include $(CHIBIOS)/os/hal/osal/rt/osal.mk
92
-# RTOS files (optional).
93
-include $(CHIBIOS)/os/rt/rt.mk
94
-include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
95
-# Other files (optional).
96
-include $(CHIBIOS)/test/rt/test.mk
97
-
98
-# Define linker script file here
99
-LDSCRIPT= $(STARTUPLD)/STM32F072xB.ld
100
-
101
-# C sources that can be compiled in ARM or THUMB mode depending on the global
102
-# setting.
103
-CSRC = $(STARTUPSRC) \
104
-       $(KERNSRC) \
105
-       $(PORTSRC) \
106
-       $(OSALSRC) \
107
-       $(HALSRC) \
108
-       $(PLATFORMSRC) \
109
-       $(BOARDSRC) \
110
-       $(TESTSRC) \
111
-       $(wildcard src/*.c)
112
-
113
-# C++ sources that can be compiled in ARM or THUMB mode depending on the global
114
-# setting.
115
-CPPSRC =
116
-
117
-# C sources to be compiled in ARM mode regardless of the global setting.
118
-# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
119
-#       option that results in lower performance and larger code size.
120
-ACSRC =
121
-
122
-# C++ sources to be compiled in ARM mode regardless of the global setting.
123
-# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
124
-#       option that results in lower performance and larger code size.
125
-ACPPSRC =
126
-
127
-# C sources to be compiled in THUMB mode regardless of the global setting.
128
-# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
129
-#       option that results in lower performance and larger code size.
130
-TCSRC =
131
-
132
-# C sources to be compiled in THUMB mode regardless of the global setting.
133
-# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
134
-#       option that results in lower performance and larger code size.
135
-TCPPSRC =
136
-
137
-# List ASM source files here
138
-ASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
139
-
140
-INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
141
-         $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
142
-         $(CHIBIOS)/os/various \
143
-	 config
144
-
145
-#
146
-# Project, sources and paths
147
-##############################################################################
148
-
149
-##############################################################################
150
-# Compiler settings
151
-#
152
-
153
-MCU  = cortex-m0
154
-
155
-#TRGT = arm-elf-
156
-TRGT = arm-none-eabi-
157
-CC   = $(TRGT)gcc
158
-CPPC = $(TRGT)g++
159
-# Enable loading with g++ only if you need C++ runtime support.
160
-# NOTE: You can use C++ even without C++ support if you are careful. C++
161
-#       runtime support makes code size explode.
162
-LD   = $(TRGT)gcc
163
-#LD   = $(TRGT)g++
164
-CP   = $(TRGT)objcopy
165
-AS   = $(TRGT)gcc -x assembler-with-cpp
166
-AR   = $(TRGT)ar
167
-OD   = $(TRGT)objdump
168
-SZ   = $(TRGT)size
169
-HEX  = $(CP) -O ihex
170
-BIN  = $(CP) -O binary
171
-
172
-# ARM-specific options here
173
-AOPT =
174
-
175
-# THUMB-specific options here
176
-TOPT = -mthumb -DTHUMB
177
-
178
-# Define C warning options here
179
-CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
180
-
181
-# Define C++ warning options here
182
-CPPWARN = -Wall -Wextra -Wundef
183
-
184
-#
185
-# Compiler settings
186
-##############################################################################
187
-
188
-##############################################################################
189
-# Start of user section
190
-#
191
-
192
-# List all user C define here, like -D_DEBUG=1
193
-UDEFS =
194
-
195
-# Define ASM defines here
196
-UADEFS =
197
-
198
-# List all user directories here
199
-UINCDIR =
200
-
201
-# List the user directory to look for the libraries here
202
-ULIBDIR =
203
-
204
-# List all user libraries here
205
-ULIBS =
206
-
207
-#
208
-# End of user defines
209
-##############################################################################
210
-
211
-RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
212
-include $(RULESPATH)/rules.mk
1
+##############################################################################
2
+# Build global options
3
+# NOTE: Can be overridden externally.
4
+#
5
+
6
+# Compiler options here.
7
+ifeq ($(USE_OPT),)
8
+  USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
9
+endif
10
+
11
+# C specific options here (added to USE_OPT).
12
+ifeq ($(USE_COPT),)
13
+  USE_COPT = 
14
+endif
15
+
16
+# C++ specific options here (added to USE_OPT).
17
+ifeq ($(USE_CPPOPT),)
18
+  USE_CPPOPT = -fno-rtti
19
+endif
20
+
21
+# Enable this if you want the linker to remove unused code and data
22
+ifeq ($(USE_LINK_GC),)
23
+  USE_LINK_GC = yes
24
+endif
25
+
26
+# Linker extra options here.
27
+ifeq ($(USE_LDOPT),)
28
+  USE_LDOPT = 
29
+endif
30
+
31
+# Enable this if you want link time optimizations (LTO)
32
+ifeq ($(USE_LTO),)
33
+  USE_LTO = yes
34
+endif
35
+
36
+# If enabled, this option allows to compile the application in THUMB mode.
37
+ifeq ($(USE_THUMB),)
38
+  USE_THUMB = yes
39
+endif
40
+
41
+# Enable this if you want to see the full log while compiling.
42
+ifeq ($(USE_VERBOSE_COMPILE),)
43
+  USE_VERBOSE_COMPILE = no
44
+endif
45
+
46
+# If enabled, this option makes the build process faster by not compiling
47
+# modules not used in the current configuration.
48
+ifeq ($(USE_SMART_BUILD),)
49
+  USE_SMART_BUILD = yes
50
+endif
51
+
52
+#
53
+# Build global options
54
+##############################################################################
55
+
56
+##############################################################################
57
+# Architecture or project specific options
58
+#
59
+
60
+# Stack size to be allocated to the Cortex-M process stack. This stack is
61
+# the stack used by the main() thread.
62
+ifeq ($(USE_PROCESS_STACKSIZE),)
63
+  USE_PROCESS_STACKSIZE = 0x200
64
+endif
65
+
66
+# Stack size to the allocated to the Cortex-M main/exceptions stack. This
67
+# stack is used for processing interrupts and exceptions.
68
+ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
69
+  USE_EXCEPTIONS_STACKSIZE = 0x400
70
+endif
71
+
72
+#
73
+# Architecture or project specific options
74
+##############################################################################
75
+
76
+##############################################################################
77
+# Project, sources and paths
78
+#
79
+
80
+# Define project name here
81
+PROJECT = pd-buddy-firmware
82
+
83
+# Imported source files and paths
84
+CHIBIOS = ChibiOS
85
+# Startup files.
86
+include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_stm32f0xx.mk
87
+# HAL-OSAL files (optional).
88
+include $(CHIBIOS)/os/hal/hal.mk
89
+include $(CHIBIOS)/os/hal/ports/STM32/STM32F0xx/platform.mk
90
+include $(CHIBIOS)/../boards/PD_BUDDY/board.mk
91
+include $(CHIBIOS)/os/hal/osal/rt/osal.mk
92
+# RTOS files (optional).
93
+include $(CHIBIOS)/os/rt/rt.mk
94
+include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
95
+# Other files (optional).
96
+include $(CHIBIOS)/test/rt/test.mk
97
+
98
+# Define linker script file here
99
+LDSCRIPT= $(STARTUPLD)/STM32F072xB.ld
100
+
101
+# C sources that can be compiled in ARM or THUMB mode depending on the global
102
+# setting.
103
+CSRC = $(STARTUPSRC) \
104
+       $(KERNSRC) \
105
+       $(PORTSRC) \
106
+       $(OSALSRC) \
107
+       $(HALSRC) \
108
+       $(PLATFORMSRC) \
109
+       $(BOARDSRC) \
110
+       $(TESTSRC) \
111
+       $(wildcard src/*.c)
112
+
113
+# C++ sources that can be compiled in ARM or THUMB mode depending on the global
114
+# setting.
115
+CPPSRC =
116
+
117
+# C sources to be compiled in ARM mode regardless of the global setting.
118
+# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
119
+#       option that results in lower performance and larger code size.
120
+ACSRC =
121
+
122
+# C++ sources to be compiled in ARM mode regardless of the global setting.
123
+# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
124
+#       option that results in lower performance and larger code size.
125
+ACPPSRC =
126
+
127
+# C sources to be compiled in THUMB mode regardless of the global setting.
128
+# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
129
+#       option that results in lower performance and larger code size.
130
+TCSRC =
131
+
132
+# C sources to be compiled in THUMB mode regardless of the global setting.
133
+# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
134
+#       option that results in lower performance and larger code size.
135
+TCPPSRC =
136
+
137
+# List ASM source files here
138
+ASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
139
+
140
+INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
141
+         $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
142
+         $(CHIBIOS)/os/various \
143
+	 config
144
+
145
+#
146
+# Project, sources and paths
147
+##############################################################################
148
+
149
+##############################################################################
150
+# Compiler settings
151
+#
152
+
153
+MCU  = cortex-m0
154
+
155
+#TRGT = arm-elf-
156
+TRGT = arm-none-eabi-
157
+CC   = $(TRGT)gcc
158
+CPPC = $(TRGT)g++
159
+# Enable loading with g++ only if you need C++ runtime support.
160
+# NOTE: You can use C++ even without C++ support if you are careful. C++
161
+#       runtime support makes code size explode.
162
+LD   = $(TRGT)gcc
163
+#LD   = $(TRGT)g++
164
+CP   = $(TRGT)objcopy
165
+AS   = $(TRGT)gcc -x assembler-with-cpp
166
+AR   = $(TRGT)ar
167
+OD   = $(TRGT)objdump
168
+SZ   = $(TRGT)size
169
+HEX  = $(CP) -O ihex
170
+BIN  = $(CP) -O binary
171
+
172
+# ARM-specific options here
173
+AOPT =
174
+
175
+# THUMB-specific options here
176
+TOPT = -mthumb -DTHUMB
177
+
178
+# Define C warning options here
179
+CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
180
+
181
+# Define C++ warning options here
182
+CPPWARN = -Wall -Wextra -Wundef
183
+
184
+#
185
+# Compiler settings
186
+##############################################################################
187
+
188
+##############################################################################
189
+# Start of user section
190
+#
191
+
192
+# List all user C define here, like -D_DEBUG=1
193
+UDEFS =
194
+
195
+# Define ASM defines here
196
+UADEFS =
197
+
198
+# List all user directories here
199
+UINCDIR =
200
+
201
+# List the user directory to look for the libraries here
202
+ULIBDIR =
203
+
204
+# List all user libraries here
205
+ULIBS =
206
+
207
+#
208
+# End of user defines
209
+##############################################################################
210
+
211
+RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
212
+include $(RULESPATH)/rules.mk

+ 107
- 107
boards/PD_BUDDY/board.c Näytä tiedosto

@@ -1,107 +1,107 @@
1
-/*
2
-    ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
3
-
4
-    Licensed under the Apache License, Version 2.0 (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
7
-
8
-        http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-    Unless required by applicable law or agreed to in writing, software
11
-    distributed under the License is distributed on an "AS IS" BASIS,
12
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-    See the License for the specific language governing permissions and
14
-    limitations under the License.
15
-*/
16
-
17
-/*
18
- * This file has been automatically generated using ChibiStudio board
19
- * generator plugin. Do not edit manually.
20
- */
21
-
22
-#include "hal.h"
23
-
24
-#if HAL_USE_PAL || defined(__DOXYGEN__)
25
-/**
26
- * @brief   PAL setup.
27
- * @details Digital I/O ports static configuration as defined in @p board.h.
28
- *          This variable is used by the HAL when initializing the PAL driver.
29
- */
30
-const PALConfig pal_default_config = {
31
-#if STM32_HAS_GPIOA
32
-  {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
33
-   VAL_GPIOA_ODR,   VAL_GPIOA_AFRL,   VAL_GPIOA_AFRH},
34
-#endif
35
-#if STM32_HAS_GPIOB
36
-  {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR,
37
-   VAL_GPIOB_ODR,   VAL_GPIOB_AFRL,   VAL_GPIOB_AFRH},
38
-#endif
39
-#if STM32_HAS_GPIOC
40
-  {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR,
41
-   VAL_GPIOC_ODR,   VAL_GPIOC_AFRL,   VAL_GPIOC_AFRH},
42
-#endif
43
-#if STM32_HAS_GPIOD
44
-  {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR,
45
-   VAL_GPIOD_ODR,   VAL_GPIOD_AFRL,   VAL_GPIOD_AFRH},
46
-#endif
47
-#if STM32_HAS_GPIOE
48
-  {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR,
49
-   VAL_GPIOE_ODR,   VAL_GPIOE_AFRL,   VAL_GPIOE_AFRH},
50
-#endif
51
-#if STM32_HAS_GPIOF
52
-  {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR,
53
-   VAL_GPIOF_ODR,   VAL_GPIOF_AFRL,   VAL_GPIOF_AFRH},
54
-#endif
55
-#if STM32_HAS_GPIOG
56
-  {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR,
57
-   VAL_GPIOG_ODR,   VAL_GPIOG_AFRL,   VAL_GPIOG_AFRH},
58
-#endif
59
-#if STM32_HAS_GPIOH
60
-  {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR,
61
-   VAL_GPIOH_ODR,   VAL_GPIOH_AFRL,   VAL_GPIOH_AFRH},
62
-#endif
63
-#if STM32_HAS_GPIOI
64
-  {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
65
-   VAL_GPIOI_ODR,   VAL_GPIOI_AFRL,   VAL_GPIOI_AFRH}
66
-#endif
67
-};
68
-#endif
69
-
70
-/**
71
- * @brief   Early initialization code.
72
- * @details This initialization must be performed just after stack setup
73
- *          and before any other initialization.
74
- */
75
-void __early_init(void) {
76
-
77
-  stm32_clock_init();
78
-}
79
-
80
-#if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
81
-/**
82
- * @brief   MMC_SPI card detection.
83
- */
84
-bool mmc_lld_is_card_inserted(MMCDriver *mmcp) {
85
-
86
-  (void)mmcp;
87
-  /* TODO: Fill the implementation.*/
88
-  return true;
89
-}
90
-
91
-/**
92
- * @brief   MMC_SPI card write protection detection.
93
- */
94
-bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
95
-
96
-  (void)mmcp;
97
-  /* TODO: Fill the implementation.*/
98
-  return false;
99
-}
100
-#endif
101
-
102
-/**
103
- * @brief   Board-specific initialization code.
104
- * @todo    Add your board-specific code, if any.
105
- */
106
-void boardInit(void) {
107
-}
1
+/*
2
+    ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
3
+
4
+    Licensed under the Apache License, Version 2.0 (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
7
+
8
+        http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+    Unless required by applicable law or agreed to in writing, software
11
+    distributed under the License is distributed on an "AS IS" BASIS,
12
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+    See the License for the specific language governing permissions and
14
+    limitations under the License.
15
+*/
16
+
17
+/*
18
+ * This file has been automatically generated using ChibiStudio board
19
+ * generator plugin. Do not edit manually.
20
+ */
21
+
22
+#include "hal.h"
23
+
24
+#if HAL_USE_PAL || defined(__DOXYGEN__)
25
+/**
26
+ * @brief   PAL setup.
27
+ * @details Digital I/O ports static configuration as defined in @p board.h.
28
+ *          This variable is used by the HAL when initializing the PAL driver.
29
+ */
30
+const PALConfig pal_default_config = {
31
+#if STM32_HAS_GPIOA
32
+  {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
33
+   VAL_GPIOA_ODR,   VAL_GPIOA_AFRL,   VAL_GPIOA_AFRH},
34
+#endif
35
+#if STM32_HAS_GPIOB
36
+  {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR,
37
+   VAL_GPIOB_ODR,   VAL_GPIOB_AFRL,   VAL_GPIOB_AFRH},
38
+#endif
39
+#if STM32_HAS_GPIOC
40
+  {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR,
41
+   VAL_GPIOC_ODR,   VAL_GPIOC_AFRL,   VAL_GPIOC_AFRH},
42
+#endif
43
+#if STM32_HAS_GPIOD
44
+  {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR,
45
+   VAL_GPIOD_ODR,   VAL_GPIOD_AFRL,   VAL_GPIOD_AFRH},
46
+#endif
47
+#if STM32_HAS_GPIOE
48
+  {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR,
49
+   VAL_GPIOE_ODR,   VAL_GPIOE_AFRL,   VAL_GPIOE_AFRH},
50
+#endif
51
+#if STM32_HAS_GPIOF
52
+  {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR,
53
+   VAL_GPIOF_ODR,   VAL_GPIOF_AFRL,   VAL_GPIOF_AFRH},
54
+#endif
55
+#if STM32_HAS_GPIOG
56
+  {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR,
57
+   VAL_GPIOG_ODR,   VAL_GPIOG_AFRL,   VAL_GPIOG_AFRH},
58
+#endif
59
+#if STM32_HAS_GPIOH
60
+  {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR,
61
+   VAL_GPIOH_ODR,   VAL_GPIOH_AFRL,   VAL_GPIOH_AFRH},
62
+#endif
63
+#if STM32_HAS_GPIOI
64
+  {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
65
+   VAL_GPIOI_ODR,   VAL_GPIOI_AFRL,   VAL_GPIOI_AFRH}
66
+#endif
67
+};
68
+#endif
69
+
70
+/**
71
+ * @brief   Early initialization code.
72
+ * @details This initialization must be performed just after stack setup
73
+ *          and before any other initialization.
74
+ */
75
+void __early_init(void) {
76
+
77
+  stm32_clock_init();
78
+}
79
+
80
+#if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
81
+/**
82
+ * @brief   MMC_SPI card detection.
83
+ */
84
+bool mmc_lld_is_card_inserted(MMCDriver *mmcp) {
85
+
86
+  (void)mmcp;
87
+  /* TODO: Fill the implementation.*/
88
+  return true;
89
+}
90
+
91
+/**
92
+ * @brief   MMC_SPI card write protection detection.
93
+ */
94
+bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
95
+
96
+  (void)mmcp;
97
+  /* TODO: Fill the implementation.*/
98
+  return false;
99
+}
100
+#endif
101
+
102
+/**
103
+ * @brief   Board-specific initialization code.
104
+ * @todo    Add your board-specific code, if any.
105
+ */
106
+void boardInit(void) {
107
+}

+ 916
- 916
boards/PD_BUDDY/board.h
File diff suppressed because it is too large
Näytä tiedosto


+ 5
- 5
boards/PD_BUDDY/board.mk Näytä tiedosto

@@ -1,5 +1,5 @@
1
-# List of all the board related files.
2
-BOARDSRC = $(CHIBIOS)/../boards/PD_BUDDY/board.c
3
-
4
-# Required include directories
5
-BOARDINC = $(CHIBIOS)/../boards/PD_BUDDY
1
+# List of all the board related files.
2
+BOARDSRC = $(CHIBIOS)/../boards/PD_BUDDY/board.c
3
+
4
+# Required include directories
5
+BOARDINC = $(CHIBIOS)/../boards/PD_BUDDY

+ 499
- 499
chconf.h
File diff suppressed because it is too large
Näytä tiedosto


+ 381
- 381
halconf.h Näytä tiedosto

@@ -1,381 +1,381 @@
1
-/*
2
-    ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3
-
4
-    Licensed under the Apache License, Version 2.0 (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
7
-
8
-        http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-    Unless required by applicable law or agreed to in writing, software
11
-    distributed under the License is distributed on an "AS IS" BASIS,
12
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-    See the License for the specific language governing permissions and
14
-    limitations under the License.
15
-*/
16
-
17
-/**
18
- * @file    templates/halconf.h
19
- * @brief   HAL configuration header.
20
- * @details HAL configuration file, this file allows to enable or disable the
21
- *          various device drivers from your application. You may also use
22
- *          this file in order to override the device drivers default settings.
23
- *
24
- * @addtogroup HAL_CONF
25
- * @{
26
- */
27
-
28
-#ifndef _HALCONF_H_
29
-#define _HALCONF_H_
30
-
31
-#include "mcuconf.h"
32
-
33
-/**
34
- * @brief   Enables the PAL subsystem.
35
- */
36
-#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
37
-#define HAL_USE_PAL                 TRUE
38
-#endif
39
-
40
-/**
41
- * @brief   Enables the ADC subsystem.
42
- */
43
-#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
44
-#define HAL_USE_ADC                 FALSE
45
-#endif
46
-
47
-/**
48
- * @brief   Enables the CAN subsystem.
49
- */
50
-#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
51
-#define HAL_USE_CAN                 FALSE
52
-#endif
53
-
54
-/**
55
- * @brief   Enables the DAC subsystem.
56
- */
57
-#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
58
-#define HAL_USE_DAC                 FALSE
59
-#endif
60
-
61
-/**
62
- * @brief   Enables the EXT subsystem.
63
- */
64
-#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
65
-#define HAL_USE_EXT                 FALSE
66
-#endif
67
-
68
-/**
69
- * @brief   Enables the GPT subsystem.
70
- */
71
-#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
72
-#define HAL_USE_GPT                 FALSE
73
-#endif
74
-
75
-/**
76
- * @brief   Enables the I2C subsystem.
77
- */
78
-#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
79
-#define HAL_USE_I2C                 TRUE
80
-#endif
81
-
82
-/**
83
- * @brief   Enables the I2S subsystem.
84
- */
85
-#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
86
-#define HAL_USE_I2S                 FALSE
87
-#endif
88
-
89
-/**
90
- * @brief   Enables the ICU subsystem.
91
- */
92
-#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
93
-#define HAL_USE_ICU                 FALSE
94
-#endif
95
-
96
-/**
97
- * @brief   Enables the MAC subsystem.
98
- */
99
-#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
100
-#define HAL_USE_MAC                 FALSE
101
-#endif
102
-
103
-/**
104
- * @brief   Enables the MMC_SPI subsystem.
105
- */
106
-#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
107
-#define HAL_USE_MMC_SPI             FALSE
108
-#endif
109
-
110
-/**
111
- * @brief   Enables the PWM subsystem.
112
- */
113
-#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
114
-#define HAL_USE_PWM                 FALSE
115
-#endif
116
-
117
-/**
118
- * @brief   Enables the RTC subsystem.
119
- */
120
-#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
121
-#define HAL_USE_RTC                 FALSE
122
-#endif
123
-
124
-/**
125
- * @brief   Enables the SDC subsystem.
126
- */
127
-#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
128
-#define HAL_USE_SDC                 FALSE
129
-#endif
130
-
131
-/**
132
- * @brief   Enables the SERIAL subsystem.
133
- */
134
-#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
135
-#define HAL_USE_SERIAL              FALSE
136
-#endif
137
-
138
-/**
139
- * @brief   Enables the SERIAL over USB subsystem.
140
- */
141
-#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
142
-#define HAL_USE_SERIAL_USB          FALSE
143
-#endif
144
-
145
-/**
146
- * @brief   Enables the SPI subsystem.
147
- */
148
-#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
149
-#define HAL_USE_SPI                 FALSE
150
-#endif
151
-
152
-/**
153
- * @brief   Enables the UART subsystem.
154
- */
155
-#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
156
-#define HAL_USE_UART                FALSE
157
-#endif
158
-
159
-/**
160
- * @brief   Enables the USB subsystem.
161
- */
162
-#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
163
-#define HAL_USE_USB                 FALSE
164
-#endif
165
-
166
-/**
167
- * @brief   Enables the WDG subsystem.
168
- */
169
-#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
170
-#define HAL_USE_WDG                 FALSE
171
-#endif
172
-
173
-/*===========================================================================*/
174
-/* ADC driver related settings.                                              */
175
-/*===========================================================================*/
176
-
177
-/**
178
- * @brief   Enables synchronous APIs.
179
- * @note    Disabling this option saves both code and data space.
180
- */
181
-#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
182
-#define ADC_USE_WAIT                TRUE
183
-#endif
184
-
185
-/**
186
- * @brief   Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
187
- * @note    Disabling this option saves both code and data space.
188
- */
189
-#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
190
-#define ADC_USE_MUTUAL_EXCLUSION    TRUE
191
-#endif
192
-
193
-/*===========================================================================*/
194
-/* CAN driver related settings.                                              */
195
-/*===========================================================================*/
196
-
197
-/**
198
- * @brief   Sleep mode related APIs inclusion switch.
199
- */
200
-#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
201
-#define CAN_USE_SLEEP_MODE          TRUE
202
-#endif
203
-
204
-/*===========================================================================*/
205
-/* I2C driver related settings.                                              */
206
-/*===========================================================================*/
207
-
208
-/**
209
- * @brief   Enables the mutual exclusion APIs on the I2C bus.
210
- */
211
-#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
212
-#define I2C_USE_MUTUAL_EXCLUSION    TRUE
213
-#endif
214
-
215
-/*===========================================================================*/
216
-/* MAC driver related settings.                                              */
217
-/*===========================================================================*/
218
-
219
-/**
220
- * @brief   Enables an event sources for incoming packets.
221
- */
222
-#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
223
-#define MAC_USE_ZERO_COPY           FALSE
224
-#endif
225
-
226
-/**
227
- * @brief   Enables an event sources for incoming packets.
228
- */
229
-#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
230
-#define MAC_USE_EVENTS              TRUE
231
-#endif
232
-
233
-/*===========================================================================*/
234
-/* MMC_SPI driver related settings.                                          */
235
-/*===========================================================================*/
236
-
237
-/**
238
- * @brief   Delays insertions.
239
- * @details If enabled this options inserts delays into the MMC waiting
240
- *          routines releasing some extra CPU time for the threads with
241
- *          lower priority, this may slow down the driver a bit however.
242
- *          This option is recommended also if the SPI driver does not
243
- *          use a DMA channel and heavily loads the CPU.
244
- */
245
-#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
246
-#define MMC_NICE_WAITING            TRUE
247
-#endif
248
-
249
-/*===========================================================================*/
250
-/* SDC driver related settings.                                              */
251
-/*===========================================================================*/
252
-
253
-/**
254
- * @brief   Number of initialization attempts before rejecting the card.
255
- * @note    Attempts are performed at 10mS intervals.
256
- */
257
-#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
258
-#define SDC_INIT_RETRY              100
259
-#endif
260
-
261
-/**
262
- * @brief   Include support for MMC cards.
263
- * @note    MMC support is not yet implemented so this option must be kept
264
- *          at @p FALSE.
265
- */
266
-#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
267
-#define SDC_MMC_SUPPORT             FALSE
268
-#endif
269
-
270
-/**
271
- * @brief   Delays insertions.
272
- * @details If enabled this options inserts delays into the MMC waiting
273
- *          routines releasing some extra CPU time for the threads with
274
- *          lower priority, this may slow down the driver a bit however.
275
- */
276
-#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
277
-#define SDC_NICE_WAITING            TRUE
278
-#endif
279
-
280
-/*===========================================================================*/
281
-/* SERIAL driver related settings.                                           */
282
-/*===========================================================================*/
283
-
284
-/**
285
- * @brief   Default bit rate.
286
- * @details Configuration parameter, this is the baud rate selected for the
287
- *          default configuration.
288
- */
289
-#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
290
-#define SERIAL_DEFAULT_BITRATE      38400
291
-#endif
292
-
293
-/**
294
- * @brief   Serial buffers size.
295
- * @details Configuration parameter, you can change the depth of the queue
296
- *          buffers depending on the requirements of your application.
297
- * @note    The default is 16 bytes for both the transmission and receive
298
- *          buffers.
299
- */
300
-#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
301
-#define SERIAL_BUFFERS_SIZE         16
302
-#endif
303
-
304
-/*===========================================================================*/
305
-/* SERIAL_USB driver related setting.                                        */
306
-/*===========================================================================*/
307
-
308
-/**
309
- * @brief   Serial over USB buffers size.
310
- * @details Configuration parameter, the buffer size must be a multiple of
311
- *          the USB data endpoint maximum packet size.
312
- * @note    The default is 256 bytes for both the transmission and receive
313
- *          buffers.
314
- */
315
-#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
316
-#define SERIAL_USB_BUFFERS_SIZE     256
317
-#endif
318
-
319
-/**
320
- * @brief   Serial over USB number of buffers.
321
- * @note    The default is 2 buffers.
322
- */
323
-#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
324
-#define SERIAL_USB_BUFFERS_NUMBER   2
325
-#endif
326
-
327
-/*===========================================================================*/
328
-/* SPI driver related settings.                                              */
329
-/*===========================================================================*/
330
-
331
-/**
332
- * @brief   Enables synchronous APIs.
333
- * @note    Disabling this option saves both code and data space.
334
- */
335
-#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
336
-#define SPI_USE_WAIT                TRUE
337
-#endif
338
-
339
-/**
340
- * @brief   Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
341
- * @note    Disabling this option saves both code and data space.
342
- */
343
-#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
344
-#define SPI_USE_MUTUAL_EXCLUSION    TRUE
345
-#endif
346
-
347
-/*===========================================================================*/
348
-/* UART driver related settings.                                             */
349
-/*===========================================================================*/
350
-
351
-/**
352
- * @brief   Enables synchronous APIs.
353
- * @note    Disabling this option saves both code and data space.
354
- */
355
-#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
356
-#define UART_USE_WAIT               FALSE
357
-#endif
358
-
359
-/**
360
- * @brief   Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
361
- * @note    Disabling this option saves both code and data space.
362
- */
363
-#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
364
-#define UART_USE_MUTUAL_EXCLUSION   FALSE
365
-#endif
366
-
367
-/*===========================================================================*/
368
-/* USB driver related settings.                                              */
369
-/*===========================================================================*/
370
-
371
-/**
372
- * @brief   Enables synchronous APIs.
373
- * @note    Disabling this option saves both code and data space.
374
- */
375
-#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
376
-#define USB_USE_WAIT                FALSE
377
-#endif
378
-
379
-#endif /* _HALCONF_H_ */
380
-
381
-/** @} */
1
+/*
2
+    ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3
+
4
+    Licensed under the Apache License, Version 2.0 (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
7
+
8
+        http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+    Unless required by applicable law or agreed to in writing, software
11
+    distributed under the License is distributed on an "AS IS" BASIS,
12
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+    See the License for the specific language governing permissions and
14
+    limitations under the License.
15
+*/
16
+
17
+/**
18
+ * @file    templates/halconf.h
19
+ * @brief   HAL configuration header.
20
+ * @details HAL configuration file, this file allows to enable or disable the
21
+ *          various device drivers from your application. You may also use
22
+ *          this file in order to override the device drivers default settings.
23
+ *
24
+ * @addtogroup HAL_CONF
25
+ * @{
26
+ */
27
+
28
+#ifndef _HALCONF_H_
29
+#define _HALCONF_H_
30
+
31
+#include "mcuconf.h"
32
+
33
+/**
34
+ * @brief   Enables the PAL subsystem.
35
+ */
36
+#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
37
+#define HAL_USE_PAL                 TRUE
38
+#endif
39
+
40
+/**
41
+ * @brief   Enables the ADC subsystem.
42
+ */
43
+#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
44
+#define HAL_USE_ADC                 FALSE
45
+#endif
46
+
47
+/**
48
+ * @brief   Enables the CAN subsystem.
49
+ */
50
+#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
51
+#define HAL_USE_CAN                 FALSE
52
+#endif
53
+
54
+/**
55
+ * @brief   Enables the DAC subsystem.
56
+ */
57
+#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
58
+#define HAL_USE_DAC                 FALSE
59
+#endif
60
+
61
+/**
62
+ * @brief   Enables the EXT subsystem.
63
+ */
64
+#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
65
+#define HAL_USE_EXT                 FALSE
66
+#endif
67
+
68
+/**
69
+ * @brief   Enables the GPT subsystem.
70
+ */
71
+#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
72
+#define HAL_USE_GPT                 FALSE
73
+#endif
74
+
75
+/**
76
+ * @brief   Enables the I2C subsystem.
77
+ */
78
+#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
79
+#define HAL_USE_I2C                 TRUE
80
+#endif
81
+
82
+/**
83
+ * @brief   Enables the I2S subsystem.
84
+ */
85
+#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
86
+#define HAL_USE_I2S                 FALSE
87
+#endif
88
+
89
+/**
90
+ * @brief   Enables the ICU subsystem.
91
+ */
92
+#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
93
+#define HAL_USE_ICU                 FALSE
94
+#endif
95
+
96
+/**
97
+ * @brief   Enables the MAC subsystem.
98
+ */
99
+#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
100
+#define HAL_USE_MAC                 FALSE
101
+#endif
102
+
103
+/**
104
+ * @brief   Enables the MMC_SPI subsystem.
105
+ */
106
+#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
107
+#define HAL_USE_MMC_SPI             FALSE
108
+#endif
109
+
110
+/**
111
+ * @brief   Enables the PWM subsystem.
112
+ */
113
+#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
114
+#define HAL_USE_PWM                 FALSE
115
+#endif
116
+
117
+/**
118
+ * @brief   Enables the RTC subsystem.
119
+ */
120
+#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
121
+#define HAL_USE_RTC                 FALSE
122
+#endif
123
+
124
+/**
125
+ * @brief   Enables the SDC subsystem.
126
+ */
127
+#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
128
+#define HAL_USE_SDC                 FALSE
129
+#endif
130
+
131
+/**
132
+ * @brief   Enables the SERIAL subsystem.
133
+ */
134
+#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
135
+#define HAL_USE_SERIAL              FALSE
136
+#endif
137
+
138
+/**
139
+ * @brief   Enables the SERIAL over USB subsystem.
140
+ */
141
+#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
142
+#define HAL_USE_SERIAL_USB          FALSE
143
+#endif
144
+
145
+/**
146
+ * @brief   Enables the SPI subsystem.
147
+ */
148
+#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
149
+#define HAL_USE_SPI                 FALSE
150
+#endif
151
+
152
+/**
153
+ * @brief   Enables the UART subsystem.
154
+ */
155
+#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
156
+#define HAL_USE_UART                FALSE
157
+#endif
158
+
159
+/**
160
+ * @brief   Enables the USB subsystem.
161
+ */
162
+#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
163
+#define HAL_USE_USB                 FALSE
164
+#endif
165
+
166
+/**
167
+ * @brief   Enables the WDG subsystem.
168
+ */
169
+#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
170
+#define HAL_USE_WDG                 FALSE
171
+#endif
172
+
173
+/*===========================================================================*/
174
+/* ADC driver related settings.                                              */
175
+/*===========================================================================*/
176
+
177
+/**
178
+ * @brief   Enables synchronous APIs.
179
+ * @note    Disabling this option saves both code and data space.
180
+ */
181
+#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
182
+#define ADC_USE_WAIT                TRUE
183
+#endif
184
+
185
+/**
186
+ * @brief   Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
187
+ * @note    Disabling this option saves both code and data space.
188
+ */
189
+#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
190
+#define ADC_USE_MUTUAL_EXCLUSION    TRUE
191
+#endif
192
+
193
+/*===========================================================================*/
194
+/* CAN driver related settings.                                              */
195
+/*===========================================================================*/
196
+
197
+/**
198
+ * @brief   Sleep mode related APIs inclusion switch.
199
+ */
200
+#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
201
+#define CAN_USE_SLEEP_MODE          TRUE
202
+#endif
203
+
204
+/*===========================================================================*/
205
+/* I2C driver related settings.                                              */
206
+/*===========================================================================*/
207
+
208
+/**
209
+ * @brief   Enables the mutual exclusion APIs on the I2C bus.
210
+ */
211
+#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
212
+#define I2C_USE_MUTUAL_EXCLUSION    TRUE
213
+#endif
214
+
215
+/*===========================================================================*/
216
+/* MAC driver related settings.                                              */
217
+/*===========================================================================*/
218
+
219
+/**
220
+ * @brief   Enables an event sources for incoming packets.
221
+ */
222
+#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
223
+#define MAC_USE_ZERO_COPY           FALSE
224
+#endif
225
+
226
+/**
227
+ * @brief   Enables an event sources for incoming packets.
228
+ */
229
+#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
230
+#define MAC_USE_EVENTS              TRUE
231
+#endif
232
+
233
+/*===========================================================================*/
234
+/* MMC_SPI driver related settings.                                          */
235
+/*===========================================================================*/
236
+
237
+/**
238
+ * @brief   Delays insertions.
239
+ * @details If enabled this options inserts delays into the MMC waiting
240
+ *          routines releasing some extra CPU time for the threads with
241
+ *          lower priority, this may slow down the driver a bit however.
242
+ *          This option is recommended also if the SPI driver does not
243
+ *          use a DMA channel and heavily loads the CPU.
244
+ */
245
+#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
246
+#define MMC_NICE_WAITING            TRUE
247
+#endif
248
+
249
+/*===========================================================================*/
250
+/* SDC driver related settings.                                              */
251
+/*===========================================================================*/
252
+
253
+/**
254
+ * @brief   Number of initialization attempts before rejecting the card.
255
+ * @note    Attempts are performed at 10mS intervals.
256
+ */
257
+#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
258
+#define SDC_INIT_RETRY              100
259
+#endif
260
+
261
+/**
262
+ * @brief   Include support for MMC cards.
263
+ * @note    MMC support is not yet implemented so this option must be kept
264
+ *          at @p FALSE.
265
+ */
266
+#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
267
+#define SDC_MMC_SUPPORT             FALSE
268
+#endif
269
+
270
+/**
271
+ * @brief   Delays insertions.
272
+ * @details If enabled this options inserts delays into the MMC waiting
273
+ *          routines releasing some extra CPU time for the threads with
274
+ *          lower priority, this may slow down the driver a bit however.
275
+ */
276
+#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
277
+#define SDC_NICE_WAITING            TRUE
278
+#endif
279
+
280
+/*===========================================================================*/
281
+/* SERIAL driver related settings.                                           */
282
+/*===========================================================================*/
283
+
284
+/**
285
+ * @brief   Default bit rate.
286
+ * @details Configuration parameter, this is the baud rate selected for the
287
+ *          default configuration.
288
+ */
289
+#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
290
+#define SERIAL_DEFAULT_BITRATE      38400
291
+#endif
292
+
293
+/**
294
+ * @brief   Serial buffers size.
295
+ * @details Configuration parameter, you can change the depth of the queue
296
+ *          buffers depending on the requirements of your application.
297
+ * @note    The default is 16 bytes for both the transmission and receive
298
+ *          buffers.
299
+ */
300
+#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
301
+#define SERIAL_BUFFERS_SIZE         16
302
+#endif
303
+
304
+/*===========================================================================*/
305
+/* SERIAL_USB driver related setting.                                        */
306
+/*===========================================================================*/
307
+
308
+/**
309
+ * @brief   Serial over USB buffers size.
310
+ * @details Configuration parameter, the buffer size must be a multiple of
311
+ *          the USB data endpoint maximum packet size.
312
+ * @note    The default is 256 bytes for both the transmission and receive
313
+ *          buffers.
314
+ */
315
+#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
316
+#define SERIAL_USB_BUFFERS_SIZE     256
317
+#endif
318
+
319
+/**
320
+ * @brief   Serial over USB number of buffers.
321
+ * @note    The default is 2 buffers.
322
+ */
323
+#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
324
+#define SERIAL_USB_BUFFERS_NUMBER   2
325
+#endif
326
+
327
+/*===========================================================================*/
328
+/* SPI driver related settings.                                              */
329
+/*===========================================================================*/
330
+
331
+/**
332
+ * @brief   Enables synchronous APIs.
333
+ * @note    Disabling this option saves both code and data space.
334
+ */
335
+#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
336
+#define SPI_USE_WAIT                TRUE
337
+#endif
338
+
339
+/**
340
+ * @brief   Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
341
+ * @note    Disabling this option saves both code and data space.
342
+ */
343
+#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
344
+#define SPI_USE_MUTUAL_EXCLUSION    TRUE
345
+#endif
346
+
347
+/*===========================================================================*/
348
+/* UART driver related settings.                                             */
349
+/*===========================================================================*/
350
+
351
+/**
352
+ * @brief   Enables synchronous APIs.
353
+ * @note    Disabling this option saves both code and data space.
354
+ */
355
+#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
356
+#define UART_USE_WAIT               FALSE
357
+#endif
358
+
359
+/**
360
+ * @brief   Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
361
+ * @note    Disabling this option saves both code and data space.
362
+ */
363
+#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
364
+#define UART_USE_MUTUAL_EXCLUSION   FALSE
365
+#endif
366
+
367
+/*===========================================================================*/
368
+/* USB driver related settings.                                              */
369
+/*===========================================================================*/
370
+
371
+/**
372
+ * @brief   Enables synchronous APIs.
373
+ * @note    Disabling this option saves both code and data space.
374
+ */
375
+#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
376
+#define USB_USE_WAIT                FALSE
377
+#endif
378
+
379
+#endif /* _HALCONF_H_ */
380
+
381
+/** @} */

+ 247
- 247
mcuconf.h Näytä tiedosto

@@ -1,247 +1,247 @@
1
-/*
2
-    ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3
-
4
-    Licensed under the Apache License, Version 2.0 (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
7
-
8
-        http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-    Unless required by applicable law or agreed to in writing, software
11
-    distributed under the License is distributed on an "AS IS" BASIS,
12
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-    See the License for the specific language governing permissions and
14
-    limitations under the License.
15
-*/
16
-
17
-#ifndef _MCUCONF_H_
18
-#define _MCUCONF_H_
19
-
20
-/*
21
- * STM32F0xx drivers configuration.
22
- * The following settings override the default settings present in
23
- * the various device driver implementation headers.
24
- * Note that the settings for each driver only have effect if the whole
25
- * driver is enabled in halconf.h.
26
- *
27
- * IRQ priorities:
28
- * 3...0       Lowest...Highest.
29
- *
30
- * DMA priorities:
31
- * 0...3        Lowest...Highest.
32
- */
33
-
34
-#define STM32F0xx_MCUCONF
35
-
36
-/*
37
- * HAL driver system settings.
38
- */
39
-#define STM32_NO_INIT                       FALSE
40
-#define STM32_PVD_ENABLE                    FALSE
41
-#define STM32_PLS                           STM32_PLS_LEV0
42
-#define STM32_HSI_ENABLED                   TRUE
43
-#define STM32_HSI14_ENABLED                 TRUE
44
-#define STM32_HSI48_ENABLED                 TRUE
45
-#define STM32_LSI_ENABLED                   TRUE
46
-#define STM32_HSE_ENABLED                   FALSE
47
-#define STM32_LSE_ENABLED                   FALSE
48
-#define STM32_SW                            STM32_SW_HSI48
49
-#define STM32_PLLSRC                        STM32_PLLSRC_HSI_DIV2
50
-#define STM32_PREDIV_VALUE                  1
51
-#define STM32_PLLMUL_VALUE                  12
52
-#define STM32_HPRE                          STM32_HPRE_DIV1
53
-#define STM32_PPRE                          STM32_PPRE_DIV1
54
-#define STM32_MCOSEL                        STM32_MCOSEL_NOCLOCK
55
-#define STM32_MCOPRE                        STM32_MCOPRE_DIV1
56
-#define STM32_PLLNODIV                      STM32_PLLNODIV_DIV2
57
-#define STM32_USBSW                         STM32_USBSW_HSI48
58
-#define STM32_CECSW                         STM32_CECSW_HSI
59
-#define STM32_I2C1SW                        STM32_I2C1SW_HSI
60
-#define STM32_USART1SW                      STM32_USART1SW_PCLK
61
-#define STM32_RTCSEL                        STM32_RTCSEL_LSI
62
-
63
-/*
64
- * ADC driver system settings.
65
- */
66
-#define STM32_ADC_USE_ADC1                  FALSE
67
-#define STM32_ADC_ADC1_CKMODE               STM32_ADC_CKMODE_ADCCLK
68
-#define STM32_ADC_ADC1_DMA_PRIORITY         2
69
-#define STM32_ADC_ADC1_DMA_IRQ_PRIORITY     2
70
-#define STM32_ADC_ADC1_DMA_STREAM           STM32_DMA_STREAM_ID(1, 1)
71
-
72
-/*
73
- * CAN driver system settings.
74
- */
75
-#define STM32_CAN_USE_CAN1                  FALSE
76
-#define STM32_CAN_CAN1_IRQ_PRIORITY         3
77
-
78
-/*
79
- * DAC driver system settings.
80
- */
81
-#define STM32_DAC_DUAL_MODE                 FALSE
82
-#define STM32_DAC_USE_DAC1_CH1              TRUE
83
-#define STM32_DAC_USE_DAC1_CH2              TRUE
84
-#define STM32_DAC_DAC1_CH1_IRQ_PRIORITY     10
85
-#define STM32_DAC_DAC1_CH2_IRQ_PRIORITY     10
86
-#define STM32_DAC_DAC1_CH1_DMA_PRIORITY     2
87
-#define STM32_DAC_DAC1_CH2_DMA_PRIORITY     2
88
-#define STM32_DAC_DAC1_CH1_DMA_STREAM       STM32_DMA_STREAM_ID(1, 3)
89
-#define STM32_DAC_DAC1_CH2_DMA_STREAM       STM32_DMA_STREAM_ID(1, 4)
90
-
91
-/*
92
- * EXT driver system settings.
93
- */
94
-#define STM32_EXT_EXTI0_1_IRQ_PRIORITY      3
95
-#define STM32_EXT_EXTI2_3_IRQ_PRIORITY      3
96
-#define STM32_EXT_EXTI4_15_IRQ_PRIORITY     3
97
-#define STM32_EXT_EXTI16_IRQ_PRIORITY       3
98
-#define STM32_EXT_EXTI17_20_IRQ_PRIORITY    3
99
-#define STM32_EXT_EXTI21_22_IRQ_PRIORITY    3
100
-
101
-/*
102
- * GPT driver system settings.
103
- */
104
-#define STM32_GPT_USE_TIM1                  FALSE
105
-#define STM32_GPT_USE_TIM2                  FALSE
106
-#define STM32_GPT_USE_TIM3                  FALSE
107
-#define STM32_GPT_USE_TIM6                  FALSE
108
-#define STM32_GPT_USE_TIM14                 FALSE
109
-#define STM32_GPT_TIM1_IRQ_PRIORITY         2
110
-#define STM32_GPT_TIM2_IRQ_PRIORITY         2
111
-#define STM32_GPT_TIM3_IRQ_PRIORITY         2
112
-#define STM32_GPT_TIM6_IRQ_PRIORITY         2
113
-#define STM32_GPT_TIM14_IRQ_PRIORITY        2
114
-
115
-/*
116
- * I2C driver system settings.
117
- */
118
-#define STM32_I2C_USE_I2C1                  FALSE
119
-#define STM32_I2C_USE_I2C2                  TRUE
120
-#define STM32_I2C_BUSY_TIMEOUT              50
121
-#define STM32_I2C_I2C1_IRQ_PRIORITY         3
122
-#define STM32_I2C_I2C2_IRQ_PRIORITY         3
123
-#define STM32_I2C_USE_DMA                   TRUE
124
-#define STM32_I2C_I2C1_DMA_PRIORITY         1
125
-#define STM32_I2C_I2C2_DMA_PRIORITY         1
126
-#define STM32_I2C_I2C1_RX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 3)
127
-#define STM32_I2C_I2C1_TX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 2)
128
-#define STM32_I2C_I2C2_RX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 5)
129
-#define STM32_I2C_I2C2_TX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 4)
130
-#define STM32_I2C_DMA_ERROR_HOOK(i2cp)      osalSysHalt("DMA failure")
131
-
132
-/*
133
- * I2S driver system settings.
134
- */
135
-#define STM32_I2S_USE_SPI1                  FALSE
136
-#define STM32_I2S_USE_SPI2                  FALSE
137
-#define STM32_I2S_SPI1_MODE                 (STM32_I2S_MODE_MASTER |        \
138
-                                             STM32_I2S_MODE_RX)
139
-#define STM32_I2S_SPI2_MODE                 (STM32_I2S_MODE_MASTER |        \
140
-                                             STM32_I2S_MODE_RX)
141
-#define STM32_I2S_SPI1_IRQ_PRIORITY         2
142
-#define STM32_I2S_SPI2_IRQ_PRIORITY         2
143
-#define STM32_I2S_SPI1_DMA_PRIORITY         1
144
-#define STM32_I2S_SPI2_DMA_PRIORITY         1
145
-#define STM32_I2S_SPI1_RX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 2)
146
-#define STM32_I2S_SPI1_TX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 3)
147
-#define STM32_I2S_SPI2_RX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 4)
148
-#define STM32_I2S_SPI2_TX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 5)
149
-#define STM32_I2S_DMA_ERROR_HOOK(i2sp)      osalSysHalt("DMA failure")
150
-
151
-/*
152
- * I2S driver system settings.
153
- */
154
-#define STM32_I2S_USE_SPI1                  FALSE
155
-#define STM32_I2S_USE_SPI2                  FALSE
156
-#define STM32_I2S_SPI1_MODE                 (STM32_I2S_MODE_MASTER |        \
157
-                                             STM32_I2S_MODE_RX)
158
-#define STM32_I2S_SPI2_MODE                 (STM32_I2S_MODE_MASTER |        \
159
-                                             STM32_I2S_MODE_RX)
160
-#define STM32_I2S_SPI1_IRQ_PRIORITY         2
161
-#define STM32_I2S_SPI2_IRQ_PRIORITY         2
162
-#define STM32_I2S_SPI1_DMA_PRIORITY         1
163
-#define STM32_I2S_SPI2_DMA_PRIORITY         1
164
-#define STM32_I2S_SPI1_RX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 2)
165
-#define STM32_I2S_SPI1_TX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 3)
166
-#define STM32_I2S_SPI2_RX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 4)
167
-#define STM32_I2S_SPI2_TX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 5)
168
-#define STM32_I2S_DMA_ERROR_HOOK(i2sp)      osalSysHalt("DMA failure")
169
-
170
-/*
171
- * ICU driver system settings.
172
- */
173
-#define STM32_ICU_USE_TIM1                  FALSE
174
-#define STM32_ICU_USE_TIM2                  FALSE
175
-#define STM32_ICU_USE_TIM3                  FALSE
176
-#define STM32_ICU_TIM1_IRQ_PRIORITY         3
177
-#define STM32_ICU_TIM2_IRQ_PRIORITY         3
178
-#define STM32_ICU_TIM3_IRQ_PRIORITY         3
179
-
180
-/*
181
- * PWM driver system settings.
182
- */
183
-#define STM32_PWM_USE_ADVANCED              FALSE
184
-#define STM32_PWM_USE_TIM1                  FALSE
185
-#define STM32_PWM_USE_TIM2                  FALSE
186
-#define STM32_PWM_USE_TIM3                  FALSE
187
-#define STM32_PWM_TIM1_IRQ_PRIORITY         3
188
-#define STM32_PWM_TIM2_IRQ_PRIORITY         3
189
-#define STM32_PWM_TIM3_IRQ_PRIORITY         3
190
-
191
-/*
192
- * SERIAL driver system settings.
193
- */
194
-#define STM32_SERIAL_USE_USART1             TRUE
195
-#define STM32_SERIAL_USE_USART2             FALSE
196
-#define STM32_SERIAL_USART1_PRIORITY        3
197
-#define STM32_SERIAL_USART2_PRIORITY        3
198
-
199
-/*
200
- * SPI driver system settings.
201
- */
202
-#define STM32_SPI_USE_SPI1                  FALSE
203
-#define STM32_SPI_USE_SPI2                  FALSE
204
-#define STM32_SPI_SPI1_DMA_PRIORITY         1
205
-#define STM32_SPI_SPI2_DMA_PRIORITY         1
206
-#define STM32_SPI_SPI1_IRQ_PRIORITY         2
207
-#define STM32_SPI_SPI2_IRQ_PRIORITY         2
208
-#define STM32_SPI_SPI1_RX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 2)
209
-#define STM32_SPI_SPI1_TX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 3)
210
-#define STM32_SPI_SPI2_RX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 4)
211
-#define STM32_SPI_SPI2_TX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 5)
212
-#define STM32_SPI_DMA_ERROR_HOOK(spip)      osalSysHalt("DMA failure")
213
-
214
-/*
215
- * ST driver system settings.
216
- */
217
-#define STM32_ST_IRQ_PRIORITY               2
218
-#define STM32_ST_USE_TIMER                  2
219
-
220
-/*
221
- * UART driver system settings.
222
- */
223
-#define STM32_UART_USE_USART1               FALSE
224
-#define STM32_UART_USE_USART2               FALSE
225
-#define STM32_UART_USART1_IRQ_PRIORITY      3
226
-#define STM32_UART_USART2_IRQ_PRIORITY      3
227
-#define STM32_UART_USART1_DMA_PRIORITY      0
228
-#define STM32_UART_USART2_DMA_PRIORITY      0
229
-#define STM32_UART_USART1_RX_DMA_STREAM     STM32_DMA_STREAM_ID(1, 3)
230
-#define STM32_UART_USART1_TX_DMA_STREAM     STM32_DMA_STREAM_ID(1, 2)
231
-#define STM32_UART_USART2_RX_DMA_STREAM     STM32_DMA_STREAM_ID(1, 5)
232
-#define STM32_UART_USART2_TX_DMA_STREAM     STM32_DMA_STREAM_ID(1, 4)
233
-#define STM32_UART_DMA_ERROR_HOOK(uartp)    osalSysHalt("DMA failure")
234
-
235
-/*
236
- * USB driver system settings.
237
- */
238
-#define STM32_USB_USE_USB1                  FALSE
239
-#define STM32_USB_LOW_POWER_ON_SUSPEND      FALSE
240
-#define STM32_USB_USB1_LP_IRQ_PRIORITY      3
241
-
242
-/*
243
- * WDG driver system settings.
244
- */
245
-#define STM32_WDG_USE_IWDG                  FALSE
246
-
247
-#endif /* _MCUCONF_H_ */
1
+/*
2
+    ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3
+
4
+    Licensed under the Apache License, Version 2.0 (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
7
+
8
+        http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+    Unless required by applicable law or agreed to in writing, software
11
+    distributed under the License is distributed on an "AS IS" BASIS,
12
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+    See the License for the specific language governing permissions and
14
+    limitations under the License.
15
+*/
16
+
17
+#ifndef _MCUCONF_H_
18
+#define _MCUCONF_H_
19
+
20
+/*
21
+ * STM32F0xx drivers configuration.
22
+ * The following settings override the default settings present in
23
+ * the various device driver implementation headers.
24
+ * Note that the settings for each driver only have effect if the whole
25
+ * driver is enabled in halconf.h.
26
+ *
27
+ * IRQ priorities:
28
+ * 3...0       Lowest...Highest.
29
+ *
30
+ * DMA priorities:
31
+ * 0...3        Lowest...Highest.
32
+ */
33
+
34
+#define STM32F0xx_MCUCONF
35
+
36
+/*
37
+ * HAL driver system settings.
38
+ */
39
+#define STM32_NO_INIT                       FALSE
40
+#define STM32_PVD_ENABLE                    FALSE
41
+#define STM32_PLS                           STM32_PLS_LEV0
42
+#define STM32_HSI_ENABLED                   TRUE
43
+#define STM32_HSI14_ENABLED                 TRUE
44
+#define STM32_HSI48_ENABLED                 TRUE
45
+#define STM32_LSI_ENABLED                   TRUE
46
+#define STM32_HSE_ENABLED                   FALSE
47
+#define STM32_LSE_ENABLED                   FALSE
48
+#define STM32_SW                            STM32_SW_HSI48
49
+#define STM32_PLLSRC                        STM32_PLLSRC_HSI_DIV2
50
+#define STM32_PREDIV_VALUE                  1
51
+#define STM32_PLLMUL_VALUE                  12
52
+#define STM32_HPRE                          STM32_HPRE_DIV1
53
+#define STM32_PPRE                          STM32_PPRE_DIV1
54
+#define STM32_MCOSEL                        STM32_MCOSEL_NOCLOCK
55
+#define STM32_MCOPRE                        STM32_MCOPRE_DIV1
56
+#define STM32_PLLNODIV                      STM32_PLLNODIV_DIV2
57
+#define STM32_USBSW                         STM32_USBSW_HSI48
58
+#define STM32_CECSW                         STM32_CECSW_HSI
59
+#define STM32_I2C1SW                        STM32_I2C1SW_HSI
60
+#define STM32_USART1SW                      STM32_USART1SW_PCLK
61
+#define STM32_RTCSEL                        STM32_RTCSEL_LSI
62
+
63
+/*
64
+ * ADC driver system settings.
65
+ */
66
+#define STM32_ADC_USE_ADC1                  FALSE
67
+#define STM32_ADC_ADC1_CKMODE               STM32_ADC_CKMODE_ADCCLK
68
+#define STM32_ADC_ADC1_DMA_PRIORITY         2
69
+#define STM32_ADC_ADC1_DMA_IRQ_PRIORITY     2
70
+#define STM32_ADC_ADC1_DMA_STREAM           STM32_DMA_STREAM_ID(1, 1)
71
+
72
+/*
73
+ * CAN driver system settings.
74
+ */
75
+#define STM32_CAN_USE_CAN1                  FALSE
76
+#define STM32_CAN_CAN1_IRQ_PRIORITY         3
77
+
78
+/*
79
+ * DAC driver system settings.
80
+ */
81
+#define STM32_DAC_DUAL_MODE                 FALSE
82
+#define STM32_DAC_USE_DAC1_CH1              TRUE
83
+#define STM32_DAC_USE_DAC1_CH2              TRUE
84
+#define STM32_DAC_DAC1_CH1_IRQ_PRIORITY     10
85
+#define STM32_DAC_DAC1_CH2_IRQ_PRIORITY     10
86
+#define STM32_DAC_DAC1_CH1_DMA_PRIORITY     2
87
+#define STM32_DAC_DAC1_CH2_DMA_PRIORITY     2
88
+#define STM32_DAC_DAC1_CH1_DMA_STREAM       STM32_DMA_STREAM_ID(1, 3)
89
+#define STM32_DAC_DAC1_CH2_DMA_STREAM       STM32_DMA_STREAM_ID(1, 4)
90
+
91
+/*
92
+ * EXT driver system settings.
93
+ */
94
+#define STM32_EXT_EXTI0_1_IRQ_PRIORITY      3
95
+#define STM32_EXT_EXTI2_3_IRQ_PRIORITY      3
96
+#define STM32_EXT_EXTI4_15_IRQ_PRIORITY     3
97
+#define STM32_EXT_EXTI16_IRQ_PRIORITY       3
98
+#define STM32_EXT_EXTI17_20_IRQ_PRIORITY    3
99
+#define STM32_EXT_EXTI21_22_IRQ_PRIORITY    3
100
+
101
+/*
102
+ * GPT driver system settings.
103
+ */
104
+#define STM32_GPT_USE_TIM1                  FALSE
105
+#define STM32_GPT_USE_TIM2                  FALSE
106
+#define STM32_GPT_USE_TIM3                  FALSE
107
+#define STM32_GPT_USE_TIM6                  FALSE
108
+#define STM32_GPT_USE_TIM14                 FALSE
109
+#define STM32_GPT_TIM1_IRQ_PRIORITY         2
110
+#define STM32_GPT_TIM2_IRQ_PRIORITY         2
111
+#define STM32_GPT_TIM3_IRQ_PRIORITY         2
112
+#define STM32_GPT_TIM6_IRQ_PRIORITY         2
113
+#define STM32_GPT_TIM14_IRQ_PRIORITY        2
114
+
115
+/*
116
+ * I2C driver system settings.
117
+ */
118
+#define STM32_I2C_USE_I2C1                  FALSE
119
+#define STM32_I2C_USE_I2C2                  TRUE
120
+#define STM32_I2C_BUSY_TIMEOUT              50
121
+#define STM32_I2C_I2C1_IRQ_PRIORITY         3
122
+#define STM32_I2C_I2C2_IRQ_PRIORITY         3
123
+#define STM32_I2C_USE_DMA                   TRUE
124
+#define STM32_I2C_I2C1_DMA_PRIORITY         1
125
+#define STM32_I2C_I2C2_DMA_PRIORITY         1
126
+#define STM32_I2C_I2C1_RX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 3)
127
+#define STM32_I2C_I2C1_TX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 2)
128
+#define STM32_I2C_I2C2_RX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 5)
129
+#define STM32_I2C_I2C2_TX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 4)
130
+#define STM32_I2C_DMA_ERROR_HOOK(i2cp)      osalSysHalt("DMA failure")
131
+
132
+/*
133
+ * I2S driver system settings.
134
+ */
135
+#define STM32_I2S_USE_SPI1                  FALSE
136
+#define STM32_I2S_USE_SPI2                  FALSE
137
+#define STM32_I2S_SPI1_MODE                 (STM32_I2S_MODE_MASTER |        \
138
+                                             STM32_I2S_MODE_RX)
139
+#define STM32_I2S_SPI2_MODE                 (STM32_I2S_MODE_MASTER |        \
140
+                                             STM32_I2S_MODE_RX)
141
+#define STM32_I2S_SPI1_IRQ_PRIORITY         2
142
+#define STM32_I2S_SPI2_IRQ_PRIORITY         2
143
+#define STM32_I2S_SPI1_DMA_PRIORITY         1
144
+#define STM32_I2S_SPI2_DMA_PRIORITY         1
145
+#define STM32_I2S_SPI1_RX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 2)
146
+#define STM32_I2S_SPI1_TX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 3)
147
+#define STM32_I2S_SPI2_RX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 4)
148
+#define STM32_I2S_SPI2_TX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 5)
149
+#define STM32_I2S_DMA_ERROR_HOOK(i2sp)      osalSysHalt("DMA failure")
150
+
151
+/*
152
+ * I2S driver system settings.
153
+ */
154
+#define STM32_I2S_USE_SPI1                  FALSE
155
+#define STM32_I2S_USE_SPI2                  FALSE
156
+#define STM32_I2S_SPI1_MODE                 (STM32_I2S_MODE_MASTER |        \
157
+                                             STM32_I2S_MODE_RX)
158
+#define STM32_I2S_SPI2_MODE                 (STM32_I2S_MODE_MASTER |        \
159
+                                             STM32_I2S_MODE_RX)
160
+#define STM32_I2S_SPI1_IRQ_PRIORITY         2
161
+#define STM32_I2S_SPI2_IRQ_PRIORITY         2
162
+#define STM32_I2S_SPI1_DMA_PRIORITY         1
163
+#define STM32_I2S_SPI2_DMA_PRIORITY         1
164
+#define STM32_I2S_SPI1_RX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 2)
165
+#define STM32_I2S_SPI1_TX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 3)
166
+#define STM32_I2S_SPI2_RX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 4)
167
+#define STM32_I2S_SPI2_TX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 5)
168
+#define STM32_I2S_DMA_ERROR_HOOK(i2sp)      osalSysHalt("DMA failure")
169
+
170
+/*
171
+ * ICU driver system settings.
172
+ */
173
+#define STM32_ICU_USE_TIM1                  FALSE
174
+#define STM32_ICU_USE_TIM2                  FALSE
175
+#define STM32_ICU_USE_TIM3                  FALSE
176
+#define STM32_ICU_TIM1_IRQ_PRIORITY         3
177
+#define STM32_ICU_TIM2_IRQ_PRIORITY         3
178
+#define STM32_ICU_TIM3_IRQ_PRIORITY         3
179
+
180
+/*
181
+ * PWM driver system settings.
182
+ */
183
+#define STM32_PWM_USE_ADVANCED              FALSE
184
+#define STM32_PWM_USE_TIM1                  FALSE
185
+#define STM32_PWM_USE_TIM2                  FALSE
186
+#define STM32_PWM_USE_TIM3                  FALSE
187
+#define STM32_PWM_TIM1_IRQ_PRIORITY         3
188
+#define STM32_PWM_TIM2_IRQ_PRIORITY         3
189
+#define STM32_PWM_TIM3_IRQ_PRIORITY         3
190
+
191
+/*
192
+ * SERIAL driver system settings.
193
+ */
194
+#define STM32_SERIAL_USE_USART1             TRUE
195
+#define STM32_SERIAL_USE_USART2             FALSE
196
+#define STM32_SERIAL_USART1_PRIORITY        3
197
+#define STM32_SERIAL_USART2_PRIORITY        3
198
+
199
+/*
200
+ * SPI driver system settings.
201
+ */
202
+#define STM32_SPI_USE_SPI1                  FALSE
203
+#define STM32_SPI_USE_SPI2                  FALSE
204
+#define STM32_SPI_SPI1_DMA_PRIORITY         1
205
+#define STM32_SPI_SPI2_DMA_PRIORITY         1
206
+#define STM32_SPI_SPI1_IRQ_PRIORITY         2
207
+#define STM32_SPI_SPI2_IRQ_PRIORITY         2
208
+#define STM32_SPI_SPI1_RX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 2)
209
+#define STM32_SPI_SPI1_TX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 3)
210
+#define STM32_SPI_SPI2_RX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 4)
211
+#define STM32_SPI_SPI2_TX_DMA_STREAM        STM32_DMA_STREAM_ID(1, 5)
212
+#define STM32_SPI_DMA_ERROR_HOOK(spip)      osalSysHalt("DMA failure")
213
+
214
+/*
215
+ * ST driver system settings.
216
+ */
217
+#define STM32_ST_IRQ_PRIORITY               2
218
+#define STM32_ST_USE_TIMER                  2
219
+
220
+/*
221
+ * UART driver system settings.
222
+ */
223
+#define STM32_UART_USE_USART1               FALSE
224
+#define STM32_UART_USE_USART2               FALSE
225
+#define STM32_UART_USART1_IRQ_PRIORITY      3
226
+#define STM32_UART_USART2_IRQ_PRIORITY      3
227
+#define STM32_UART_USART1_DMA_PRIORITY      0
228
+#define STM32_UART_USART2_DMA_PRIORITY      0
229
+#define STM32_UART_USART1_RX_DMA_STREAM     STM32_DMA_STREAM_ID(1, 3)
230
+#define STM32_UART_USART1_TX_DMA_STREAM     STM32_DMA_STREAM_ID(1, 2)
231
+#define STM32_UART_USART2_RX_DMA_STREAM     STM32_DMA_STREAM_ID(1, 5)
232
+#define STM32_UART_USART2_TX_DMA_STREAM     STM32_DMA_STREAM_ID(1, 4)
233
+#define STM32_UART_DMA_ERROR_HOOK(uartp)    osalSysHalt("DMA failure")
234
+
235
+/*
236
+ * USB driver system settings.
237
+ */
238
+#define STM32_USB_USE_USB1                  FALSE
239
+#define STM32_USB_LOW_POWER_ON_SUSPEND      FALSE
240
+#define STM32_USB_USB1_LP_IRQ_PRIORITY      3
241
+
242
+/*
243
+ * WDG driver system settings.
244
+ */
245
+#define STM32_WDG_USE_IWDG                  FALSE
246
+
247
+#endif /* _MCUCONF_H_ */

+ 65
- 65
src/main.c Näytä tiedosto

@@ -1,65 +1,65 @@
1
-/*
2
-    ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3
-
4
-    Licensed under the Apache License, Version 2.0 (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
7
-
8
-        http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-    Unless required by applicable law or agreed to in writing, software
11
-    distributed under the License is distributed on an "AS IS" BASIS,
12
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-    See the License for the specific language governing permissions and
14
-    limitations under the License.
15
-*/
16
-
17
-#include "ch.h"
18
-#include "hal.h"
19
-
20
-/*
21
- * LED blinker thread, times are in milliseconds.
22
- */
23
-static THD_WORKING_AREA(waThread1, 128);
24
-static THD_FUNCTION(Thread1, arg) {
25
-
26
-  (void)arg;
27
-//  chRegSetThreadName("blinker1");
28
-  while (true) {
29
-    palClearLine(LINE_LED);
30
-    chThdSleepMilliseconds(125);
31
-    palSetLine(LINE_LED);
32
-    chThdSleepMilliseconds(125);
33
-  }
34
-}
35
-
36
-/*
37
- * Application entry point.
38
- */
39
-int main(void) {
40
-
41
-  /*
42
-   * System initializations.
43
-   * - HAL initialization, this also initializes the configured device drivers
44
-   *   and performs the board-specific initializations.
45
-   * - Kernel initialization, the main() function becomes a thread and the
46
-   *   RTOS is active.
47
-   */
48
-  halInit();
49
-  chSysInit();
50
-
51
-  /*
52
-   * Creates the blinker thread.
53
-   */
54
-  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
55
-
56
-  /*
57
-   * Normal main() thread activity, in this demo it does nothing except
58
-   * sleeping in a loop and check the button state, when the button is
59
-   * pressed the test procedure is launched with output on the serial
60
-   * driver 1.
61
-   */
62
-  while (true) {
63
-    chThdSleepMilliseconds(500);
64
-  }
65
-}
1
+/*
2
+    ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3
+
4
+    Licensed under the Apache License, Version 2.0 (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
7
+
8
+        http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+    Unless required by applicable law or agreed to in writing, software
11
+    distributed under the License is distributed on an "AS IS" BASIS,
12
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+    See the License for the specific language governing permissions and
14
+    limitations under the License.
15
+*/
16
+
17
+#include "ch.h"
18
+#include "hal.h"
19
+
20
+/*
21
+ * LED blinker thread, times are in milliseconds.
22
+ */
23
+static THD_WORKING_AREA(waThread1, 128);
24
+static THD_FUNCTION(Thread1, arg) {
25
+
26
+  (void)arg;
27
+//  chRegSetThreadName("blinker1");
28
+  while (true) {
29
+    palClearLine(LINE_LED);
30
+    chThdSleepMilliseconds(125);
31
+    palSetLine(LINE_LED);
32
+    chThdSleepMilliseconds(125);
33
+  }
34
+}
35
+
36
+/*
37
+ * Application entry point.
38
+ */
39
+int main(void) {
40
+
41
+  /*
42
+   * System initializations.
43
+   * - HAL initialization, this also initializes the configured device drivers
44
+   *   and performs the board-specific initializations.
45
+   * - Kernel initialization, the main() function becomes a thread and the
46
+   *   RTOS is active.
47
+   */
48
+  halInit();
49
+  chSysInit();
50
+
51
+  /*
52
+   * Creates the blinker thread.
53
+   */
54
+  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
55
+
56
+  /*
57
+   * Normal main() thread activity, in this demo it does nothing except
58
+   * sleeping in a loop and check the button state, when the button is
59
+   * pressed the test procedure is launched with output on the serial
60
+   * driver 1.
61
+   */
62
+  while (true) {
63
+    chThdSleepMilliseconds(500);
64
+  }
65
+}

Loading…
Peruuta
Tallenna