Revision 4c72a54c modules/LightRing_1-0/module.c
modules/LightRing_1-0/module.c | ||
---|---|---|
78 | 78 |
/* CR2 */ SPI_CR2_RXDMAEN | SPI_CR2_TXDMAEN, |
79 | 79 |
}; |
80 | 80 |
|
81 |
/** @} */ |
|
82 |
|
|
81 | 83 |
/*===========================================================================*/ |
82 | 84 |
/** |
83 | 85 |
* @name GPIO definitions |
... | ... | |
271 | 273 |
|
272 | 274 |
/*===========================================================================*/ |
273 | 275 |
/** |
274 |
* @name Unit tests (UT)
|
|
276 |
* @name Tests
|
|
275 | 277 |
* @{ |
276 | 278 |
*/ |
277 | 279 |
/*===========================================================================*/ |
278 | 280 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
279 | 281 |
|
280 | 282 |
/* |
281 |
* EEPROM (AT24C01B)
|
|
283 |
* AT24C01BN-SH-B (EEPROM)
|
|
282 | 284 |
*/ |
283 |
static int _utShellCmdCb_AlldAt24c01b(BaseSequentialStream* stream, int argc, char* argv[]) |
|
285 |
#include <module_test_AT24C01B.h> |
|
286 |
static int _testAt24co1bShellCmdCb(BaseSequentialStream* stream, int argc, char* argv[]) |
|
284 | 287 |
{ |
285 |
(void)argc; |
|
286 |
(void)argv; |
|
287 |
aosUtRun(stream, &moduleUtAlldAt24c01b, NULL); |
|
288 |
return AOS_OK; |
|
288 |
return moduleTestAt24c01bShellCb(stream, argc, argv, NULL); |
|
289 | 289 |
} |
290 |
static ut_at24c01bdata_t _utAlldAt24c01bData = { |
|
291 |
/* driver */ &moduleLldEeprom, |
|
292 |
/* timeout */ MICROSECONDS_PER_SECOND, |
|
293 |
}; |
|
294 |
aos_unittest_t moduleUtAlldAt24c01b = { |
|
295 |
/* name */ "AT24C01B", |
|
296 |
/* info */ "1kbit EEPROM", |
|
297 |
/* test function */ utAlldAt24c01bFunc, |
|
298 |
/* shell command */ { |
|
299 |
/* name */ "unittest:EEPROM", |
|
300 |
/* callback */ _utShellCmdCb_AlldAt24c01b, |
|
301 |
/* next */ NULL, |
|
302 |
}, |
|
303 |
/* data */ &_utAlldAt24c01bData, |
|
304 |
}; |
|
290 |
AOS_SHELL_COMMAND(moduleTestAt24c01bShellCmd, "test:EEPROM", _testAt24co1bShellCmdCb); |
|
305 | 291 |
|
306 | 292 |
/* |
307 |
* LED PWM driver (TLC5947)
|
|
293 |
* TLC5947 (24 channel PWM LED driver)
|
|
308 | 294 |
*/ |
309 |
static int _utShellCmdCb_Tlc5947(BaseSequentialStream* stream, int argc, char* argv[]) |
|
295 |
#include <module_test_TLC5947.h> |
|
296 |
static int _testTlc5947ShellCmdCb(BaseSequentialStream* stream, int argc, char* argv[]) |
|
310 | 297 |
{ |
311 |
(void)argc; |
|
312 |
(void)argv; |
|
313 |
aosUtRun(stream, &moduleUtAlldTlc5947, NULL); |
|
314 |
return AOS_OK; |
|
298 |
return moduleTestTlc5947ShellCb(stream, argc, argv, NULL); |
|
315 | 299 |
} |
316 |
aos_unittest_t moduleUtAlldTlc5947 = {
|
|
317 |
/* info */ "TLC5947", |
|
318 |
/* name */ "LED PWM driver",
|
|
319 |
/* test function */ utAlldTlc5947Func,
|
|
320 |
/* shell command */ {
|
|
321 |
/* name */ "unittest:Lights",
|
|
322 |
/* callback */ _utShellCmdCb_Tlc5947,
|
|
323 |
/* next */ NULL,
|
|
324 |
},
|
|
325 |
/* data */ &moduleLldLedPwm,
|
|
326 |
};
|
|
300 |
AOS_SHELL_COMMAND(moduleTestTlc5947ShellCmd, "test:Lights", _testTlc5947ShellCmdCb);
|
|
301 |
|
|
302 |
/*
|
|
303 |
* TPS2051BDBV (Current-limited power switch)
|
|
304 |
*/
|
|
305 |
#include <module_test_TPS20xxB.h>
|
|
306 |
static int _testTps2051bdbvShellCmdCb(BaseSequentialStream* stream, int argc, char* argv[])
|
|
307 |
{
|
|
308 |
return moduleTestTps20xxbShellCb(stream, argc, argv, NULL);
|
|
309 |
}
|
|
310 |
AOS_SHELL_COMMAND(moduleTestTps2051bdbvShellCmd, "test:PowerSwitch", _testTps2051bdbvShellCmdCb);
|
|
327 | 311 |
|
328 | 312 |
/* |
329 |
* power switch (TPS2051BDBV)
|
|
313 |
* entire module
|
|
330 | 314 |
*/ |
331 |
static int _utShellCmdCb_Tps2051bdbv(BaseSequentialStream* stream, int argc, char* argv[])
|
|
315 |
static int _testAllShellCmdCb(BaseSequentialStream* stream, int argc, char* argv[])
|
|
332 | 316 |
{ |
333 | 317 |
(void)argc; |
334 | 318 |
(void)argv; |
335 |
aosUtRun(stream,&moduleUtAlldTps2051bdbv, NULL); |
|
336 |
return AOS_OK; |
|
319 |
|
|
320 |
int status = AOS_OK; |
|
321 |
char* targv[AMIROOS_CFG_SHELL_MAXARGS] = {NULL}; |
|
322 |
aos_testresult_t result_test = {0, 0}; |
|
323 |
aos_testresult_t result_total = {0, 0}; |
|
324 |
|
|
325 |
/* AT24C01B (EEPROM) */ |
|
326 |
status |= moduleTestAt24c01bShellCb(stream, 0, targv, &result_test); |
|
327 |
result_total = aosTestResultAdd(result_total, result_test); |
|
328 |
|
|
329 |
/* TLC5947 (24 channel LED PWM driver) */ |
|
330 |
status |= moduleTestTlc5947ShellCb(stream, 0, targv, &result_test); |
|
331 |
result_total = aosTestResultAdd(result_total, result_test); |
|
332 |
|
|
333 |
/* TPS2051BDBV (Current-limited power switch) */ |
|
334 |
status |= moduleTestTps20xxbShellCb(stream, 0, targv, &result_test); |
|
335 |
result_total = aosTestResultAdd(result_total, result_test); |
|
336 |
|
|
337 |
// print total result |
|
338 |
chprintf(stream, "\n"); |
|
339 |
aosTestResultPrintSummary(stream, &result_total, "entire module"); |
|
340 |
|
|
341 |
return status; |
|
337 | 342 |
} |
338 |
aos_unittest_t moduleUtAlldTps2051bdbv = { |
|
339 |
/* info */ "TPS2051BDBV", |
|
340 |
/* name */ "current-limited power switch", |
|
341 |
/* test function */ utAlldTps20xxbFunc, |
|
342 |
/* shell command */ { |
|
343 |
/* name */ "unittest:PowerSwitch", |
|
344 |
/* callback */ _utShellCmdCb_Tps2051bdbv, |
|
345 |
/* next */ NULL, |
|
346 |
}, |
|
347 |
/* data */ &moduleLldPowerSwitchLaser, |
|
348 |
}; |
|
343 |
AOS_SHELL_COMMAND(moduleTestAllShellCmd, "test:all", _testAllShellCmdCb); |
|
349 | 344 |
|
350 | 345 |
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */ |
351 | 346 |
|
Also available in: Unified diff