Revision deaaa47e modules/NUCLEO-F103RB/module.h
modules/NUCLEO-F103RB/module.h | ||
---|---|---|
36 | 36 |
*/ |
37 | 37 |
/*===========================================================================*/ |
38 | 38 |
|
39 |
#ifdef AMIROLLD_CFG_DW1000 |
|
40 |
|
|
41 |
#ifdef __cplusplus |
|
42 |
extern "C" { |
|
43 |
#endif |
|
44 |
|
|
45 |
apalGpioState_t port_CheckEXT_IRQ(void) ; |
|
46 |
|
|
47 |
void dw1000_spi_init(void); |
|
48 |
|
|
49 |
void process_deca_irq(void); |
|
50 |
|
|
51 |
|
|
52 |
#ifdef __cplusplus |
|
53 |
} |
|
54 |
#endif |
|
55 |
|
|
56 |
#endif /* AMIROLLD_CFG_DW1000 */ |
|
57 |
|
|
58 |
|
|
39 | 59 |
/** @} */ |
40 | 60 |
|
41 | 61 |
/*===========================================================================*/ |
... | ... | |
60 | 80 |
*/ |
61 | 81 |
#define MODULE_HAL_RTC RTCD1 |
62 | 82 |
|
83 |
|
|
84 |
#ifdef AMIROLLD_CFG_DW1000 |
|
85 |
|
|
86 |
/** |
|
87 |
* @brief SPI interface driver for the motion sensors (gyroscope and accelerometer). |
|
88 |
*/ |
|
89 |
#define MODULE_HAL_SPI_UWB SPID2 |
|
90 |
|
|
91 |
|
|
92 |
/** |
|
93 |
* @brief Configuration for the SPI interface driver to communicate with the LED driver. |
|
94 |
*/ |
|
95 |
extern SPIConfig moduleHalSpiUwbHsConfig; |
|
96 |
|
|
97 |
/** |
|
98 |
* @brief Configuration for the SPI interface driver to communicate with the wireless transceiver. |
|
99 |
*/ |
|
100 |
extern SPIConfig moduleHalSpiUwbLsConfig; |
|
101 |
|
|
102 |
#endif /* AMIROLLD_CFG_DW1000 */ |
|
103 |
|
|
63 | 104 |
/** @} */ |
64 | 105 |
|
106 |
|
|
65 | 107 |
/*===========================================================================*/ |
66 | 108 |
/** |
67 | 109 |
* @name GPIO definitions |
... | ... | |
74 | 116 |
*/ |
75 | 117 |
extern ROMCONST apalControlGpio_t moduleGpioLed; |
76 | 118 |
|
119 |
#ifdef AMIROLLD_CFG_DW1000 |
|
120 |
/** |
|
121 |
* @brief DW1000 reset output signal |
|
122 |
* @note the reset pin should be drived as low by MCU to activate. |
|
123 |
* Then, put back the reset pin as input to MCU (tri-state float on the air |
|
124 |
* is not supported in AMiRo) |
|
125 |
*/ |
|
126 |
extern ROMCONST apalControlGpio_t moduleGpioDw1000Reset; |
|
127 |
|
|
128 |
/** |
|
129 |
* @brief DW1000 interrupt IRQn input signal. |
|
130 |
*/ |
|
131 |
extern ROMCONST apalControlGpio_t moduleGpioDw1000Irqn; |
|
132 |
|
|
133 |
/** |
|
134 |
* @brief DW1000 SPI chip select output signal. |
|
135 |
*/ |
|
136 |
extern ROMCONST apalControlGpio_t moduleGpioSpiChipSelect ; |
|
137 |
|
|
138 |
#endif /* AMIROLLD_CFG_DW1000 */ |
|
139 |
|
|
77 | 140 |
/** |
78 | 141 |
* @brief User button input signal. |
79 | 142 |
*/ |
... | ... | |
89 | 152 |
/*===========================================================================*/ |
90 | 153 |
|
91 | 154 |
/** |
155 |
* @brief Event flag to be call dwt_isr() interrupt. |
|
156 |
*/ |
|
157 |
#define MODULE_OS_IOEVENTFLAGS_DW1000_IRQn AOS_IOEVENT_FLAG(GPIOB_ARD_D6) |
|
158 |
|
|
159 |
/** |
|
92 | 160 |
* @brief Event flag to be set on a USER_BUTTON interrupt. |
93 | 161 |
*/ |
94 | 162 |
#define MODULE_OS_IOEVENTFLAGS_USERBUTTON AOS_IOEVENT_FLAG(GPIOC_BUTTON) |
95 | 163 |
|
164 |
|
|
96 | 165 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
97 | 166 |
/** |
98 | 167 |
* @brief Shell prompt text. |
... | ... | |
100 | 169 |
extern ROMCONST char* moduleShellPrompt; |
101 | 170 |
#endif |
102 | 171 |
|
172 |
|
|
103 | 173 |
/** |
104 | 174 |
* @brief Interrupt initialization macro. |
105 | 175 |
* @note SSSP related interrupt signals are already initialized in 'aos_system.c'. |
... | ... | |
108 | 178 |
/* user button */ \ |
109 | 179 |
palSetPadCallback(moduleGpioUserButton.gpio->port, moduleGpioUserButton.gpio->pad, _intCallback, &moduleGpioUserButton.gpio->pad); \ |
110 | 180 |
palEnablePadEvent(moduleGpioUserButton.gpio->port, moduleGpioUserButton.gpio->pad, APAL2CH_EDGE(moduleGpioUserButton.meta.edge)); \ |
181 |
MODULE_INIT_INTERRUPTS_DW1000(); \ |
|
111 | 182 |
} |
183 |
#ifdef AMIROLLD_CFG_DW1000 |
|
184 |
#define MODULE_INIT_INTERRUPTS_DW1000() { \ |
|
185 |
palSetPadCallback(moduleGpioDw1000Irqn.gpio->port, moduleGpioDw1000Irqn.gpio->pad, _intCallback, &moduleGpioDw1000Irqn.gpio->pad); \ |
|
186 |
palEnablePadEvent(moduleGpioDw1000Irqn.gpio->port, moduleGpioDw1000Irqn.gpio->pad, APAL2CH_EDGE(moduleGpioDw1000Irqn.meta.edge)); \ |
|
187 |
} |
|
188 |
#else |
|
189 |
#define MODULE_INIT_INTERRUPTS_DW1000() { \ |
|
190 |
} |
|
191 |
#endif /* AMIROLLD_CFG_DW1000 */ |
|
192 |
|
|
112 | 193 |
|
113 | 194 |
/** |
114 | 195 |
* @brief Unit test initialization hook. |
115 | 196 |
*/ |
116 | 197 |
#define MODULE_INIT_TESTS() { \ |
117 | 198 |
/* add unit-test shell commands */ \ |
199 |
MODULE_INIT_TESTS_DW1000(); \ |
|
118 | 200 |
} |
201 |
#ifdef AMIROLLD_CFG_DW1000 |
|
202 |
#define MODULE_INIT_TESTS_DW1000() { \ |
|
203 |
aosShellAddCommand(&aos.shell, &moduleUtAlldDw1000.shellcmd); \ |
|
204 |
} |
|
205 |
#else |
|
206 |
#define MODULE_INIT_TESTS_DW1000() { \ |
|
207 |
} |
|
208 |
#endif /* AMIROLLD_CFG_DW1000 */ |
|
209 |
|
|
119 | 210 |
|
120 | 211 |
/** |
121 | 212 |
* @brief Periphery communication interfaces initialization hook. |
... | ... | |
123 | 214 |
#define MODULE_INIT_PERIPHERY_COMM() { \ |
124 | 215 |
/* serial driver */ \ |
125 | 216 |
sdStart(&MODULE_HAL_PROGIF, &moduleHalProgIfConfig); \ |
217 |
MODULE_INIT_PERIPHERY_COMM_DW1000(); \ |
|
126 | 218 |
} |
219 |
#ifdef AMIROLLD_CFG_DW1000 |
|
220 |
#define MODULE_INIT_PERIPHERY_COMM_DW1000() { \ |
|
221 |
/* SPI init */ \ |
|
222 |
dw1000_spi_init(); \ |
|
223 |
spiStart(&MODULE_HAL_SPI_UWB, &moduleHalSpiUwbLsConfig); \ |
|
224 |
} |
|
225 |
#else |
|
226 |
#define MODULE_INIT_PERIPHERY_COMM_DW1000() { \ |
|
227 |
} |
|
228 |
#endif /* AMIROLLD_CFG_DW1000 */ |
|
229 |
|
|
127 | 230 |
|
128 | 231 |
/** |
129 | 232 |
* @brief Periphery communication interface deinitialization hook. |
130 | 233 |
*/ |
131 | 234 |
#define MODULE_SHUTDOWN_PERIPHERY_COMM() { \ |
235 |
MODULE_SHUTDOWN_PERIPHERY_COMM_DW1000(); \ |
|
236 |
} |
|
237 |
#ifdef AMIROLLD_CFG_DW1000 |
|
238 |
#define MODULE_SHUTDOWN_PERIPHERY_COMM_DW1000() { \ |
|
239 |
/* SPI */ \ |
|
240 |
spiStop(&MODULE_HAL_SPI_UWB); \ |
|
132 | 241 |
} |
242 |
#else |
|
243 |
#define MODULE_SHUTDOWN_PERIPHERY_COMM_DW1000() { \ |
|
244 |
} |
|
245 |
#endif /* AMIROLLD_CFG_DW1000 */ |
|
133 | 246 |
|
134 | 247 |
/** |
135 |
* @brief HOOK to toggle the LEDs when the user button is pressed.
|
|
248 |
* @brief HOOK to call process_deca_irq() func when the dw1000 interrupt pin is activated.
|
|
136 | 249 |
*/ |
137 |
#define MODULE_MAIN_LOOP_IO_EVENT(eventflags) { \
|
|
250 |
#define MODULE_MAIN_LOOP_IO_EVENT(eventflags) { \
|
|
138 | 251 |
if (eventflags & MODULE_OS_IOEVENTFLAGS_USERBUTTON) { \ |
139 | 252 |
apalControlGpioState_t buttonstate; \ |
140 | 253 |
apalControlGpioGet(&moduleGpioUserButton, &buttonstate); \ |
141 | 254 |
apalControlGpioSet(&moduleGpioLed, buttonstate); \ |
142 | 255 |
} \ |
256 |
MODULE_MAIN_LOOP_IO_EVENT_DW1000(); \ |
|
143 | 257 |
} |
258 |
#ifdef AMIROLLD_CFG_DW1000 |
|
259 |
#define MODULE_MAIN_LOOP_IO_EVENT_DW1000() { \ |
|
260 |
if(eventflags & MODULE_OS_IOEVENTFLAGS_DW1000_IRQn) { \ |
|
261 |
/*apalGpioToggle(moduleGpioLedGreen.gpio); // just for debug */ \ |
|
262 |
process_deca_irq(); \ |
|
263 |
} \ |
|
264 |
} |
|
265 |
#else |
|
266 |
#define MODULE_MAIN_LOOP_IO_EVENT_DW1000() { \ |
|
267 |
} |
|
268 |
#endif /* AMIROLLD_CFG_DW1000 */ |
|
144 | 269 |
|
145 | 270 |
/** @} */ |
146 | 271 |
|
... | ... | |
159 | 284 |
* @{ |
160 | 285 |
*/ |
161 | 286 |
/*===========================================================================*/ |
287 |
#ifdef AMIROLLD_CFG_DW1000 |
|
288 |
#include <alld_DW1000.h> |
|
289 |
|
|
290 |
extern DW1000Driver moduleLldDw1000; |
|
291 |
|
|
292 |
#endif /* AMIROLLD_CFG_DW1000 */ |
|
162 | 293 |
|
163 | 294 |
/** @} */ |
164 | 295 |
|
... | ... | |
170 | 301 |
/*===========================================================================*/ |
171 | 302 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
172 | 303 |
|
304 |
#if defined(AMIROLLD_CFG_DW1000) && (AMIROLLD_CFG_DW1000 == 1) |
|
305 |
#include<ut_alld_dw1000_v1.h> |
|
306 |
|
|
307 |
/** |
|
308 |
* @brief DW1000 unit test object. |
|
309 |
*/ |
|
310 |
extern aos_unittest_t moduleUtAlldDw1000; |
|
311 |
|
|
312 |
#endif /* defined(AMIROLLD_CFG_DW1000) && (AMIROLLD_CFG_DW1000 == 1) */ |
|
313 |
|
|
173 | 314 |
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */ |
174 | 315 |
|
175 | 316 |
/** @} */ |
Also available in: Unified diff