Revision 4c72a54c modules/NUCLEO-F103RB/module.c
modules/NUCLEO-F103RB/module.c | ||
---|---|---|
24 | 24 |
* @{ |
25 | 25 |
*/ |
26 | 26 |
|
27 |
#include "module.h"
|
|
27 |
#include <amiroos.h>
|
|
28 | 28 |
|
29 | 29 |
/*===========================================================================*/ |
30 | 30 |
/** |
... | ... | |
49 | 49 |
/* CR1 */ 0, |
50 | 50 |
}; |
51 | 51 |
|
52 |
#if defined(AMIROLLD_CFG_DW1000)
|
|
52 |
#if (BOARD_DW1000_CONNECTED == true)
|
|
53 | 53 |
|
54 | 54 |
/*! SPI (high and low speed) configuration for DW1000 */ |
55 | 55 |
SPIConfig moduleHalSpiUwbHsConfig = { |
... | ... | |
70 | 70 |
/* CR2 */ 0, |
71 | 71 |
}; |
72 | 72 |
|
73 |
#endif /* defined(AMIROLLD_CFG_DW1000) */
|
|
73 |
#endif /* (BOARD_DW1000_CONNECTED == true) */
|
|
74 | 74 |
|
75 | 75 |
/** @} */ |
76 | 76 |
|
... | ... | |
85 | 85 |
* @brief LED output signal GPIO. |
86 | 86 |
*/ |
87 | 87 |
static apalGpio_t _gpioLed = { |
88 |
/* line */ PAL_LINE(GPIOA, GPIOA_LED_GREEN),
|
|
88 |
/* line */ LINE_LED_GREEN,
|
|
89 | 89 |
}; |
90 | 90 |
ROMCONST apalControlGpio_t moduleGpioLed = { |
91 | 91 |
/* GPIO */ &_gpioLed, |
... | ... | |
96 | 96 |
}, |
97 | 97 |
}; |
98 | 98 |
|
99 |
#if defined(AMIROLLD_CFG_DW1000)
|
|
99 |
#if (BOARD_DW1000_CONNECTED == true)
|
|
100 | 100 |
|
101 | 101 |
/** |
102 | 102 |
* @brief DW1000 reset output signal GPIO. |
... | ... | |
145 | 145 |
}, |
146 | 146 |
}; |
147 | 147 |
|
148 |
#endif /* defined(AMIROLLD_CFG_DW1000) */
|
|
148 |
#endif /* (BOARD_DW1000_CONNECTED == true) */
|
|
149 | 149 |
|
150 | 150 |
/** |
151 | 151 |
* @brief User button input signal GPIO. |
152 | 152 |
*/ |
153 | 153 |
static apalGpio_t _gpioUserButton = { |
154 |
/* line */ PAL_LINE(GPIOC, GPIOC_BUTTON),
|
|
154 |
/* line */ LINE_BUTTON,
|
|
155 | 155 |
}; |
156 | 156 |
ROMCONST apalControlGpio_t moduleGpioUserButton = { |
157 | 157 |
/* GPIO */ &_gpioUserButton, |
... | ... | |
184 | 184 |
*/ |
185 | 185 |
/*===========================================================================*/ |
186 | 186 |
|
187 |
/** @} */ |
|
187 | 188 |
|
188 | 189 |
/*===========================================================================*/ |
189 | 190 |
/** |
... | ... | |
192 | 193 |
*/ |
193 | 194 |
/*===========================================================================*/ |
194 | 195 |
|
195 |
#if defined(AMIROLLD_CFG_DW1000)
|
|
196 |
#if (BOARD_DW1000_CONNECTED == true)
|
|
196 | 197 |
|
197 | 198 |
/*! @brief TODO: Manual implementation of SPI configuration. Somehow, it is necessary in NUCLEO-F103RB */ |
198 | 199 |
void dw1000_spi_init(void){ |
... | ... | |
203 | 204 |
apalGpioWrite(moduleGpioSpiChipSelect.gpio, APAL_GPIO_LOW); |
204 | 205 |
} |
205 | 206 |
|
206 |
#endif /* defined(AMIROLLD_CFG_DW1000) */
|
|
207 |
#endif /* (BOARD_DW1000_CONNECTED == true) */
|
|
207 | 208 |
/** @} */ |
208 | 209 |
|
209 | 210 |
/*===========================================================================*/ |
... | ... | |
213 | 214 |
*/ |
214 | 215 |
/*===========================================================================*/ |
215 | 216 |
|
216 |
#if defined(AMIROLLD_CFG_DW1000) |
|
217 |
LEDDriver moduleLldLed = { |
|
218 |
/* LED enable Gpio */ &moduleGpioLed, |
|
219 |
}; |
|
220 |
|
|
221 |
ButtonDriver moduleLldUserButton = { |
|
222 |
/* Button Gpio */ &moduleGpioUserButton, |
|
223 |
}; |
|
224 |
|
|
225 |
#if (BOARD_DW1000_CONNECTED == true) |
|
217 | 226 |
|
218 | 227 |
DW1000Driver moduleLldDw1000 = { |
219 | 228 |
/* SPI driver */ &MODULE_HAL_SPI_UWB, |
... | ... | |
221 | 230 |
/* RESET DW1000 */ &moduleGpioDw1000Reset, |
222 | 231 |
}; |
223 | 232 |
|
224 |
#endif /* defined(AMIROLLD_CFG_DW1000) */ |
|
233 |
#endif /* (BOARD_DW1000_CONNECTED == true) */ |
|
234 |
|
|
225 | 235 |
/** @} */ |
226 | 236 |
|
227 | 237 |
/*===========================================================================*/ |
228 | 238 |
/** |
229 |
* @name Unit tests (UT)
|
|
239 |
* @name Tests
|
|
230 | 240 |
* @{ |
231 | 241 |
*/ |
232 | 242 |
/*===========================================================================*/ |
233 | 243 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
234 | 244 |
|
235 |
#if defined(AMIROLLD_CFG_DW1000) |
|
245 |
/* |
|
246 |
* LED |
|
247 |
*/ |
|
248 |
#include <module_test_LED.h> |
|
249 |
static int _testLedShellCmdCb(BaseSequentialStream* stream, int argc, char* argv[]) |
|
250 |
{ |
|
251 |
return moduleTestLedShellCb(stream, argc, argv, NULL); |
|
252 |
} |
|
253 |
AOS_SHELL_COMMAND(moduleTestLedShellCmd, "test:LED", _testLedShellCmdCb); |
|
254 |
|
|
255 |
/* |
|
256 |
* User button |
|
257 |
*/ |
|
258 |
#include <module_test_button.h> |
|
259 |
static int _testButtonShellCmdCb(BaseSequentialStream* stream, int argc, char* argv[]) |
|
260 |
{ |
|
261 |
return moduleTestButtonShellCb(stream, argc, argv, NULL); |
|
262 |
} |
|
263 |
AOS_SHELL_COMMAND(moduleTestButtonShellCmd, "test:button", _testButtonShellCmdCb); |
|
264 |
|
|
265 |
#if (BOARD_DW1000_CONNECTED == true) || defined(__DOXYGEN__) |
|
236 | 266 |
|
237 | 267 |
/* |
238 | 268 |
* UwB Driver (DW1000) |
... | ... | |
255 | 285 |
}, |
256 | 286 |
/* data */ &moduleLldDw1000, |
257 | 287 |
}; |
258 |
#endif /* defined(AMIROLLD_CFG_DW1000) */ |
|
288 |
#endif /* (BOARD_DW1000_CONNECTED == true) */ |
|
289 |
|
|
290 |
/* |
|
291 |
* entire module |
|
292 |
*/ |
|
293 |
static int _testAllShellCmdCb(BaseSequentialStream* stream, int argc, char* argv[]) |
|
294 |
{ |
|
295 |
(void)argc; |
|
296 |
(void)argv; |
|
297 |
|
|
298 |
int status = AOS_OK; |
|
299 |
char* targv[AMIROOS_CFG_SHELL_MAXARGS] = {NULL}; |
|
300 |
aos_testresult_t result_test = {0, 0}; |
|
301 |
aos_testresult_t result_total = {0, 0}; |
|
302 |
|
|
303 |
/* LED */ |
|
304 |
status |= moduleTestLedShellCb(stream, 0, targv, &result_test); |
|
305 |
result_total = aosTestResultAdd(result_total, result_test); |
|
306 |
|
|
307 |
/* User button */ |
|
308 |
status |= moduleTestButtonShellCb(stream, 0, targv, &result_test); |
|
309 |
result_total = aosTestResultAdd(result_total, result_test); |
|
310 |
|
|
311 |
/* DW1000 */ |
|
312 |
//TODO |
|
313 |
|
|
314 |
// print total result |
|
315 |
chprintf(stream, "\n"); |
|
316 |
aosTestResultPrintSummary(stream, &result_total, "entire module"); |
|
317 |
|
|
318 |
return status; |
|
319 |
} |
|
320 |
AOS_SHELL_COMMAND(moduleTestAllShellCmd, "test:all", _testAllShellCmdCb); |
|
259 | 321 |
|
260 | 322 |
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */ |
261 | 323 |
|
Also available in: Unified diff