Revision bffb3465 modules/PowerManagement_1-1/module.c
modules/PowerManagement_1-1/module.c | ||
---|---|---|
153 | 153 |
/* active state */ (VCNL4020_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW, |
154 | 154 |
/* interrupt edge */ VCNL4020_LLD_INT_EDGE, |
155 | 155 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) |
156 |
/* active state */ APAL_GPIO_ACTIVE_LOW, |
|
157 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE,
|
|
156 |
/* active state */ (PCAL6524_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW,
|
|
157 |
/* interrupt edge */ PCAL6524_LLD_INT_EDGE,
|
|
158 | 158 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) |
159 |
/* active state */ APAL_GPIO_ACTIVE_LOW, |
|
160 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE,
|
|
159 |
/* active state */ (PCAL6524_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW,
|
|
160 |
/* interrupt edge */ PCAL6524_LLD_INT_EDGE,
|
|
161 | 161 |
#else |
162 | 162 |
/* active state */ APAL_GPIO_ACTIVE_LOW, |
163 | 163 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE, |
... | ... | |
356 | 356 |
/* active state */ (VCNL4020_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW, |
357 | 357 |
/* interrupt edge */ VCNL4020_LLD_INT_EDGE, |
358 | 358 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) |
359 |
/* active state */ APAL_GPIO_ACTIVE_LOW, |
|
360 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE,
|
|
359 |
/* active state */ (PCAL6524_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW,
|
|
360 |
/* interrupt edge */ PCAL6524_LLD_INT_EDGE,
|
|
361 | 361 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) |
362 |
/* active state */ APAL_GPIO_ACTIVE_LOW, |
|
363 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE,
|
|
362 |
/* active state */ (PCAL6524_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW,
|
|
363 |
/* interrupt edge */ PCAL6524_LLD_INT_EDGE,
|
|
364 | 364 |
#else |
365 | 365 |
/* active state */ APAL_GPIO_ACTIVE_LOW, |
366 | 366 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE, |
... | ... | |
383 | 383 |
/* active state */ (MPR121_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW, |
384 | 384 |
/* interrupt edge */ MPR121_LLD_INT_EDGE, |
385 | 385 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) |
386 |
/* active state */ APAL_GPIO_ACTIVE_LOW, |
|
387 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE,
|
|
386 |
/* active state */ (AT42QT1050_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW,
|
|
387 |
/* interrupt edge */ AT42QT1050_LLD_INT_EDGE,
|
|
388 | 388 |
#elif (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) |
389 |
/* active state */ APAL_GPIO_ACTIVE_LOW, |
|
390 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE,
|
|
389 |
/* active state */ (AT42QT1050_LLD_INT_EDGE == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_ACTIVE_HIGH : APAL_GPIO_ACTIVE_LOW,
|
|
390 |
/* interrupt edge */ AT42QT1050_LLD_INT_EDGE,
|
|
391 | 391 |
#else |
392 | 392 |
/* active state */ APAL_GPIO_ACTIVE_LOW, |
393 | 393 |
/* interrupt edge */ APAL_GPIO_EDGE_NONE, |
... | ... | |
667 | 667 |
#endif /* BOARD_SENSORRING == BOARD_PROXIMITYSENSOR */ |
668 | 668 |
|
669 | 669 |
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) || defined(__DOXYGEN__) |
670 |
// TODO |
|
670 |
|
|
671 |
PCAL6524Driver moduleLldGpioExtender1 = { |
|
672 |
/* I²C driver */ &MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR, |
|
673 |
/* I²C address */ PCAL6524_LLD_I2C_ADDR_VDD, |
|
674 |
}; |
|
675 |
|
|
676 |
PCAL6524Driver moduleLldGpioExtender2 = { |
|
677 |
/* I²C driver */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT, |
|
678 |
/* I²C address */ PCAL6524_LLD_I2C_ADDR_VDD, |
|
679 |
}; |
|
680 |
|
|
681 |
AT42QT1050Driver moduleLldTouch = { |
|
682 |
/* I²C driver */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT, |
|
683 |
/* I²C address */ AT42QT1050_LLD_I2C_ADDRSEL_LOW, |
|
684 |
}; |
|
685 |
|
|
671 | 686 |
#endif /* BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X */ |
672 | 687 |
|
673 | 688 |
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) || defined(__DOXYGEN__) |
674 |
// TODO |
|
689 |
|
|
690 |
PCAL6524Driver moduleLldGpioExtender1 = { |
|
691 |
/* I²C driver */ &MODULE_HAL_I2C_SR_PM18_PM33_GAUGEREAR, |
|
692 |
/* I²C address */ PCAL6524_LLD_I2C_ADDR_VDD, |
|
693 |
}; |
|
694 |
|
|
695 |
PCAL6524Driver moduleLldGpioExtender2 = { |
|
696 |
/* I²C driver */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT, |
|
697 |
/* I²C address */ PCAL6524_LLD_I2C_ADDR_VDD, |
|
698 |
}; |
|
699 |
|
|
700 |
AT42QT1050Driver moduleLldTouch = { |
|
701 |
/* I²C driver */ &MODULE_HAL_I2C_SR_PM42_PM50_PMVDD_EEPROM_GAUGEFRONT, |
|
702 |
/* I²C address */ AT42QT1050_LLD_I2C_ADDRSEL_LOW, |
|
703 |
}; |
|
704 |
|
|
675 | 705 |
#endif /* BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X */ |
676 | 706 |
|
677 | 707 |
/** @} */ |
... | ... | |
1290 | 1320 |
#endif /* BOARD_SENSORRING == BOARD_PROXIMITYSENSOR */ |
1291 | 1321 |
|
1292 | 1322 |
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X) || defined(__DOXYGEN__) |
1293 |
// TODO |
|
1323 |
|
|
1324 |
/* |
|
1325 |
* PCAL6524 (GPIO extender) |
|
1326 |
*/ |
|
1327 |
static int _utShellCmdCb_AlldPcal6524(BaseSequentialStream* stream, int argc, char* argv[]) |
|
1328 |
{ |
|
1329 |
// evaluate arguments |
|
1330 |
if (argc == 2) { |
|
1331 |
if (strcmp(argv[1], "#1") == 0) { |
|
1332 |
((ut_pcal6524data_t*)moduleUtAlldPcal6524.data)->pcal6524d = &moduleLldGpioExtender1; |
|
1333 |
aosUtRun(stream, &moduleUtAlldPcal6524, "I2C bus #1"); |
|
1334 |
((ut_pcal6524data_t*)moduleUtAlldPcal6524.data)->pcal6524d = NULL; |
|
1335 |
return AOS_OK; |
|
1336 |
} |
|
1337 |
else if (strcmp(argv[1], "#2") == 0) { |
|
1338 |
((ut_pcal6524data_t*)moduleUtAlldPcal6524.data)->pcal6524d = &moduleLldGpioExtender2; |
|
1339 |
aosUtRun(stream, &moduleUtAlldPcal6524, "I2C bus #2"); |
|
1340 |
((ut_pcal6524data_t*)moduleUtAlldPcal6524.data)->pcal6524d = NULL; |
|
1341 |
return AOS_OK; |
|
1342 |
} |
|
1343 |
} |
|
1344 |
// print help |
|
1345 |
chprintf(stream, "Usage: %s OPTION\n", argv[0]); |
|
1346 |
chprintf(stream, "Options:\n"); |
|
1347 |
chprintf(stream, " #1\n"); |
|
1348 |
chprintf(stream, " Test the GPIO extender on the I2C bus #1.\n"); |
|
1349 |
chprintf(stream, " #2\n"); |
|
1350 |
chprintf(stream, " Test the GPIO extender on the I2C bus #2.\n"); |
|
1351 |
return AOS_INVALID_ARGUMENTS; |
|
1352 |
} |
|
1353 |
static ut_pcal6524data_t _utAlldPcal6524Data = { |
|
1354 |
/* driver */ NULL, |
|
1355 |
/* timeout */ MICROSECONDS_PER_SECOND, |
|
1356 |
}; |
|
1357 |
aos_unittest_t moduleUtAlldPcal6524 = { |
|
1358 |
/* name */ "PCAL6524", |
|
1359 |
/* info */ "GPIO extender", |
|
1360 |
/* test function */ utAlldPcal6524Func, |
|
1361 |
/* shell command */ { |
|
1362 |
/* name */ "unittest:GPIOExtender", |
|
1363 |
/* callback */ _utShellCmdCb_AlldPcal6524, |
|
1364 |
/* next */ NULL, |
|
1365 |
}, |
|
1366 |
/* data */ &_utAlldPcal6524Data, |
|
1367 |
}; |
|
1368 |
|
|
1369 |
/* |
|
1370 |
* AT42QT1050 (touch sensor) |
|
1371 |
*/ |
|
1372 |
static int _utShellCmdCb_AlldAt42qt1050(BaseSequentialStream* stream, int argc, char* argv[]) |
|
1373 |
{ |
|
1374 |
(void)argc; |
|
1375 |
(void)argv; |
|
1376 |
aosUtRun(stream, &moduleUtAlldAt42qt1050, NULL); |
|
1377 |
return AOS_OK; |
|
1378 |
} |
|
1379 |
static ut_at42qt1050data_t _utAlldMpr121Data= { |
|
1380 |
/* AT42QT1050 driver */ &moduleLldTouch, |
|
1381 |
/* timeout */ MICROSECONDS_PER_SECOND, |
|
1382 |
/* event source */ &aos.events.io, |
|
1383 |
/* event flags */ MODULE_OS_IOEVENTFLAGS_TOUCHINT, |
|
1384 |
}; |
|
1385 |
aos_unittest_t moduleUtAlldAt42qt1050 = { |
|
1386 |
/* name */ "AT42QT1050", |
|
1387 |
/* info */ "touch sensor", |
|
1388 |
/* test function */ utAlldAt42qt1050Func, |
|
1389 |
/* shell command */ { |
|
1390 |
/* name */ "unittest:Touch", |
|
1391 |
/* callback */ _utShellCmdCb_AlldAt42qt1050, |
|
1392 |
/* next */ NULL, |
|
1393 |
}, |
|
1394 |
/* data */ &_utAlldMpr121Data, |
|
1395 |
}; |
|
1396 |
|
|
1294 | 1397 |
#endif /* BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L0X */ |
1295 | 1398 |
|
1296 | 1399 |
#if (BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X) || defined(__DOXYGEN__) |
1297 |
// TODO |
|
1400 |
|
|
1401 |
/* |
|
1402 |
* PCAL6524 (GPIO extender) |
|
1403 |
*/ |
|
1404 |
static int _utShellCmdCb_AlldPcal6524(BaseSequentialStream* stream, int argc, char* argv[]) |
|
1405 |
{ |
|
1406 |
// evaluate arguments |
|
1407 |
if (argc == 2) { |
|
1408 |
if (strcmp(argv[1], "#1") == 0) { |
|
1409 |
((ut_pcal6524data_t*)moduleUtAlldPcal6524.data)->pcal6524d = &moduleLldGpioExtender1; |
|
1410 |
aosUtRun(stream, &moduleUtAlldPcal6524, "I2C bus #1"); |
|
1411 |
((ut_pcal6524data_t*)moduleUtAlldPcal6524.data)->pcal6524d = NULL; |
|
1412 |
return AOS_OK; |
|
1413 |
} |
|
1414 |
else if (strcmp(argv[1], "#2") == 0) { |
|
1415 |
((ut_pcal6524data_t*)moduleUtAlldPcal6524.data)->pcal6524d = &moduleLldGpioExtender2; |
|
1416 |
aosUtRun(stream, &moduleUtAlldPcal6524, "I2C bus #2"); |
|
1417 |
((ut_pcal6524data_t*)moduleUtAlldPcal6524.data)->pcal6524d = NULL; |
|
1418 |
return AOS_OK; |
|
1419 |
} |
|
1420 |
} |
|
1421 |
// print help |
|
1422 |
chprintf(stream, "Usage: %s OPTION\n", argv[0]); |
|
1423 |
chprintf(stream, "Options:\n"); |
|
1424 |
chprintf(stream, " #1\n"); |
|
1425 |
chprintf(stream, " Test the GPIO extender on the I2C bus #1.\n"); |
|
1426 |
chprintf(stream, " #2\n"); |
|
1427 |
chprintf(stream, " Test the GPIO extender on the I2C bus #2.\n"); |
|
1428 |
return AOS_INVALID_ARGUMENTS; |
|
1429 |
} |
|
1430 |
static ut_pcal6524data_t _utAlldPcal6524Data = { |
|
1431 |
/* driver */ NULL, |
|
1432 |
/* timeout */ MICROSECONDS_PER_SECOND, |
|
1433 |
}; |
|
1434 |
aos_unittest_t moduleUtAlldPcal6524 = { |
|
1435 |
/* name */ "PCAL6524", |
|
1436 |
/* info */ "GPIO extender", |
|
1437 |
/* test function */ utAlldPcal6524Func, |
|
1438 |
/* shell command */ { |
|
1439 |
/* name */ "unittest:GPIOExtender", |
|
1440 |
/* callback */ _utShellCmdCb_AlldPcal6524, |
|
1441 |
/* next */ NULL, |
|
1442 |
}, |
|
1443 |
/* data */ &_utAlldPcal6524Data, |
|
1444 |
}; |
|
1445 |
|
|
1446 |
/* |
|
1447 |
* AT42QT1050 (touch sensor) |
|
1448 |
*/ |
|
1449 |
static int _utShellCmdCb_AlldAt42qt1050(BaseSequentialStream* stream, int argc, char* argv[]) |
|
1450 |
{ |
|
1451 |
(void)argc; |
|
1452 |
(void)argv; |
|
1453 |
aosUtRun(stream, &moduleUtAlldAt42qt1050, NULL); |
|
1454 |
return AOS_OK; |
|
1455 |
} |
|
1456 |
static ut_at42qt1050data_t _utAlldMpr121Data= { |
|
1457 |
/* AT42QT1050 driver */ &moduleLldTouch, |
|
1458 |
/* timeout */ MICROSECONDS_PER_SECOND, |
|
1459 |
/* event source */ &aos.events.io, |
|
1460 |
/* event flags */ MODULE_OS_IOEVENTFLAGS_TOUCHINT, |
|
1461 |
}; |
|
1462 |
aos_unittest_t moduleUtAlldAt42qt1050 = { |
|
1463 |
/* name */ "AT42QT1050", |
|
1464 |
/* info */ "touch sensor", |
|
1465 |
/* test function */ utAlldAt42qt1050Func, |
|
1466 |
/* shell command */ { |
|
1467 |
/* name */ "unittest:Touch", |
|
1468 |
/* callback */ _utShellCmdCb_AlldAt42qt1050, |
|
1469 |
/* next */ NULL, |
|
1470 |
}, |
|
1471 |
/* data */ &_utAlldMpr121Data, |
|
1472 |
}; |
|
1473 |
|
|
1298 | 1474 |
#endif /* BOARD_SENSORRING == BOARD_DISTANCESENSOR_VL53L1X */ |
1299 | 1475 |
|
1300 | 1476 |
#endif /* AMIROOS_CFG_TESTS_ENABLE == true */ |
Also available in: Unified diff