Revision 1a8fb642
core/inc/aos_system.h | ||
---|---|---|
173 | 173 |
struct { |
174 | 174 |
|
175 | 175 |
/** |
176 |
* @brief I/O event source.
|
|
176 |
* @brief GPIO event source.
|
|
177 | 177 |
*/ |
178 |
event_source_t io; |
|
178 |
event_source_t gpio;
|
|
179 | 179 |
|
180 | 180 |
/** |
181 | 181 |
* @brief OS event source. |
... | ... | |
231 | 231 |
void aosSysStop(void); |
232 | 232 |
void aosSysDeinit(void); |
233 | 233 |
void aosSysShutdownFinal(aos_shutdown_t shutdown); |
234 |
palcallback_t aosSysGetStdExtiCallback(void);
|
|
234 |
palcallback_t aosSysGetStdGpioCallback(void);
|
|
235 | 235 |
#if defined(__cplusplus) |
236 | 236 |
} |
237 | 237 |
#endif /* defined(__cplusplus) */ |
core/inc/aos_types.h | ||
---|---|---|
87 | 87 |
/** |
88 | 88 |
* @brief Converts a GPIO pad number to a unique event flag. |
89 | 89 |
*/ |
90 |
#define AOS_IOEVENT_FLAG(pad) ((eventflags_t)1 << pad)
|
|
90 |
#define AOS_GPIOEVENT_FLAG(pad) ((eventflags_t)1 << pad)
|
|
91 | 91 |
|
92 | 92 |
/******************************************************************************/ |
93 | 93 |
/* EXTERN DECLARATIONS */ |
core/src/aos_main.cpp | ||
---|---|---|
40 | 40 |
/******************************************************************************/ |
41 | 41 |
|
42 | 42 |
/** |
43 |
* @brief Event mask to identify I/O events.
|
|
43 |
* @brief Event mask to identify GPIO events.
|
|
44 | 44 |
*/ |
45 |
#define IOEVENT_MASK EVENT_MASK(0)
|
|
45 |
#define GPIOEVENT_MASK EVENT_MASK(0)
|
|
46 | 46 |
|
47 | 47 |
/** |
48 | 48 |
* @brief Event mask to identify OS events. |
... | ... | |
116 | 116 |
/******************************************************************************/ |
117 | 117 |
|
118 | 118 |
/** |
119 |
* @brief Listener object for I/O events.
|
|
119 |
* @brief Listener object for GPIO events.
|
|
120 | 120 |
*/ |
121 |
static event_listener_t _eventListenerIO; |
|
121 |
static event_listener_t _eventListenerGPIO;
|
|
122 | 122 |
|
123 | 123 |
/** |
124 | 124 |
* @brief Listener object for OS events. |
... | ... | |
126 | 126 |
static event_listener_t _eventListenerOS; |
127 | 127 |
|
128 | 128 |
#if defined(MODULE_HAL_PROGIF) || defined(__DOXYGEN__) |
129 |
|
|
129 | 130 |
/** |
130 | 131 |
* @brief I/O channel for the programmer interface. |
131 | 132 |
*/ |
... | ... | |
444 | 445 |
continue; |
445 | 446 |
} |
446 | 447 |
// if an IO event occurred |
447 |
if (eventmask & _eventListenerIO.events) { |
|
448 |
ioflags = chEvtGetAndClearFlags(&_eventListenerIO); |
|
448 |
if (eventmask & _eventListenerGPIO.events) {
|
|
449 |
ioflags = chEvtGetAndClearFlags(&_eventListenerGPIO);
|
|
449 | 450 |
aosDbgPrintf("INFO: IO evt (0x%08X)\n", ioflags); |
450 | 451 |
// a power-down event occurred |
451 |
if (ioflags & MODULE_SSSP_EVENTFLAGS_PD) {
|
|
452 |
if (ioflags & MODULE_SSSP_EVENTFLAG_PD) { |
|
452 | 453 |
aosDbgPrintf("PD evt\n"); |
453 | 454 |
// deactivate S and UP |
454 | 455 |
aosDbgPrintf("disabling S\n"); |
455 |
apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_OFF);
|
|
456 |
apalControlGpioSet(&moduleSsspGpioS, APAL_GPIO_OFF); |
|
456 | 457 |
#if (AMIROOS_CFG_SSSP_STACK_END != true) |
457 | 458 |
aosDbgPrintf("disabling UP\n"); |
458 |
apalControlGpioSet(&moduleSsspGpioUp, APAL_GPIO_OFF);
|
|
459 |
apalControlGpioSet(&moduleSsspGpioUP, APAL_GPIO_OFF);
|
|
459 | 460 |
#endif /* (AMIROOS_CFG_SSSP_STACK_END != true) */ |
460 | 461 |
// set shutdown flag and exit the loop |
461 | 462 |
shutdown = AOS_SHUTDOWN_PASSIVE; |
462 | 463 |
break; |
463 | 464 |
} |
464 | 465 |
// the S signal was deactivated |
465 |
if (ioflags & MODULE_SSSP_EVENTFLAGS_SYNC) {
|
|
466 |
if (ioflags & MODULE_SSSP_EVENTFLAG_S) {
|
|
466 | 467 |
apalControlGpioState_t sstate; |
467 |
apalControlGpioGet(&moduleSsspGpioSync, &sstate);
|
|
468 |
apalControlGpioGet(&moduleSsspGpioS, &sstate); |
|
468 | 469 |
if (sstate == APAL_GPIO_ON) { |
469 | 470 |
aosDbgPrintf("S evt (enabled)\n"); |
470 | 471 |
} else { |
... | ... | |
541 | 542 |
} |
542 | 543 |
// activate S |
543 | 544 |
aosDbgPrintf("enabling S\n"); |
544 |
apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_ON);
|
|
545 |
apalControlGpioSet(&moduleSsspGpioS, APAL_GPIO_ON); |
|
545 | 546 |
#if (AMIROOS_CFG_SSSP_STACK_START == true) |
546 | 547 |
// proceed immediately |
547 | 548 |
stage = STAGE_3_2; |
... | ... | |
573 | 574 |
eventmask &= ~(eventListenerTimeout.events); |
574 | 575 |
// activate S |
575 | 576 |
aosDbgPrintf("enabling S\n"); |
576 |
apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_ON);
|
|
577 |
apalControlGpioSet(&moduleSsspGpioS, APAL_GPIO_ON); |
|
577 | 578 |
#if (AMIROOS_CFG_SSSP_STACK_START == true) |
578 | 579 |
// proceed |
579 | 580 |
stage = STAGE_3_2; |
... | ... | |
629 | 630 |
if (eventmask & eventListenerDelay.events) { |
630 | 631 |
// activate UP |
631 | 632 |
aosDbgPrintf("enabling UP\n"); |
632 |
apalControlGpioSet(&moduleSsspGpioUp, APAL_GPIO_ON);
|
|
633 |
apalControlGpioSet(&moduleSsspGpioUP, APAL_GPIO_ON);
|
|
633 | 634 |
// deactivate S |
634 | 635 |
aosDbgPrintf("disabling S\n"); |
635 |
apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_OFF);
|
|
636 |
apalControlGpioSet(&moduleSsspGpioS, APAL_GPIO_OFF); |
|
636 | 637 |
// explicitely clear timeout event flag |
637 | 638 |
chEvtWaitAnyTimeout(eventListenerTimeout.events, TIME_IMMEDIATE); |
638 | 639 |
eventmask &= ~(eventListenerTimeout.events); |
... | ... | |
712 | 713 |
} |
713 | 714 |
|
714 | 715 |
// if an IO event was received (DN signal) |
715 |
if ((eventmask & _eventListenerIO.events) && (ioflags & MODULE_SSSP_EVENTFLAGS_DN)) {
|
|
716 |
if ((eventmask & _eventListenerGPIO.events) && (ioflags & MODULE_SSSP_EVENTFLAG_DN)) {
|
|
716 | 717 |
aosDbgPrintf("DN evt\n"); |
717 | 718 |
// reset timeout timer |
718 | 719 |
chVTReset(&timerTimeout); |
... | ... | |
737 | 738 |
#if (AMIROOS_CFG_SSSP_STACK_END != true) |
738 | 739 |
// activate UP |
739 | 740 |
aosDbgPrintf("enabling UP\n"); |
740 |
apalControlGpioSet(&moduleSsspGpioUp, APAL_GPIO_ON);
|
|
741 |
apalControlGpioSet(&moduleSsspGpioUP, APAL_GPIO_ON);
|
|
741 | 742 |
#endif /* (AMIROOS_CFG_SSSP_STACK_END != true) */ |
742 | 743 |
// deactivate S |
743 | 744 |
aosDbgPrintf("disabling S\n"); |
744 |
apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_OFF);
|
|
745 |
apalControlGpioSet(&moduleSsspGpioS, APAL_GPIO_OFF); |
|
745 | 746 |
// reset the timeout timer |
746 | 747 |
chVTSet(&timerTimeout, chTimeUS2I(AOS_SYSTEM_SSSP_TIMEOUT), _ssspTimerCallback, &eventSourceTimeout); |
747 | 748 |
chEvtWaitAnyTimeout(eventListenerTimeout.events, TIME_IMMEDIATE); |
... | ... | |
787 | 788 |
aos.sssp.stage = AOS_SSSP_STARTUP_3_4; |
788 | 789 |
|
789 | 790 |
// if an IO event was received (S signal) |
790 |
if ((eventmask & _eventListenerIO.events) && (ioflags & MODULE_SSSP_EVENTFLAGS_SYNC)) {
|
|
791 |
if ((eventmask & _eventListenerGPIO.events) && (ioflags & MODULE_SSSP_EVENTFLAG_S)) {
|
|
791 | 792 |
// reset the timeout timer |
792 | 793 |
chVTReset(&timerTimeout); |
793 | 794 |
chEvtWaitAnyTimeout(eventListenerTimeout.events, TIME_IMMEDIATE); |
... | ... | |
843 | 844 |
|
844 | 845 |
// deactivate S |
845 | 846 |
aosDbgPrintf("disabling SYNC\n"); |
846 |
apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_OFF);
|
|
847 |
apalControlGpioSet(&moduleSsspGpioS, APAL_GPIO_OFF); |
|
847 | 848 |
// invalidate module ID |
848 | 849 |
aos.sssp.moduleId = 0; |
849 | 850 |
|
850 | 851 |
// if an IO event was received (S signal) |
851 |
if ((eventmask & _eventListenerIO.events) && (ioflags & MODULE_SSSP_EVENTFLAGS_SYNC)) {
|
|
852 |
if ((eventmask & _eventListenerGPIO.events) && (ioflags & MODULE_SSSP_EVENTFLAG_S)) {
|
|
852 | 853 |
aosDbgPrintf("sequence aborted\n"); |
853 | 854 |
// exit the sequence |
854 | 855 |
flags.loop = false; |
... | ... | |
886 | 887 |
// reset all control signals |
887 | 888 |
#if (AMIROOS_CFG_SSSP_STACK_END != true) |
888 | 889 |
aosDbgPrintf("disabling UP\n"); |
889 |
apalControlGpioSet(&moduleSsspGpioUp, APAL_GPIO_OFF);
|
|
890 |
apalControlGpioSet(&moduleSsspGpioUP, APAL_GPIO_OFF);
|
|
890 | 891 |
#endif /* (AMIROOS_CFG_SSSP_STACK_END != true) */ |
891 | 892 |
aosDbgPrintf("disabling S\n"); |
892 |
apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_OFF);
|
|
893 |
apalControlGpioSet(&moduleSsspGpioS, APAL_GPIO_OFF); |
|
893 | 894 |
aosSysGetUptime(&uptime); |
894 | 895 |
aosDbgPrintf("done\t%04ums\n", (uint32_t)(uptime / MICROSECONDS_PER_MILLISECOND)); |
895 | 896 |
|
... | ... | |
905 | 906 |
// local variables |
906 | 907 |
eventmask_t eventmask = 0; |
907 | 908 |
eventflags_t eventflags = 0; |
908 |
eventflags_t ioeventflagsmask = AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK;
|
|
909 |
eventflags_t gpioeventflagsmask = AMIROOS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK;
|
|
909 | 910 |
aos_shutdown_t shutdown = AOS_SHUTDOWN_NONE; |
910 | 911 |
#if defined(AMIROOS_CFG_MAIN_EXTRA_THREAD_VARIABLES) |
911 | 912 |
AMIROOS_CFG_MAIN_EXTRA_THREAD_VARIABLES |
... | ... | |
977 | 978 |
|
978 | 979 |
/* event associations */ |
979 | 980 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
980 |
ioeventflagsmask |= MODULE_SSSP_EVENTFLAGS_PD | MODULE_SSSP_EVENTFLAGS_SYNC;
|
|
981 |
gpioeventflagsmask |= MODULE_SSSP_EVENTFLAG_PD | MODULE_SSSP_EVENTFLAG_S;
|
|
981 | 982 |
#if (AMIROOS_CFG_SSSP_STACK_START != true) |
982 |
ioeventflagsmask |= MODULE_SSSP_EVENTFLAGS_DN;
|
|
983 |
gpioeventflagsmask |= MODULE_SSSP_EVENTFLAG_DN;
|
|
983 | 984 |
#endif /* (AMIROOS_CFG_SSSP_STACK_START != true) */ |
984 | 985 |
#if (AMIROOS_CFG_SSSP_STACK_END != true) |
985 |
ioeventflagsmask |= MODULE_SSSP_EVENTFLAGS_UP;
|
|
986 |
gpioeventflagsmask |= MODULE_SSSP_EVENTFLAG_UP;
|
|
986 | 987 |
#endif /* (AMIROOS_CFG_SSSP_STACK_END != true) */ |
987 | 988 |
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */ |
988 |
if (ioeventflagsmask != 0) { |
|
989 |
chEvtRegisterMaskWithFlags(&aos.events.io, &_eventListenerIO, IOEVENT_MASK, ioeventflagsmask);
|
|
989 |
if (gpioeventflagsmask != 0) {
|
|
990 |
chEvtRegisterMaskWithFlags(&aos.events.gpio, &_eventListenerGPIO, GPIOEVENT_MASK, gpioeventflagsmask);
|
|
990 | 991 |
} |
991 | 992 |
chEvtRegisterMask(&aos.events.os, &_eventListenerOS, OSEVENT_MASK); |
992 | 993 |
|
... | ... | |
1073 | 1074 |
|
1074 | 1075 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
1075 | 1076 |
/* SSSP startup OS synchronization phase (end of startup stage 2) */ |
1076 |
while ((shutdown == AOS_SHUTDOWN_NONE) && (eventmask = aosSysSsspStartupOsInitSyncCheck(&_eventListenerIO)) != 0) { |
|
1077 |
while ((shutdown == AOS_SHUTDOWN_NONE) && (eventmask = aosSysSsspStartupOsInitSyncCheck(&_eventListenerGPIO)) != 0) {
|
|
1077 | 1078 |
/* |
1078 | 1079 |
* This code is executed if the received event was not about the SYS_SYNC control signal. |
1079 | 1080 |
* The returned event could be caused by any listener (not only the argument). |
1080 | 1081 |
*/ |
1081 |
// IO event |
|
1082 |
if (eventmask & _eventListenerIO.events) { |
|
1083 |
eventflags = chEvtGetAndClearFlags(&_eventListenerIO); |
|
1082 |
// GPIO event
|
|
1083 |
if (eventmask & _eventListenerGPIO.events) {
|
|
1084 |
eventflags = chEvtGetAndClearFlags(&_eventListenerGPIO);
|
|
1084 | 1085 |
// PD event |
1085 |
if (eventflags & MODULE_SSSP_EVENTFLAGS_PD) {
|
|
1086 |
if (eventflags & MODULE_SSSP_EVENTFLAG_PD) { |
|
1086 | 1087 |
shutdown = AOS_SHUTDOWN_PASSIVE; |
1087 | 1088 |
} else { |
1088 | 1089 |
#if defined(MODULE_SSSP_STARTUP_2_2_IOEVENT_HOOK) |
... | ... | |
1225 | 1226 |
#endif /* defined(AMIROOS_CFG_MAIN_LOOP_HOOK_0) */ |
1226 | 1227 |
|
1227 | 1228 |
switch (eventmask) { |
1228 |
// if this was an I/O event
|
|
1229 |
case IOEVENT_MASK: |
|
1229 |
// if this was an GPIO event
|
|
1230 |
case GPIOEVENT_MASK:
|
|
1230 | 1231 |
// evaluate flags |
1231 |
eventflags = chEvtGetAndClearFlags(&_eventListenerIO); |
|
1232 |
eventflags = chEvtGetAndClearFlags(&_eventListenerGPIO);
|
|
1232 | 1233 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
1233 | 1234 |
// PD event |
1234 |
if (eventflags & MODULE_SSSP_EVENTFLAGS_PD) {
|
|
1235 |
if (eventflags & MODULE_SSSP_EVENTFLAG_PD) { |
|
1235 | 1236 |
shutdown = AOS_SHUTDOWN_PASSIVE; |
1236 | 1237 |
} |
1237 | 1238 |
// all other events |
1238 |
#if defined(MODULE_MAIN_LOOP_IO_EVENT)
|
|
1239 |
#if defined(MODULE_MAIN_LOOP_GPIOEVENT)
|
|
1239 | 1240 |
else { |
1240 |
MODULE_MAIN_LOOP_IO_EVENT(eventflags);
|
|
1241 |
MODULE_MAIN_LOOP_GPIOEVENT(eventflags);
|
|
1241 | 1242 |
} |
1242 |
#endif /* defined(MODULE_MAIN_LOOP_IO_EVENT) */
|
|
1243 |
#endif /* defined(MODULE_MAIN_LOOP_GPIOEVENT) */
|
|
1243 | 1244 |
#else /* (AMIROOS_CFG_SSSP_ENABLE == true) */ |
1244 |
#if defined(MODULE_MAIN_LOOP_IO_EVENT)
|
|
1245 |
MODULE_MAIN_LOOP_IO_EVENT(eventflags);
|
|
1246 |
#endif /* defined(MODULE_MAIN_LOOP_IO_EVENT) */
|
|
1245 |
#if defined(MODULE_MAIN_LOOP_GPIOEVENT)
|
|
1246 |
MODULE_MAIN_LOOP_GPIOEVENT(eventflags);
|
|
1247 |
#endif /* defined(MODULE_MAIN_LOOP_GPIOEVENT) */
|
|
1247 | 1248 |
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */ |
1248 | 1249 |
break; |
1249 | 1250 |
|
core/src/aos_system.c | ||
---|---|---|
661 | 661 |
* |
662 | 662 |
* @param[in] args Pointer to the GPIO line identifier. |
663 | 663 |
*/ |
664 |
static void _extiCallback(void* args)
|
|
664 |
static void _gpioCallback(void* args)
|
|
665 | 665 |
{ |
666 | 666 |
aosDbgCheck((args != NULL) && (*((ioline_t*)args) != PAL_NOLINE) && (PAL_PAD(*((ioline_t*)args)) < sizeof(eventflags_t) * 8)); |
667 | 667 |
|
668 | 668 |
chSysLockFromISR(); |
669 |
chEvtBroadcastFlagsI(&aos.events.io, AOS_IOEVENT_FLAG(PAL_PAD(*((ioline_t*)args))));
|
|
669 |
chEvtBroadcastFlagsI(&aos.events.gpio, AOS_GPIOEVENT_FLAG(PAL_PAD(*((ioline_t*)args))));
|
|
670 | 670 |
chSysUnlockFromISR(); |
671 | 671 |
|
672 | 672 |
return; |
... | ... | |
690 | 690 |
// if the system is in operation phase |
691 | 691 |
if (aos.sssp.stage == AOS_SSSP_OPERATION) { |
692 | 692 |
// read signal S |
693 |
apalControlGpioGet(&moduleSsspGpioSync, &s_state);
|
|
693 |
apalControlGpioGet(&moduleSsspGpioS, &s_state); |
|
694 | 694 |
// if S was toggled from on to off |
695 | 695 |
if (s_state == APAL_GPIO_OFF) { |
696 | 696 |
// get current uptime |
... | ... | |
710 | 710 |
} |
711 | 711 |
} |
712 | 712 |
// broadcast event |
713 |
chEvtBroadcastFlagsI(&aos.events.io, AOS_IOEVENT_FLAG(PAL_PAD(*((ioline_t*)args))));
|
|
713 |
chEvtBroadcastFlagsI(&aos.events.gpio, AOS_GPIOEVENT_FLAG(PAL_PAD(*((ioline_t*)args))));
|
|
714 | 714 |
chSysUnlockFromISR(); |
715 | 715 |
|
716 | 716 |
return; |
... | ... | |
755 | 755 |
|
756 | 756 |
chSysLockFromISR(); |
757 | 757 |
// toggle and read signal S |
758 |
apalGpioToggle(moduleSsspGpioSync.gpio);
|
|
759 |
apalControlGpioGet(&moduleSsspGpioSync, &s_state);
|
|
758 |
apalGpioToggle(moduleSsspGpioS.gpio); |
|
759 |
apalControlGpioGet(&moduleSsspGpioS, &s_state); |
|
760 | 760 |
// if S was toggled from off to on |
761 | 761 |
if (s_state == APAL_GPIO_ON) { |
762 | 762 |
// reconfigure the timer precisely, because the logically falling edge (next interrupt) snychronizes the system time |
... | ... | |
817 | 817 |
aos.sssp.moduleId = 0; |
818 | 818 |
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */ |
819 | 819 |
aosIOStreamInit(&aos.iostream); |
820 |
chEvtObjectInit(&aos.events.io); |
|
820 |
chEvtObjectInit(&aos.events.gpio);
|
|
821 | 821 |
chEvtObjectInit(&aos.events.os); |
822 | 822 |
|
823 | 823 |
/* interrupt setup */ |
824 | 824 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
825 | 825 |
// PD signal |
826 |
palSetLineCallback(moduleSsspGpioPd.gpio->line, _extiCallback, &moduleSsspGpioPd.gpio->line);
|
|
827 |
palEnableLineEvent(moduleSsspGpioPd.gpio->line, APAL2CH_EDGE(moduleSsspGpioPd.meta.edge));
|
|
826 |
palSetLineCallback(moduleSsspGpioPD.gpio->line, _gpioCallback, &moduleSsspGpioPD.gpio->line);
|
|
827 |
palEnableLineEvent(moduleSsspGpioPD.gpio->line, APAL2CH_EDGE(moduleSsspGpioPD.meta.edge));
|
|
828 | 828 |
// SYNC signal |
829 | 829 |
#if (AMIROOS_CFG_SSSP_MASTER == true) |
830 |
palSetLineCallback(moduleSsspGpioSync.gpio->line, _extiCallback, &moduleSsspGpioSync.gpio->line);
|
|
830 |
palSetLineCallback(moduleSsspGpioS.gpio->line, _gpioCallback, &moduleSsspGpioS.gpio->line);
|
|
831 | 831 |
#else /* (AMIROOS_CFG_SSSP_MASTER == true) */ |
832 |
palSetLineCallback(moduleSsspGpioSync.gpio->line, _signalSyncCallback, &moduleSsspGpioSync.gpio->line);
|
|
832 |
palSetLineCallback(moduleSsspGpioS.gpio->line, _signalSyncCallback, &moduleSsspGpioS.gpio->line);
|
|
833 | 833 |
#endif /* (AMIROOS_CFG_SSSP_MASTER == true) */ |
834 |
palEnableLineEvent(moduleSsspGpioSync.gpio->line, APAL2CH_EDGE(moduleSsspGpioSync.meta.edge));
|
|
834 |
palEnableLineEvent(moduleSsspGpioS.gpio->line, APAL2CH_EDGE(moduleSsspGpioS.meta.edge));
|
|
835 | 835 |
#if (AMIROOS_CFG_SSSP_STACK_START != true) |
836 | 836 |
// DN signal |
837 |
palSetLineCallback(moduleSsspGpioDn.gpio->line, _extiCallback, &moduleSsspGpioDn.gpio->line);
|
|
838 |
palEnableLineEvent(moduleSsspGpioDn.gpio->line, APAL2CH_EDGE(moduleSsspGpioDn.meta.edge));
|
|
837 |
palSetLineCallback(moduleSsspGpioDN.gpio->line, _gpioCallback, &moduleSsspGpioDN.gpio->line);
|
|
838 |
palEnableLineEvent(moduleSsspGpioDN.gpio->line, APAL2CH_EDGE(moduleSsspGpioDN.meta.edge));
|
|
839 | 839 |
#endif /* (AMIROOS_CFG_SSSP_STACK_START != true) */ |
840 | 840 |
#if (AMIROOS_CFG_SSSP_STACK_END != true) |
841 | 841 |
// UP signal |
842 |
palSetLineCallback(moduleSsspGpioUp.gpio->line, _extiCallback, &moduleSsspGpioUp.gpio->line);
|
|
843 |
palEnableLineEvent(moduleSsspGpioUp.gpio->line, APAL2CH_EDGE(moduleSsspGpioUp.meta.edge));
|
|
842 |
palSetLineCallback(moduleSsspGpioUP.gpio->line, _gpioCallback, &moduleSsspGpioUP.gpio->line);
|
|
843 |
palEnableLineEvent(moduleSsspGpioUP.gpio->line, APAL2CH_EDGE(moduleSsspGpioUP.meta.edge));
|
|
844 | 844 |
#endif /* (AMIROOS_CFG_SSSP_STACK_END != true) */ |
845 | 845 |
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */ |
846 | 846 |
|
... | ... | |
926 | 926 |
aos.sssp.stage = AOS_SSSP_STARTUP_2_2; |
927 | 927 |
|
928 | 928 |
// deactivate the sync signal to indicate that the module is ready (SSSPv1 stage 2.1 of startup phase) |
929 |
apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_OFF);
|
|
929 |
apalControlGpioSet(&moduleSsspGpioS, APAL_GPIO_OFF); |
|
930 | 930 |
|
931 | 931 |
// wait for any event to occur (do not apply any filter in order not to miss any event) |
932 | 932 |
m = chEvtWaitOne(ALL_EVENTS); |
933 | 933 |
f = chEvtGetAndClearFlags(syncEvtListener); |
934 |
apalControlGpioGet(&moduleSsspGpioSync, &s);
|
|
934 |
apalControlGpioGet(&moduleSsspGpioS, &s); |
|
935 | 935 |
|
936 | 936 |
// if the event was a system event, |
937 | 937 |
// and it was fired because of the SysSync control signal, |
938 | 938 |
// and the SysSync control signal has been deactivated |
939 | 939 |
if (m & syncEvtListener->events && |
940 |
f == MODULE_SSSP_EVENTFLAGS_SYNC &&
|
|
940 |
f == MODULE_SSSP_EVENTFLAG_S &&
|
|
941 | 941 |
s == APAL_GPIO_OFF) { |
942 | 942 |
chSysLock(); |
943 | 943 |
// start the uptime counter |
... | ... | |
1030 | 1030 |
chSysLock(); |
1031 | 1031 |
// activate the SYS_PD control signal only, if this module initiated the shutdown |
1032 | 1032 |
if (shutdown != AOS_SHUTDOWN_PASSIVE) { |
1033 |
apalControlGpioSet(&moduleSsspGpioPd, APAL_GPIO_ON);
|
|
1033 |
apalControlGpioSet(&moduleSsspGpioPD, APAL_GPIO_ON);
|
|
1034 | 1034 |
} |
1035 | 1035 |
// activate the SYS_SYNC signal |
1036 |
apalControlGpioSet(&moduleSsspGpioSync, APAL_GPIO_ON);
|
|
1036 |
apalControlGpioSet(&moduleSsspGpioS, APAL_GPIO_ON); |
|
1037 | 1037 |
chSysUnlock(); |
1038 | 1038 |
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */ |
1039 | 1039 |
|
... | ... | |
1152 | 1152 |
* |
1153 | 1153 |
* @return Pointer to the callback function. |
1154 | 1154 |
*/ |
1155 |
palcallback_t aosSysGetStdExtiCallback(void)
|
|
1155 |
palcallback_t aosSysGetStdGpioCallback(void)
|
|
1156 | 1156 |
{ |
1157 |
return _extiCallback;
|
|
1157 |
return _gpioCallback;
|
|
1158 | 1158 |
} |
1159 | 1159 |
|
1160 | 1160 |
/** @} */ |
modules/DiWheelDrive_1-1/aosconf.h | ||
---|---|---|
80 | 80 |
#endif /* !defined(OS_CFG_PROFILE) */ |
81 | 81 |
|
82 | 82 |
/** |
83 |
* @brief Mask for the control thread to listen to certain IO events. |
|
83 |
* @brief Mask for the control thread to listen to certain GPIO events.
|
|
84 | 84 |
* @note Any mandatory events (e.g. for SSSP) are enabled implicitely despite this configuration. |
85 | 85 |
*/ |
86 |
#if !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK)
|
|
87 |
#define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK 0
|
|
88 |
#else /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */
|
|
89 |
#define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK OS_CFG_MAIN_LOOP_IOEVENT_MASK
|
|
90 |
#endif /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */
|
|
86 |
#if !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK)
|
|
87 |
#define AMIROOS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK 0
|
|
88 |
#else /* !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK) */
|
|
89 |
#define AMIROOS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK
|
|
90 |
#endif /* !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK) */
|
|
91 | 91 |
|
92 | 92 |
/** |
93 | 93 |
* @brief Timeout value when waiting for events in the main loop in microseconds. |
modules/DiWheelDrive_1-1/module.h | ||
---|---|---|
242 | 242 |
/** |
243 | 243 |
* @brief Event flag to be set on a SYS_SYNC interrupt. |
244 | 244 |
*/ |
245 |
#define MODULE_OS_IOEVENTFLAGS_SYSSYNC AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_INT_N))
|
|
245 |
#define MODULE_OS_GPIOEVENTFLAG_SYSSYNC AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_INT_N))
|
|
246 | 246 |
|
247 | 247 |
/** |
248 | 248 |
* @brief Event flag to be set on a SYS_WARMRST interrupt. |
249 | 249 |
*/ |
250 |
#define MODULE_OS_IOEVENTFLAGS_SYSWARMRST AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_WARMRST_N))
|
|
250 |
#define MODULE_OS_GPIOEVENTFLAG_SYSWARMRST AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_WARMRST_N))
|
|
251 | 251 |
|
252 | 252 |
/** |
253 | 253 |
* @brief Event flag to be set on a PATH_DCSTAT interrupt. |
254 | 254 |
*/ |
255 |
#define MODULE_OS_IOEVENTFLAGS_PATHDCSTAT AOS_IOEVENT_FLAG(PAL_PAD(LINE_PATH_DCEN))
|
|
255 |
#define MODULE_OS_GPIOEVENTFLAG_PATHDCSTAT AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_PATH_DCEN))
|
|
256 | 256 |
|
257 | 257 |
/** |
258 | 258 |
* @brief Event flag to be set on a COMPASS_DRDY interrupt. |
259 | 259 |
*/ |
260 |
#define MODULE_OS_IOEVENTFLAGS_COMPASSDRDY AOS_IOEVENT_FLAG(PAL_PAD(LINE_COMPASS_DRDY))
|
|
260 |
#define MODULE_OS_GPIOEVENTFLAG_COMPASSDRDY AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_COMPASS_DRDY))
|
|
261 | 261 |
|
262 | 262 |
/** |
263 | 263 |
* @brief Event flag to be set on a SYS_PD interrupt. |
264 | 264 |
*/ |
265 |
#define MODULE_OS_IOEVENTFLAGS_SYSPD AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_PD_N))
|
|
265 |
#define MODULE_OS_GPIOEVENTFLAG_SYSPD AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_PD_N))
|
|
266 | 266 |
|
267 | 267 |
/** |
268 | 268 |
* @brief Event flag to be set on a SYS_REG_EN interrupt. |
269 | 269 |
*/ |
270 |
#define MODULE_OS_IOEVENTFLAGS_SYSREGEN AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_REG_EN))
|
|
270 |
#define MODULE_OS_GPIOEVENTFLAG_SYSREGEN AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_REG_EN))
|
|
271 | 271 |
|
272 | 272 |
/** |
273 | 273 |
* @brief Event flag to be set on a IR_INT interrupt. |
274 | 274 |
*/ |
275 |
#define MODULE_OS_IOEVENTFLAGS_IRINT AOS_IOEVENT_FLAG(PAL_PAD(LINE_IR_INT))
|
|
275 |
#define MODULE_OS_GPIOEVENTFLAG_IRINT AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_IR_INT))
|
|
276 | 276 |
|
277 | 277 |
/** |
278 | 278 |
* @brief Event flag to be set on a GYRO_DRDY interrupt. |
279 | 279 |
*/ |
280 |
#define MODULE_OS_IOEVENTFLAGS_GYRODRDY AOS_IOEVENT_FLAG(PAL_PAD(LINE_GYRO_DRDY))
|
|
280 |
#define MODULE_OS_GPIOEVENTFLAG_GYRODRDY AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_GYRO_DRDY))
|
|
281 | 281 |
|
282 | 282 |
/** |
283 | 283 |
* @brief Event flag to be set on a SYS_UART_UP interrupt. |
284 | 284 |
*/ |
285 |
#define MODULE_OS_IOEVENTFLAGS_SYSUARTUP AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_UP))
|
|
285 |
#define MODULE_OS_GPIOEVENTFLAG_SYSUARTUP AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_UP))
|
|
286 | 286 |
|
287 | 287 |
/** |
288 | 288 |
* @brief Event flag to be set on a ACCEL_INT interrupt. |
289 | 289 |
*/ |
290 |
#define MODULE_OS_IOEVENTFLAGS_ACCELINT AOS_IOEVENT_FLAG(PAL_PAD(LINE_ACCEL_INT_N))
|
|
290 |
#define MODULE_OS_GPIOEVENTFLAG_ACCELINT AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_ACCEL_INT_N))
|
|
291 | 291 |
|
292 | 292 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__) |
293 | 293 |
/** |
... | ... | |
302 | 302 |
*/ |
303 | 303 |
#define MODULE_INIT_INTERRUPTS() { \ |
304 | 304 |
/* COMPASS_DRDY */ \ |
305 |
palSetLineCallback(moduleGpioCompassDrdy.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioCompassDrdy.gpio->line); \
|
|
305 |
palSetLineCallback(moduleGpioCompassDrdy.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioCompassDrdy.gpio->line); \
|
|
306 | 306 |
palEnableLineEvent(moduleGpioCompassDrdy.gpio->line, APAL2CH_EDGE(moduleGpioCompassDrdy.meta.edge)); \ |
307 | 307 |
/* IR_INT */ \ |
308 |
palSetLineCallback(moduleGpioIrInt.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioIrInt.gpio->line); \
|
|
308 |
palSetLineCallback(moduleGpioIrInt.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioIrInt.gpio->line); \
|
|
309 | 309 |
palEnableLineEvent(moduleGpioIrInt.gpio->line, APAL2CH_EDGE(moduleGpioIrInt.meta.edge)); \ |
310 | 310 |
/* GYRO_DRDY */ \ |
311 |
palSetLineCallback(moduleGpioGyroDrdy.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioGyroDrdy.gpio->line); \
|
|
311 |
palSetLineCallback(moduleGpioGyroDrdy.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioGyroDrdy.gpio->line); \
|
|
312 | 312 |
palEnableLineEvent(moduleGpioGyroDrdy.gpio->line, APAL2CH_EDGE(moduleGpioGyroDrdy.meta.edge)); \ |
313 | 313 |
/* ACCEL_INT */ \ |
314 |
palSetLineCallback(moduleGpioAccelInt.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioAccelInt.gpio->line); \
|
|
314 |
palSetLineCallback(moduleGpioAccelInt.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioAccelInt.gpio->line); \
|
|
315 | 315 |
palEnableLineEvent(moduleGpioAccelInt.gpio->line, APAL2CH_EDGE(moduleGpioAccelInt.meta.edge)); \ |
316 | 316 |
/* PATH_DCSTAT */ \ |
317 |
palSetLineCallback(moduleGpioPathDcStat.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioPathDcStat.gpio->line); \
|
|
317 |
palSetLineCallback(moduleGpioPathDcStat.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioPathDcStat.gpio->line); \
|
|
318 | 318 |
palEnableLineEvent(moduleGpioPathDcStat.gpio->line, APAL2CH_EDGE(moduleGpioPathDcStat.meta.edge)); \ |
319 | 319 |
/* SYS_REG_EN */ \ |
320 |
palSetLineCallback(moduleGpioSysRegEn.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioSysRegEn.gpio->line); \
|
|
320 |
palSetLineCallback(moduleGpioSysRegEn.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioSysRegEn.gpio->line); \
|
|
321 | 321 |
palEnableLineEvent(moduleGpioSysRegEn.gpio->line, APAL2CH_EDGE(moduleGpioSysRegEn.meta.edge)); \ |
322 | 322 |
/* SYS_WARMRST */ \ |
323 |
palSetLineCallback(moduleGpioSysWarmrst.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioSysWarmrst.gpio->line); \
|
|
323 |
palSetLineCallback(moduleGpioSysWarmrst.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioSysWarmrst.gpio->line); \
|
|
324 | 324 |
palEnableLineEvent(moduleGpioSysWarmrst.gpio->line, APAL2CH_EDGE(moduleGpioSysWarmrst.meta.edge)); \ |
325 | 325 |
} |
326 | 326 |
|
... | ... | |
328 | 328 |
* @brief Test initialization hook. |
329 | 329 |
*/ |
330 | 330 |
#define MODULE_INIT_TESTS() { \ |
331 |
/* initialize tests and add to shell */ \
|
|
331 |
/* add test commands to shell */ \
|
|
332 | 332 |
aosShellAddCommand(&aos.shell, &moduleTestA3906ShellCmd); \ |
333 | 333 |
aosShellAddCommand(&aos.shell, &moduleTestAt24c01bShellCmd); \ |
334 | 334 |
aosShellAddCommand(&aos.shell, &moduleTestHmc5883lShellCmd); \ |
... | ... | |
398 | 398 |
/** |
399 | 399 |
* @brief PD signal GPIO. |
400 | 400 |
*/ |
401 |
#define moduleSsspGpioPd moduleGpioSysPd
|
|
401 |
#define moduleSsspGpioPD moduleGpioSysPd
|
|
402 | 402 |
|
403 | 403 |
/** |
404 |
* @brief SYNC signal GPIO.
|
|
404 |
* @brief S signal GPIO. |
|
405 | 405 |
*/ |
406 |
#define moduleSsspGpioSync moduleGpioSysSync
|
|
406 |
#define moduleSsspGpioS moduleGpioSysSync
|
|
407 | 407 |
|
408 | 408 |
/** |
409 | 409 |
* @brief UP signal GPIO. |
410 | 410 |
*/ |
411 |
#define moduleSsspGpioUp moduleGpioSysUartUp
|
|
411 |
#define moduleSsspGpioUP moduleGpioSysUartUp
|
|
412 | 412 |
|
413 | 413 |
/** |
414 |
* @brief Event flags for PD signal events.
|
|
414 |
* @brief Event flag for PD signal events. |
|
415 | 415 |
*/ |
416 |
#define MODULE_SSSP_EVENTFLAGS_PD MODULE_OS_IOEVENTFLAGS_SYSPD
|
|
416 |
#define MODULE_SSSP_EVENTFLAG_PD MODULE_OS_GPIOEVENTFLAG_SYSPD
|
|
417 | 417 |
|
418 | 418 |
/** |
419 |
* @brief Event flags for SYNC signal events.
|
|
419 |
* @brief Event flag for S signal events.
|
|
420 | 420 |
*/ |
421 |
#define MODULE_SSSP_EVENTFLAGS_SYNC MODULE_OS_IOEVENTFLAGS_SYSSYNC
|
|
421 |
#define MODULE_SSSP_EVENTFLAG_S MODULE_OS_GPIOEVENTFLAG_SYSSYNC
|
|
422 | 422 |
|
423 | 423 |
/** |
424 |
* @brief Event flags for UP signal events.
|
|
424 |
* @brief Event flag for UP signal events. |
|
425 | 425 |
*/ |
426 |
#define MODULE_SSSP_EVENTFLAGS_UP MODULE_OS_IOEVENTFLAGS_SYSUARTUP
|
|
426 |
#define MODULE_SSSP_EVENTFLAG_UP MODULE_OS_GPIOEVENTFLAG_SYSUARTUP
|
|
427 | 427 |
|
428 | 428 |
/** @} */ |
429 | 429 |
|
modules/DiWheelDrive_1-1/test/HMC5883L/module_test_HMC5883L.c | ||
---|---|---|
41 | 41 |
|
42 | 42 |
static aos_test_hmc5883ldata_t _data = { |
43 | 43 |
/* HMC driver */ &moduleLldCompass, |
44 |
/* event source */ &aos.events.io, |
|
45 |
/* event flags */ MODULE_OS_IOEVENTFLAGS_COMPASSDRDY,
|
|
44 |
/* event source */ &aos.events.gpio,
|
|
45 |
/* event flags */ MODULE_OS_GPIOEVENTFLAG_COMPASSDRDY,
|
|
46 | 46 |
/* timeout */ MICROSECONDS_PER_SECOND, |
47 | 47 |
}; |
48 | 48 |
|
modules/DiWheelDrive_1-1/test/L3G4200D/module_test_L3G4200D.c | ||
---|---|---|
42 | 42 |
static aos_test_l3g4200ddata_t _data = { |
43 | 43 |
/* driver */ &moduleLldGyroscope, |
44 | 44 |
/* SPI configuration */ &moduleHalSpiGyroscopeConfig, |
45 |
/* event source */ &aos.events.io, |
|
46 |
/* event flags */ MODULE_OS_IOEVENTFLAGS_GYRODRDY,
|
|
45 |
/* event source */ &aos.events.gpio,
|
|
46 |
/* event flags */ MODULE_OS_GPIOEVENTFLAG_GYRODRDY,
|
|
47 | 47 |
}; |
48 | 48 |
|
49 | 49 |
static AOS_TEST(_test, "L3G4200D", "Gyroscope", moduleTestL3g4200dShellCb, aosTestL3g4200dFunc, &_data); |
modules/DiWheelDrive_1-1/test/LIS331DLH/module_test_LIS331DLH.c | ||
---|---|---|
42 | 42 |
static aos_test_lis331dlhdata_t _data = { |
43 | 43 |
/* driver */ &moduleLldAccelerometer, |
44 | 44 |
/* SPI configuration */ &moduleHalSpiAccelerometerConfig, |
45 |
/* event source */ &aos.events.io, |
|
46 |
/* event flags */ MODULE_OS_IOEVENTFLAGS_ACCELINT,
|
|
45 |
/* event source */ &aos.events.gpio,
|
|
46 |
/* event flags */ MODULE_OS_GPIOEVENTFLAG_ACCELINT,
|
|
47 | 47 |
}; |
48 | 48 |
|
49 | 49 |
static AOS_TEST(_test, "LIS331DLH", "Accelerometer", moduleTestLis331dlhShellCb, aosTestLis331dlhFunc, &_data); |
modules/DiWheelDrive_1-1/test/VCNL4020/module_test_VCNL4020.c | ||
---|---|---|
43 | 43 |
static aos_test_vcnl4020data_t _data = { |
44 | 44 |
/* driver */ &moduleLldProximity, |
45 | 45 |
/* timeout */ MICROSECONDS_PER_SECOND, |
46 |
/* event source */ &aos.events.io, |
|
47 |
/* event flags */ MODULE_OS_IOEVENTFLAGS_IRINT,
|
|
46 |
/* event source */ &aos.events.gpio,
|
|
47 |
/* event flags */ MODULE_OS_GPIOEVENTFLAG_IRINT,
|
|
48 | 48 |
}; |
49 | 49 |
|
50 | 50 |
static AOS_TEST(_test, "VCNL4020", "proximity sensor", moduleTestVcnl4020ShellCb, aosTestVcnl4020Func, &_data); |
modules/DiWheelDrive_1-2/aosconf.h | ||
---|---|---|
80 | 80 |
#endif /* !defined(OS_CFG_PROFILE) */ |
81 | 81 |
|
82 | 82 |
/** |
83 |
* @brief Mask for the control thread to listen to certain IO events. |
|
83 |
* @brief Mask for the control thread to listen to certain GPIO events.
|
|
84 | 84 |
* @note Any mandatory events (e.g. for SSSP) are enabled implicitely despite this configuration. |
85 | 85 |
*/ |
86 |
#if !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK)
|
|
87 |
#define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK 0
|
|
88 |
#else /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */
|
|
89 |
#define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK OS_CFG_MAIN_LOOP_IOEVENT_MASK
|
|
90 |
#endif /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */
|
|
86 |
#if !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK)
|
|
87 |
#define AMIROOS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK 0
|
|
88 |
#else /* !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK) */
|
|
89 |
#define AMIROOS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK
|
|
90 |
#endif /* !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK) */
|
|
91 | 91 |
|
92 | 92 |
/** |
93 | 93 |
* @brief Timeout value when waiting for events in the main loop in microseconds. |
modules/DiWheelDrive_1-2/module.h | ||
---|---|---|
232 | 232 |
/** |
233 | 233 |
* @brief Event flag to be set on a SYS_SYNC interrupt. |
234 | 234 |
*/ |
235 |
#define MODULE_OS_IOEVENTFLAGS_SYSSYNC AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_INT_N))
|
|
235 |
#define MODULE_OS_GPIOEVENTFLAG_SYSSYNC AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_INT_N))
|
|
236 | 236 |
|
237 | 237 |
/** |
238 | 238 |
* @brief Event flag to be set on a SYS_WARMRST interrupt. |
239 | 239 |
*/ |
240 |
#define MODULE_OS_IOEVENTFLAGS_SYSWARMRST AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_WARMRST_N))
|
|
240 |
#define MODULE_OS_GPIOEVENTFLAG_SYSWARMRST AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_WARMRST_N))
|
|
241 | 241 |
|
242 | 242 |
/** |
243 | 243 |
* @brief Event flag to be set on a PATH_DCSTAT interrupt. |
244 | 244 |
*/ |
245 |
#define MODULE_OS_IOEVENTFLAGS_PATHDCSTAT AOS_IOEVENT_FLAG(PAL_PAD(LINE_PATH_DCEN))
|
|
245 |
#define MODULE_OS_GPIOEVENTFLAG_PATHDCSTAT AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_PATH_DCEN))
|
|
246 | 246 |
|
247 | 247 |
/** |
248 | 248 |
* @brief Event flag to be set on a SYS_PD interrupt. |
249 | 249 |
*/ |
250 |
#define MODULE_OS_IOEVENTFLAGS_SYSPD AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_PD_N))
|
|
250 |
#define MODULE_OS_GPIOEVENTFLAG_SYSPD AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_PD_N))
|
|
251 | 251 |
|
252 | 252 |
/** |
253 | 253 |
* @brief Event flag to be set on a SYS_REG_EN interrupt. |
254 | 254 |
*/ |
255 |
#define MODULE_OS_IOEVENTFLAGS_SYSREGEN AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_REG_EN))
|
|
255 |
#define MODULE_OS_GPIOEVENTFLAG_SYSREGEN AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_REG_EN))
|
|
256 | 256 |
|
257 | 257 |
/** |
258 | 258 |
* @brief Event flag to be set on a IR_INT interrupt. |
259 | 259 |
*/ |
260 |
#define MODULE_OS_IOEVENTFLAGS_IRINT AOS_IOEVENT_FLAG(PAL_PAD(LINE_IR_INT))
|
|
260 |
#define MODULE_OS_GPIOEVENTFLAG_IRINT AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_IR_INT))
|
|
261 | 261 |
|
262 | 262 |
/** |
263 | 263 |
* @brief Event flag to be set on a SYS_UART_UP interrupt. |
264 | 264 |
*/ |
265 |
#define MODULE_OS_IOEVENTFLAGS_SYSUARTUP AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_UP))
|
|
265 |
#define MODULE_OS_GPIOEVENTFLAG_SYSUARTUP AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_UP))
|
|
266 | 266 |
|
267 | 267 |
/** |
268 | 268 |
* @brief Event flag to be set on a IMU_INT interrupt. |
269 | 269 |
*/ |
270 |
#define MODULE_OS_IOEVENTFLAGS_IMUINT AOS_IOEVENT_FLAG(PAL_PAD(LINE_IMU_INT))
|
|
270 |
#define MODULE_OS_GPIOEVENTFLAG_IMUINT AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_IMU_INT))
|
|
271 | 271 |
|
272 | 272 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__) |
273 | 273 |
/** |
... | ... | |
282 | 282 |
*/ |
283 | 283 |
#define MODULE_INIT_INTERRUPTS() { \ |
284 | 284 |
/* IR_INT */ \ |
285 |
palSetLineCallback(moduleGpioIrInt.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioIrInt.gpio->line); \
|
|
285 |
palSetLineCallback(moduleGpioIrInt.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioIrInt.gpio->line); \
|
|
286 | 286 |
palEnableLineEvent(moduleGpioIrInt.gpio->line, APAL2CH_EDGE(moduleGpioIrInt.meta.edge)); \ |
287 | 287 |
/* IMU_INT */ \ |
288 |
palSetLineCallback(moduleGpioImuInt.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioImuInt.gpio->line); \
|
|
288 |
palSetLineCallback(moduleGpioImuInt.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioImuInt.gpio->line); \
|
|
289 | 289 |
palEnableLineEvent(moduleGpioImuInt.gpio->line, APAL2CH_EDGE(moduleGpioImuInt.meta.edge)); \ |
290 | 290 |
/* PATH_DCSTAT */ \ |
291 |
palSetLineCallback(moduleGpioPathDcStat.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioPathDcStat.gpio->line); \
|
|
291 |
palSetLineCallback(moduleGpioPathDcStat.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioPathDcStat.gpio->line); \
|
|
292 | 292 |
palEnableLineEvent(moduleGpioPathDcStat.gpio->line, APAL2CH_EDGE(moduleGpioPathDcStat.meta.edge)); \ |
293 | 293 |
/* SYS_REG_EN */ \ |
294 |
palSetLineCallback(moduleGpioSysRegEn.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioSysRegEn.gpio->line); \
|
|
294 |
palSetLineCallback(moduleGpioSysRegEn.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioSysRegEn.gpio->line); \
|
|
295 | 295 |
palEnableLineEvent(moduleGpioSysRegEn.gpio->line, APAL2CH_EDGE(moduleGpioSysRegEn.meta.edge)); \ |
296 | 296 |
/* SYS_WARMRST */ \ |
297 |
palSetLineCallback(moduleGpioSysWarmrst.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioSysWarmrst.gpio->line); \
|
|
297 |
palSetLineCallback(moduleGpioSysWarmrst.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioSysWarmrst.gpio->line); \
|
|
298 | 298 |
palEnableLineEvent(moduleGpioSysWarmrst.gpio->line, APAL2CH_EDGE(moduleGpioSysWarmrst.meta.edge)); \ |
299 | 299 |
} |
300 | 300 |
|
... | ... | |
302 | 302 |
* @brief Test initialization hook. |
303 | 303 |
*/ |
304 | 304 |
#define MODULE_INIT_TESTS() { \ |
305 |
/* initialize tests and add to shell */ \
|
|
305 |
/* add test commands to shell */ \
|
|
306 | 306 |
aosShellAddCommand(&aos.shell, &moduleTestA3906ShellCmd); \ |
307 | 307 |
aosShellAddCommand(&aos.shell, &moduleTestAt24c01bShellCmd); \ |
308 | 308 |
/* TODO: add BNO055 test command */ \ |
... | ... | |
368 | 368 |
/** |
369 | 369 |
* @brief PD signal GPIO. |
370 | 370 |
*/ |
371 |
#define moduleSsspGpioPd moduleGpioSysPd
|
|
371 |
#define moduleSsspGpioPD moduleGpioSysPd
|
|
372 | 372 |
|
373 | 373 |
/** |
374 |
* @brief SYNC signal GPIO.
|
|
374 |
* @brief S signal GPIO. |
|
375 | 375 |
*/ |
376 |
#define moduleSsspGpioSync moduleGpioSysSync
|
|
376 |
#define moduleSsspGpioS moduleGpioSysSync
|
|
377 | 377 |
|
378 | 378 |
/** |
379 | 379 |
* @brief UP signal GPIO. |
380 | 380 |
*/ |
381 |
#define moduleSsspGpioUp moduleGpioSysUartUp
|
|
381 |
#define moduleSsspGpioUP moduleGpioSysUartUp
|
|
382 | 382 |
|
383 | 383 |
/** |
384 |
* @brief Event flags for PD signal events.
|
|
384 |
* @brief Event flag for PD signal events. |
|
385 | 385 |
*/ |
386 |
#define MODULE_SSSP_EVENTFLAGS_PD MODULE_OS_IOEVENTFLAGS_SYSPD
|
|
386 |
#define MODULE_SSSP_EVENTFLAG_PD MODULE_OS_GPIOEVENTFLAG_SYSPD
|
|
387 | 387 |
|
388 | 388 |
/** |
389 |
* @brief Event flags for SYNC signal events.
|
|
389 |
* @brief Event flag for S signal events.
|
|
390 | 390 |
*/ |
391 |
#define MODULE_SSSP_EVENTFLAGS_SYNC MODULE_OS_IOEVENTFLAGS_SYSSYNC
|
|
391 |
#define MODULE_SSSP_EVENTFLAG_S MODULE_OS_GPIOEVENTFLAG_SYSSYNC
|
|
392 | 392 |
|
393 | 393 |
/** |
394 |
* @brief Event flags for UP signal events.
|
|
394 |
* @brief Event flag for UP signal events. |
|
395 | 395 |
*/ |
396 |
#define MODULE_SSSP_EVENTFLAGS_UP MODULE_OS_IOEVENTFLAGS_SYSUARTUP
|
|
396 |
#define MODULE_SSSP_EVENTFLAG_UP MODULE_OS_GPIOEVENTFLAG_SYSUARTUP
|
|
397 | 397 |
|
398 | 398 |
/** @} */ |
399 | 399 |
|
modules/DiWheelDrive_1-2/test/VCNL4020/module_test_VCNL4020.c | ||
---|---|---|
43 | 43 |
static aos_test_vcnl4020data_t _data = { |
44 | 44 |
/* driver */ &moduleLldProximity, |
45 | 45 |
/* timeout */ MICROSECONDS_PER_SECOND, |
46 |
/* event source */ &aos.events.io, |
|
47 |
/* event flags */ MODULE_OS_IOEVENTFLAGS_IRINT,
|
|
46 |
/* event source */ &aos.events.gpio,
|
|
47 |
/* event flags */ MODULE_OS_GPIOEVENTFLAG_IRINT,
|
|
48 | 48 |
}; |
49 | 49 |
|
50 | 50 |
static AOS_TEST(_test, "VCNL4020", "proximity sensor", moduleTestVcnl4020ShellCb, aosTestVcnl4020Func, &_data); |
modules/LightRing_1-0/aosconf.h | ||
---|---|---|
80 | 80 |
#endif /* !defined(OS_CFG_PROFILE) */ |
81 | 81 |
|
82 | 82 |
/** |
83 |
* @brief Mask for the control thread to listen to certain IO events. |
|
83 |
* @brief Mask for the control thread to listen to certain GPIO events.
|
|
84 | 84 |
* @note Any mandatory events (e.g. for SSSP) are enabled implicitely despite this configuration. |
85 | 85 |
*/ |
86 |
#if !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK)
|
|
87 |
#define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK 0
|
|
88 |
#else /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */
|
|
89 |
#define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK OS_CFG_MAIN_LOOP_IOEVENT_MASK
|
|
90 |
#endif /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */
|
|
86 |
#if !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK)
|
|
87 |
#define AMIROOS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK 0
|
|
88 |
#else /* !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK) */
|
|
89 |
#define AMIROOS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK
|
|
90 |
#endif /* !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK) */
|
|
91 | 91 |
|
92 | 92 |
/** |
93 | 93 |
* @brief Timeout value when waiting for events in the main loop in microseconds. |
modules/LightRing_1-0/module.h | ||
---|---|---|
166 | 166 |
/** |
167 | 167 |
* @brief Event flag to be set on a LASER_OC interrupt. |
168 | 168 |
*/ |
169 |
#define MODULE_OS_IOEVENTFLAGS_LASEROC AOS_IOEVENT_FLAG(PAL_PAD(LINE_LASER_OC_N))
|
|
169 |
#define MODULE_OS_GPIOEVENTFLAG_LASEROC AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_LASER_OC_N))
|
|
170 | 170 |
|
171 | 171 |
/** |
172 | 172 |
* @brief Event flag to be set on a SYS_UART_DN interrupt. |
173 | 173 |
*/ |
174 |
#define MODULE_OS_IOEVENTFLAGS_SYSUARTDN AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_DN))
|
|
174 |
#define MODULE_OS_GPIOEVENTFLAG_SYSUARTDN AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_DN))
|
|
175 | 175 |
|
176 | 176 |
/** |
177 | 177 |
* @brief Event flag to be set on a WL_GDO2 interrupt. |
178 | 178 |
*/ |
179 |
#define MODULE_OS_IOEVENTFLAGS_WLGDO2 AOS_IOEVENT_FLAG(PAL_PAD(LINE_WL_GDO2))
|
|
179 |
#define MODULE_OS_GPIOEVENTFLAG_WLGDO2 AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_WL_GDO2))
|
|
180 | 180 |
|
181 | 181 |
/** |
182 | 182 |
* @brief Event flag to be set on a WL_GDO0 interrupt. |
183 | 183 |
*/ |
184 |
#define MODULE_OS_IOEVENTFLAGS_WLGDO0 AOS_IOEVENT_FLAG(PAL_PAD(LINE_WL_GDO0))
|
|
184 |
#define MODULE_OS_GPIOEVENTFLAG_WLGDO0 AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_WL_GDO0))
|
|
185 | 185 |
|
186 | 186 |
/** |
187 | 187 |
* @brief Event flag to be set on a SYS_PD interrupt. |
188 | 188 |
*/ |
189 |
#define MODULE_OS_IOEVENTFLAGS_SYSPD AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_PD_N))
|
|
189 |
#define MODULE_OS_GPIOEVENTFLAG_SYSPD AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_PD_N))
|
|
190 | 190 |
|
191 | 191 |
/** |
192 | 192 |
* @brief Event flag to be set on a SYS_SYNC interrupt. |
193 | 193 |
*/ |
194 |
#define MODULE_OS_IOEVENTFLAGS_SYSSYNC AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_INT_N))
|
|
194 |
#define MODULE_OS_GPIOEVENTFLAG_SYSSYNC AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_INT_N))
|
|
195 | 195 |
|
196 | 196 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__) |
197 | 197 |
/** |
... | ... | |
206 | 206 |
*/ |
207 | 207 |
#define MODULE_INIT_INTERRUPTS() { \ |
208 | 208 |
/* LASER_OC */ \ |
209 |
palSetLineCallback(moduleGpioLaserOc.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioLaserOc.gpio->line); \
|
|
209 |
palSetLineCallback(moduleGpioLaserOc.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioLaserOc.gpio->line); \
|
|
210 | 210 |
palEnableLineEvent(moduleGpioLaserOc.gpio->line, APAL2CH_EDGE(moduleGpioLaserOc.meta.edge)); \ |
211 | 211 |
/* WL_GDO2 */ \ |
212 |
palSetLineCallback(moduleGpioWlGdo2.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioWlGdo2.gpio->line); \
|
|
212 |
palSetLineCallback(moduleGpioWlGdo2.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioWlGdo2.gpio->line); \
|
|
213 | 213 |
palEnableLineEvent(moduleGpioWlGdo2.gpio->line, APAL2CH_EDGE(moduleGpioWlGdo2.meta.edge)); \ |
214 | 214 |
/* WL_GDO0 */ \ |
215 |
palSetLineCallback(moduleGpioWlGdo0.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioWlGdo0.gpio->line); \
|
|
215 |
palSetLineCallback(moduleGpioWlGdo0.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioWlGdo0.gpio->line); \
|
|
216 | 216 |
/*palEnableLineEvent(moduleGpioWlGdo0.gpio->line, APAL2CH_EDGE(moduleGpioWlGdo0.meta.edge)); // this is broken for some reason*/ \ |
217 | 217 |
} |
218 | 218 |
|
... | ... | |
220 | 220 |
* @brief Test initialization hook. |
221 | 221 |
*/ |
222 | 222 |
#define MODULE_INIT_TESTS() { \ |
223 |
/* initialize tests and add to shell */ \
|
|
223 |
/* add test commands to shell */ \
|
|
224 | 224 |
aosShellAddCommand(&aos.shell, &moduleTestAt24c01bShellCmd); \ |
225 | 225 |
aosShellAddCommand(&aos.shell, &moduleTestTlc5947ShellCmd); \ |
226 | 226 |
aosShellAddCommand(&aos.shell, &moduleTestTps2051bdbvShellCmd); \ |
... | ... | |
266 | 266 |
/** |
267 | 267 |
* @brief PD signal GPIO. |
268 | 268 |
*/ |
269 |
#define moduleSsspGpioPd moduleGpioSysPd
|
|
269 |
#define moduleSsspGpioPD moduleGpioSysPd
|
|
270 | 270 |
|
271 | 271 |
/** |
272 |
* @brief SYNC signal GPIO.
|
|
272 |
* @brief S signal GPIO. |
|
273 | 273 |
*/ |
274 |
#define moduleSsspGpioSync moduleGpioSysSync
|
|
274 |
#define moduleSsspGpioS moduleGpioSysSync
|
|
275 | 275 |
|
276 | 276 |
/** |
277 | 277 |
* @brief DN signal GPIO. |
278 | 278 |
*/ |
279 |
#define moduleSsspGpioDn moduleGpioSysUartDn
|
|
279 |
#define moduleSsspGpioDN moduleGpioSysUartDn
|
|
280 | 280 |
|
281 | 281 |
/** |
282 |
* @brief Event flags for PD signal events.
|
|
282 |
* @brief Event flag for PD signal events. |
|
283 | 283 |
*/ |
284 |
#define MODULE_SSSP_EVENTFLAGS_PD MODULE_OS_IOEVENTFLAGS_SYSPD
|
|
284 |
#define MODULE_SSSP_EVENTFLAG_PD MODULE_OS_GPIOEVENTFLAG_SYSPD
|
|
285 | 285 |
|
286 | 286 |
/** |
287 |
* @brief Event flags for SYNC signal events.
|
|
287 |
* @brief Event flag for S signal events.
|
|
288 | 288 |
*/ |
289 |
#define MODULE_SSSP_EVENTFLAGS_SYNC MODULE_OS_IOEVENTFLAGS_SYSSYNC
|
|
289 |
#define MODULE_SSSP_EVENTFLAG_S MODULE_OS_GPIOEVENTFLAG_SYSSYNC
|
|
290 | 290 |
|
291 | 291 |
/** |
292 |
* @brief Event flags for DN signal events.
|
|
292 |
* @brief Event flag for DN signal events. |
|
293 | 293 |
*/ |
294 |
#define MODULE_SSSP_EVENTFLAGS_DN MODULE_OS_IOEVENTFLAGS_SYSUARTDN
|
|
294 |
#define MODULE_SSSP_EVENTFLAG_DN MODULE_OS_GPIOEVENTFLAG_SYSUARTDN
|
|
295 | 295 |
|
296 | 296 |
/** @} */ |
297 | 297 |
|
modules/LightRing_1-2/aosconf.h | ||
---|---|---|
80 | 80 |
#endif /* !defined(OS_CFG_PROFILE) */ |
81 | 81 |
|
82 | 82 |
/** |
83 |
* @brief Mask for the control thread to listen to certain IO events. |
|
83 |
* @brief Mask for the control thread to listen to certain GPIO events.
|
|
84 | 84 |
* @note Any mandatory events (e.g. for SSSP) are enabled implicitely despite this configuration. |
85 | 85 |
*/ |
86 |
#if !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK)
|
|
87 |
#define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK 0
|
|
88 |
#else /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */
|
|
89 |
#define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK OS_CFG_MAIN_LOOP_IOEVENT_MASK
|
|
90 |
#endif /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */
|
|
86 |
#if !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK)
|
|
87 |
#define AMIROOS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK 0
|
|
88 |
#else /* !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK) */
|
|
89 |
#define AMIROOS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK
|
|
90 |
#endif /* !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK) */
|
|
91 | 91 |
|
92 | 92 |
/** |
93 | 93 |
* @brief Timeout value when waiting for events in the main loop in microseconds. |
modules/LightRing_1-2/module.h | ||
---|---|---|
246 | 246 |
/** |
247 | 247 |
* @brief Event flag to be set on a IO_4 (breakout) interrupt. |
248 | 248 |
*/ |
249 |
#define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO4 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_4))
|
|
249 |
#define MODULE_OS_GPIOEVENTFLAG_BREAKOUTIO4 AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_IO_4))
|
|
250 | 250 |
|
251 | 251 |
/** |
252 | 252 |
* @brief Event flag to be set on a IO_1 (breakout) interrupt. |
253 | 253 |
*/ |
254 |
#define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO1 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_1))
|
|
254 |
#define MODULE_OS_GPIOEVENTFLAG_BREAKOUTIO1 AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_IO_1))
|
|
255 | 255 |
|
256 | 256 |
/** |
257 | 257 |
* @brief Event flag to be set on a SYS_SYNC interrupt. |
258 | 258 |
*/ |
259 |
#define MODULE_OS_IOEVENTFLAGS_SYSSYNC AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_INT_N))
|
|
259 |
#define MODULE_OS_GPIOEVENTFLAG_SYSSYNC AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_INT_N))
|
|
260 | 260 |
|
261 | 261 |
/** |
262 | 262 |
* @brief Event flag to be set on a IO_3 (breakout) interrupt. |
263 | 263 |
*/ |
264 |
#define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO3 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_3))
|
|
264 |
#define MODULE_OS_GPIOEVENTFLAG_BREAKOUTIO3 AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_IO_3))
|
|
265 | 265 |
|
266 | 266 |
/** |
267 | 267 |
* @brief Event flag to be set on a IO_5 (breakout) interrupt. |
268 | 268 |
*/ |
269 |
#define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO5 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_5))
|
|
269 |
#define MODULE_OS_GPIOEVENTFLAG_BREAKOUTIO5 AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_IO_5))
|
|
270 | 270 |
|
271 | 271 |
/** |
272 | 272 |
* @brief Event flag to be set on a IO_6 (breakout) interrupt. |
273 | 273 |
*/ |
274 |
#define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO6 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_6))
|
|
274 |
#define MODULE_OS_GPIOEVENTFLAG_BREAKOUTIO6 AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_IO_6))
|
|
275 | 275 |
|
276 | 276 |
/** |
277 | 277 |
* @brief Event flag to be set on a SYS_UART_DN interrupt. |
278 | 278 |
*/ |
279 |
#define MODULE_OS_IOEVENTFLAGS_SYSUARTDN AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_DN))
|
|
279 |
#define MODULE_OS_GPIOEVENTFLAG_SYSUARTDN AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_DN))
|
|
280 | 280 |
|
281 | 281 |
/** |
282 | 282 |
* @brief Event flag to be set on a SYS_UART_UP interrupt. |
283 | 283 |
*/ |
284 |
#define MODULE_OS_IOEVENTFLAGS_SYSUARTUP AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_UP))
|
|
284 |
#define MODULE_OS_GPIOEVENTFLAG_SYSUARTUP AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_UART_UP))
|
|
285 | 285 |
|
286 | 286 |
/** |
287 | 287 |
* @brief Event flag to be set on a IO_7 (breakout) interrupt. |
288 | 288 |
*/ |
289 |
#define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO7 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_7))
|
|
289 |
#define MODULE_OS_GPIOEVENTFLAG_BREAKOUTIO7 AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_IO_7))
|
|
290 | 290 |
|
291 | 291 |
/** |
292 | 292 |
* @brief Event flag to be set on a IO_8 (breakout) interrupt. |
293 | 293 |
*/ |
294 |
#define MODULE_OS_IOEVENTFLAGS_BREAKOUTIO8 AOS_IOEVENT_FLAG(PAL_PAD(LINE_IO_8))
|
|
294 |
#define MODULE_OS_GPIOEVENTFLAG_BREAKOUTIO8 AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_IO_8))
|
|
295 | 295 |
|
296 | 296 |
/** |
297 | 297 |
* @brief Event flag to be set on a SYS_PD interrupt. |
298 | 298 |
*/ |
299 |
#define MODULE_OS_IOEVENTFLAGS_SYSPD AOS_IOEVENT_FLAG(PAL_PAD(LINE_SYS_PD_N))
|
|
299 |
#define MODULE_OS_GPIOEVENTFLAG_SYSPD AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_SYS_PD_N))
|
|
300 | 300 |
|
301 | 301 |
#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) || defined(__DOXYGEN__) |
302 | 302 |
|
303 | 303 |
/** |
304 | 304 |
* @brief Event flag to be set on a DW1000 interrupt. |
305 | 305 |
*/ |
306 |
#define MODULE_OS_IOEVENTFLAGS_DW1000 MODULE_OS_IOEVENTFLAGS_BREAKOUTIO8
|
|
306 |
#define MODULE_OS_GPIOEVENTFLAG_DW1000 MODULE_OS_GPIOEVENTFLAGS_BREAKOUTIO8
|
|
307 | 307 |
|
308 | 308 |
#endif /* (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) */ |
309 | 309 |
|
... | ... | |
324 | 324 |
} |
325 | 325 |
#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) |
326 | 326 |
#define MODULE_INIT_INTERRUPTS_BREAKOUT() { \ |
327 |
palSetLineCallback(moduleLldDw1000.gpio_exti->gpio->line, aosSysGetStdExtiCallback(), &moduleLldDw1000.gpio_exti->gpio->line); \
|
|
327 |
palSetLineCallback(moduleLldDw1000.gpio_exti->gpio->line, aosSysGetStdGpioCallback(), &moduleLldDw1000.gpio_exti->gpio->line); \
|
|
328 | 328 |
palEnableLineEvent(moduleLldDw1000.gpio_exti->gpio->line, APAL2CH_EDGE(moduleLldDw1000.gpio_exti->meta.edge)); \ |
329 | 329 |
} |
330 | 330 |
#elif (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_NONE) |
... | ... | |
333 | 333 |
#endif |
334 | 334 |
|
335 | 335 |
/** |
336 |
* @brief Unit test initialization hook.
|
|
336 |
* @brief Test initialization hook.
|
|
337 | 337 |
*/ |
338 | 338 |
#define MODULE_INIT_TESTS() { \ |
339 |
/* initialize tests and add to shell */ \
|
|
339 |
/* add test commands to shell */ \
|
|
340 | 340 |
aosShellAddCommand(&aos.shell, &moduleTestAt24c01bShellCmd); \ |
341 | 341 |
aosShellAddCommand(&aos.shell, &moduleTestIna219ShellCmd); \ |
342 | 342 |
aosShellAddCommand(&aos.shell, &moduleTestLedShellCmd); \ |
... | ... | |
383 | 383 |
* @brief Periphery communication interface deinitialization hook. |
384 | 384 |
*/ |
385 | 385 |
#define MODULE_SHUTDOWN_PERIPHERY_IF() { \ |
386 |
/* breakout module */ \ |
|
387 |
MODULE_SHUTDOWN_PERIPHERY_COMM_BREAKOUT(); \ |
|
386 | 388 |
/* SPI */ \ |
387 | 389 |
spiStop(&MODULE_HAL_SPI_LIGHT); \ |
388 | 390 |
/* I2C */ \ |
389 | 391 |
i2cStop(&MODULE_HAL_I2C_EEPROM_PWRMTR_BREAKOUT); \ |
390 |
/* breakout module */ \ |
|
391 |
MODULE_SHUTDOWN_PERIPHERY_COMM_BREAKOUT(); \ |
|
392 | 392 |
/* don't stop the serial driver so messages can still be printed */ \ |
393 | 393 |
} |
394 | 394 |
#if (BOARD_BREAKOUT_MODULE == BOARD_BREAKOUT_UWBv10) |
... | ... | |
413 | 413 |
/** |
414 | 414 |
* @brief PD signal GPIO. |
415 | 415 |
*/ |
416 |
#define moduleSsspGpioPd moduleGpioSysPd
|
|
416 |
#define moduleSsspGpioPD moduleGpioSysPd
|
|
417 | 417 |
|
418 | 418 |
/** |
419 |
* @brief SYNC signal GPIO.
|
|
419 |
* @brief S signal GPIO. |
|
420 | 420 |
*/ |
421 |
#define moduleSsspGpioSync moduleGpioSysSync
|
|
421 |
#define moduleSsspGpioS moduleGpioSysSync
|
|
422 | 422 |
|
423 | 423 |
/** |
424 | 424 |
* @brief UP signal GPIO. |
425 | 425 |
*/ |
426 |
#define moduleSsspGpioUp moduleGpioSysUartUp
|
|
426 |
#define moduleSsspGpioUP moduleGpioSysUartUp
|
|
427 | 427 |
|
428 | 428 |
/** |
429 | 429 |
* @brief DN signal GPIO. |
430 | 430 |
*/ |
431 |
#define moduleSsspGpioDn moduleGpioSysUartDn
|
|
431 |
#define moduleSsspGpioDN moduleGpioSysUartDn
|
|
432 | 432 |
|
433 | 433 |
/** |
434 |
* @brief Event flags for PD signal events.
|
|
434 |
* @brief Event flag for PD signal events. |
|
435 | 435 |
*/ |
436 |
#define MODULE_SSSP_EVENTFLAGS_PD MODULE_OS_IOEVENTFLAGS_SYSPD
|
|
436 |
#define MODULE_SSSP_EVENTFLAG_PD MODULE_OS_GPIOEVENTFLAG_SYSPD
|
|
437 | 437 |
|
438 | 438 |
/** |
439 |
* @brief Event flags for SYNC signal events.
|
|
439 |
* @brief Event flag for S signal events.
|
|
440 | 440 |
*/ |
441 |
#define MODULE_SSSP_EVENTFLAGS_SYNC MODULE_OS_IOEVENTFLAGS_SYSSYNC
|
|
441 |
#define MODULE_SSSP_EVENTFLAG_S MODULE_OS_GPIOEVENTFLAG_SYSSYNC
|
|
442 | 442 |
|
443 | 443 |
/** |
444 |
* @brief Event flags for UP signal events.
|
|
444 |
* @brief Event flag for UP signal events. |
|
445 | 445 |
*/ |
446 |
#define MODULE_SSSP_EVENTFLAGS_UP MODULE_OS_IOEVENTFLAGS_SYSUARTUP
|
|
446 |
#define MODULE_SSSP_EVENTFLAG_UP MODULE_OS_GPIOEVENTFLAGS_SYSUARTUP
|
|
447 | 447 |
|
448 | 448 |
/** |
449 |
* @brief Event flags for DN signal events.
|
|
449 |
* @brief Event flag for DN signal events. |
|
450 | 450 |
*/ |
451 |
#define MODULE_SSSP_EVENTFLAGS_DN MODULE_OS_IOEVENTFLAGS_SYSUARTDN
|
|
451 |
#define MODULE_SSSP_EVENTFLAG_DN MODULE_OS_GPIOEVENTFLAG_SYSUARTDN
|
|
452 | 452 |
|
453 | 453 |
/** @} */ |
454 | 454 |
|
modules/NUCLEO-F103RB/aosconf.h | ||
---|---|---|
80 | 80 |
#endif /* !defined(OS_CFG_PROFILE) */ |
81 | 81 |
|
82 | 82 |
/** |
83 |
* @brief Mask for the control thread to listen to certain IO events. |
|
83 |
* @brief Mask for the control thread to listen to certain GPIO events.
|
|
84 | 84 |
* @note Any mandatory events (e.g. for SSSP) are enabled implicitely despite this configuration. |
85 | 85 |
*/ |
86 |
#if !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) |
|
87 |
#define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK (MODULE_OS_IOEVENTFLAGS_DW1000_IRQn | MODULE_OS_IOEVENTFLAGS_USERBUTTON) |
|
88 |
// #define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK MODULE_OS_IOEVENTFLAGS_USERBUTTON |
|
89 |
#else /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */ |
|
90 |
#define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK OS_CFG_MAIN_LOOP_IOEVENT_MASK |
|
91 |
#endif /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */ |
|
86 |
#if !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK) |
|
87 |
#define AMIROOS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK MODULE_OS_GPIOEVENTFLAG_USERBUTTON |
|
88 |
#else /* !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK) */ |
|
89 |
#define AMIROOS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK |
|
90 |
#endif /* !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK) */ |
|
92 | 91 |
|
93 | 92 |
/** |
94 | 93 |
* @brief Timeout value when waiting for events in the main loop in microseconds. |
modules/NUCLEO-F103RB/module.h | ||
---|---|---|
147 | 147 |
/** |
148 | 148 |
* @brief Event flag to be call dwt_isr() interrupt. |
149 | 149 |
*/ |
150 |
#define MODULE_OS_IOEVENTFLAGS_DW1000_IRQn AOS_IOEVENT_FLAG(PAL_PAD(LINE_ARD_D14))
|
|
150 |
#define MODULE_OS_GPIOEVENTFLAG_DW1000_IRQn AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_ARD_D14))
|
|
151 | 151 |
//#endif /* (BOARD_DW1000_CONNECTED == true) */ |
152 | 152 |
|
153 | 153 |
/** |
154 | 154 |
* @brief Event flag to be set on a USER_BUTTON interrupt. |
155 | 155 |
*/ |
156 |
#define MODULE_OS_IOEVENTFLAGS_USERBUTTON AOS_IOEVENT_FLAG(PAL_PAD(LINE_BUTTON))
|
|
156 |
#define MODULE_OS_GPIOEVENTFLAG_USERBUTTON AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_BUTTON))
|
|
157 | 157 |
|
158 | 158 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__) |
159 | 159 |
/** |
... | ... | |
168 | 168 |
*/ |
169 | 169 |
#define MODULE_INIT_INTERRUPTS() { \ |
170 | 170 |
/* user button */ \ |
171 |
palSetLineCallback(moduleGpioUserButton.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioUserButton.gpio->line); \
|
|
171 |
palSetLineCallback(moduleGpioUserButton.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioUserButton.gpio->line); \
|
|
172 | 172 |
palEnableLineEvent(moduleGpioUserButton.gpio->line, APAL2CH_EDGE(moduleGpioUserButton.meta.edge)); \ |
173 | 173 |
MODULE_INIT_INTERRUPTS_DW1000(); \ |
174 | 174 |
} |
175 | 175 |
#if (BOARD_DW1000_CONNECTED == true) |
176 | 176 |
#define MODULE_INIT_INTERRUPTS_DW1000() { \ |
177 |
palSetLineCallback(moduleGpioDw1000Irqn.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioDw1000Irqn.gpio->line); \
|
|
177 |
palSetLineCallback(moduleGpioDw1000Irqn.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioDw1000Irqn.gpio->line); \
|
|
178 | 178 |
palEnableLineEvent(moduleGpioDw1000Irqn.gpio->line, APAL2CH_EDGE(moduleGpioDw1000Irqn.meta.edge)); \ |
179 | 179 |
} |
180 | 180 |
#else /* (BOARD_DW1000_CONNECTED == true) */ |
... | ... | |
187 | 187 |
* @brief Test initialization hook. |
188 | 188 |
*/ |
189 | 189 |
#define MODULE_INIT_TESTS() { \ |
190 |
/* initialize tests and add to shell */ \
|
|
190 |
/* add test commands to shell */ \
|
|
191 | 191 |
aosShellAddCommand(&aos.shell, &moduleTestLedShellCmd); \ |
192 | 192 |
aosShellAddCommand(&aos.shell, &moduleTestButtonShellCmd); \ |
193 | 193 |
MODULE_INIT_TESTS_DW1000(); \ |
... | ... | |
228 | 228 |
*/ |
229 | 229 |
#define MODULE_SHUTDOWN_PERIPHERY_IF() { \ |
230 | 230 |
MODULE_SHUTDOWN_PERIPHERY_IF_DW1000(); \ |
231 |
/* don't stop the serial driver so messages can still be printed */ \ |
|
231 | 232 |
} |
232 | 233 |
#if (BOARD_DW1000_CONNECTED == true) |
233 | 234 |
#define MODULE_SHUTDOWN_PERIPHERY_IF_DW1000() { \ |
... | ... | |
242 | 243 |
/** |
243 | 244 |
* @brief HOOK to toggle the LEDs when the user button is pressed. |
244 | 245 |
*/ |
245 |
#define MODULE_MAIN_LOOP_IO_EVENT(eventflags) { \
|
|
246 |
if (eventflags & MODULE_OS_IOEVENTFLAGS_USERBUTTON) { \
|
|
246 |
#define MODULE_MAIN_LOOP_GPIOEVENT(eventflags) { \
|
|
247 |
if (eventflags & MODULE_OS_GPIOEVENTFLAG_USERBUTTON) { \
|
|
247 | 248 |
apalControlGpioState_t buttonstate; \ |
248 | 249 |
apalControlGpioGet(&moduleGpioUserButton, &buttonstate); \ |
249 | 250 |
apalControlGpioSet(&moduleGpioLed, buttonstate); \ |
250 | 251 |
} \ |
251 |
MODULE_MAIN_LOOP_IO_EVENT_DW1000(); \
|
|
252 |
MODULE_MAIN_LOOP_GPIOEVENT_DW1000(); \
|
|
252 | 253 |
} |
253 | 254 |
#if (BOARD_DW1000_CONNECTED == true) |
254 | 255 |
/** |
255 | 256 |
* @brief HOOK to call process_deca_irq() func when the dw1000 interrupt pin is activated. |
256 | 257 |
*/ |
257 |
#define MODULE_MAIN_LOOP_IO_EVENT_DW1000() { \
|
|
258 |
if(eventflags & MODULE_OS_IOEVENTFLAGS_DW1000_IRQn) { \
|
|
258 |
#define MODULE_MAIN_LOOP_GPIOEVENT_DW1000() { \
|
|
259 |
if(eventflags & MODULE_GPOS_IOEVENTFLAG_DW1000_IRQn) { \
|
|
259 | 260 |
/*apalGpioToggle(moduleGpioLed.gpio);*/ /* just for debug*/ \ |
260 | 261 |
process_deca_irq(); \ |
261 | 262 |
} \ |
262 | 263 |
} |
263 | 264 |
#else /* (BOARD_DW1000_CONNECTED == true) */ |
264 |
#define MODULE_MAIN_LOOP_IO_EVENT_DW1000() { \
|
|
265 |
#define MODULE_MAIN_LOOP_GPIOEVENT_DW1000() { \
|
|
265 | 266 |
} |
266 | 267 |
#endif /* (BOARD_DW1000_CONNECTED == true) */ |
267 | 268 |
|
modules/NUCLEO-F103RB/test/DW1000/module_test_DW1000.c | ||
---|---|---|
42 | 42 |
|
43 | 43 |
static aos_test_dw1000data_t _data = { |
44 | 44 |
/* UWB data */ &moduleLldDw1000, |
45 |
/* event source */ &aos.events.io, |
|
46 |
/* event flags */ MODULE_OS_IOEVENTFLAGS_DW1000_IRQn,
|
|
45 |
/* event source */ &aos.events.gpio,
|
|
46 |
/* event flags */ MODULE_OS_GPIOEVENTFLAG_DW1000_IRQn,
|
|
47 | 47 |
}; |
48 | 48 |
|
49 | 49 |
static AOS_TEST(_test, "DW1000", NULL, moduleTestDw1000ShellCb, aosTestDw1000Func, &_data); |
modules/NUCLEO-F103RB/test/button/module_test_button.c | ||
---|---|---|
41 | 41 |
|
42 | 42 |
static aos_test_buttondata_t _data = { |
43 | 43 |
/* button */ &moduleLldUserButton, |
44 |
/* event source */ &aos.events.io, |
|
45 |
/* event flags */ MODULE_OS_IOEVENTFLAGS_USERBUTTON,
|
|
44 |
/* event source */ &aos.events.gpio,
|
|
45 |
/* event flags */ MODULE_OS_GPIOEVENTFLAG_USERBUTTON,
|
|
46 | 46 |
}; |
47 | 47 |
|
48 | 48 |
static AOS_TEST(_test, "button", NULL, moduleTestButtonShellCb, aosTestButtonFunc, &_data); |
modules/NUCLEO-F401RE/aosconf.h | ||
---|---|---|
80 | 80 |
#endif /* !defined(OS_CFG_PROFILE) */ |
81 | 81 |
|
82 | 82 |
/** |
83 |
* @brief Mask for the control thread to listen to certain IO events. |
|
83 |
* @brief Mask for the control thread to listen to certain GPIO events.
|
|
84 | 84 |
* @note Any mandatory events (e.g. for SSSP) are enabled implicitely despite this configuration. |
85 | 85 |
*/ |
86 |
#if !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK)
|
|
87 |
#define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK MODULE_OS_IOEVENTFLAGS_USERBUTTON
|
|
88 |
#else /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */
|
|
89 |
#define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK OS_CFG_MAIN_LOOP_IOEVENT_MASK
|
|
90 |
#endif /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */
|
|
86 |
#if !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK)
|
|
87 |
#define AMIROOS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK MODULE_OS_GPIOEVENTFLAG_USERBUTTON
|
|
88 |
#else /* !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK) */
|
|
89 |
#define AMIROOS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK
|
|
90 |
#endif /* !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK) */
|
|
91 | 91 |
|
92 | 92 |
/** |
93 | 93 |
* @brief Timeout value when waiting for events in the main loop in microseconds. |
modules/NUCLEO-F401RE/module.h | ||
---|---|---|
91 | 91 |
/** |
92 | 92 |
* @brief Event flag to be set on a USER_BUTTON interrupt. |
93 | 93 |
*/ |
94 |
#define MODULE_OS_IOEVENTFLAGS_USERBUTTON AOS_IOEVENT_FLAG(PAL_PAD(LINE_BUTTON))
|
|
94 |
#define MODULE_OS_GPIOEVENTFLAG_USERBUTTON AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_BUTTON))
|
|
95 | 95 |
|
96 | 96 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__) |
97 | 97 |
/** |
... | ... | |
106 | 106 |
*/ |
107 | 107 |
#define MODULE_INIT_INTERRUPTS() { \ |
108 | 108 |
/* user button */ \ |
109 |
palSetLineCallback(moduleGpioUserButton.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioUserButton.gpio->line); \
|
|
109 |
palSetLineCallback(moduleGpioUserButton.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioUserButton.gpio->line); \
|
|
110 | 110 |
palEnableLineEvent(moduleGpioUserButton.gpio->line, APAL2CH_EDGE(moduleGpioUserButton.meta.edge)); \ |
111 | 111 |
} |
112 | 112 |
|
113 | 113 |
/** |
114 |
* @brief Unit test initialization hook.
|
|
114 |
* @brief Test initialization hook.
|
|
115 | 115 |
*/ |
116 | 116 |
#define MODULE_INIT_TESTS() { \ |
117 |
/* add unit-test shell commands */ \
|
|
117 |
/* add test commands to shell */ \
|
|
118 | 118 |
} |
119 | 119 |
|
120 | 120 |
/** |
... | ... | |
129 | 129 |
* @brief Periphery communication interface deinitialization hook. |
130 | 130 |
*/ |
131 | 131 |
#define MODULE_SHUTDOWN_PERIPHERY_IF() { \ |
132 |
/* don't stop the serial driver so messages can still be printed */ \ |
|
132 | 133 |
} |
133 | 134 |
|
134 | 135 |
/** |
135 | 136 |
* @brief HOOK to toggle the LEDs when the user button is pressed. |
136 | 137 |
*/ |
137 |
#define MODULE_MAIN_LOOP_IO_EVENT(eventflags) { \
|
|
138 |
if (eventflags & MODULE_OS_IOEVENTFLAGS_USERBUTTON) { \
|
|
138 |
#define MODULE_MAIN_LOOP_GPIOEVENT(eventflags) { \
|
|
139 |
if (eventflags & MODULE_OS_GPIOEVENTFLAG_USERBUTTON) { \
|
|
139 | 140 |
apalControlGpioState_t buttonstate; \ |
140 | 141 |
apalControlGpioGet(&moduleGpioUserButton, &buttonstate); \ |
141 | 142 |
apalControlGpioSet(&moduleGpioLed, buttonstate); \ |
modules/NUCLEO-F767ZI/aosconf.h | ||
---|---|---|
80 | 80 |
#endif /* !defined(OS_CFG_PROFILE) */ |
81 | 81 |
|
82 | 82 |
/** |
83 |
* @brief Mask for the control thread to listen to certain IO events. |
|
83 |
* @brief Mask for the control thread to listen to certain GPIO events.
|
|
84 | 84 |
* @note Any mandatory events (e.g. for SSSP) are enabled implicitely despite this configuration. |
85 | 85 |
*/ |
86 |
#if !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK)
|
|
87 |
#define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK MODULE_OS_IOEVENTFLAGS_USERBUTTON
|
|
88 |
#else /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */
|
|
89 |
#define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK OS_CFG_MAIN_LOOP_IOEVENT_MASK
|
|
90 |
#endif /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */
|
|
86 |
#if !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK)
|
|
87 |
#define AMIROOS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK MODULE_OS_GPIOEVENTFLAG_USERBUTTON
|
|
88 |
#else /* !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK) */
|
|
89 |
#define AMIROOS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK
|
|
90 |
#endif /* !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK) */
|
|
91 | 91 |
|
92 | 92 |
/** |
93 | 93 |
* @brief Timeout value when waiting for events in the main loop in microseconds. |
modules/NUCLEO-F767ZI/module.h | ||
---|---|---|
101 | 101 |
/** |
102 | 102 |
* @brief Event flag to be set on a USER_BUTTON interrupt. |
103 | 103 |
*/ |
104 |
#define MODULE_OS_IOEVENTFLAGS_USERBUTTON AOS_IOEVENT_FLAG(PAL_PAD(LINE_BUTTON))
|
|
104 |
#define MODULE_OS_GPIOEVENTFLAG_USERBUTTON AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_BUTTON))
|
|
105 | 105 |
|
106 | 106 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__) |
107 | 107 |
/** |
... | ... | |
116 | 116 |
*/ |
117 | 117 |
#define MODULE_INIT_INTERRUPTS() { \ |
118 | 118 |
/* user button */ \ |
119 |
palSetLineCallback(moduleGpioUserButton.gpio->line, aosSysGetStdExtiCallback(), &moduleGpioUserButton.gpio->line); \
|
|
119 |
palSetLineCallback(moduleGpioUserButton.gpio->line, aosSysGetStdGpioCallback(), &moduleGpioUserButton.gpio->line); \
|
|
120 | 120 |
palEnableLineEvent(moduleGpioUserButton.gpio->line, APAL2CH_EDGE(moduleGpioUserButton.meta.edge)); \ |
121 | 121 |
} |
122 | 122 |
|
123 | 123 |
/** |
124 |
* @brief Unit test initialization hook.
|
|
124 |
* @brief Test initialization hook.
|
|
125 | 125 |
*/ |
126 | 126 |
#define MODULE_INIT_TESTS() { \ |
127 |
/* add unit-test shell commands */ \
|
|
127 |
/* add test commands to shell */ \
|
|
128 | 128 |
} |
129 | 129 |
|
130 | 130 |
/** |
... | ... | |
139 | 139 |
* @brief Periphery communication interface deinitialization hook. |
140 | 140 |
*/ |
141 | 141 |
#define MODULE_SHUTDOWN_PERIPHERY_IF() { \ |
142 |
/* don't stop the serial driver so messages can still be printed */ \ |
|
142 | 143 |
} |
143 | 144 |
|
144 | 145 |
/** |
145 | 146 |
* @brief HOOK to toggle the LEDs when the user button is pressed. |
146 | 147 |
*/ |
147 |
#define MODULE_MAIN_LOOP_IO_EVENT(eventflags) { \
|
|
148 |
if (eventflags & MODULE_OS_IOEVENTFLAGS_USERBUTTON) { \
|
|
148 |
#define MODULE_MAIN_LOOP_GPIOEVENT(eventflags) { \
|
|
149 |
if (eventflags & MODULE_OS_GPIOEVENTFLAG_USERBUTTON) { \
|
|
149 | 150 |
apalControlGpioState_t buttonstate; \ |
150 | 151 |
apalControlGpioGet(&moduleGpioUserButton, &buttonstate); \ |
151 | 152 |
apalControlGpioSet(&moduleGpioLed1, buttonstate); \ |
modules/NUCLEO-L476RG/aosconf.h | ||
---|---|---|
80 | 80 |
#endif /* !defined(OS_CFG_PROFILE) */ |
81 | 81 |
|
82 | 82 |
/** |
83 |
* @brief Mask for the control thread to listen to certain IO events. |
|
83 |
* @brief Mask for the control thread to listen to certain GPIO events.
|
|
84 | 84 |
* @note Any mandatory events (e.g. for SSSP) are enabled implicitely despite this configuration. |
85 | 85 |
*/ |
86 |
#if !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK)
|
|
87 |
#define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK MODULE_OS_IOEVENTFLAGS_USERBUTTON
|
|
88 |
#else /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */
|
|
89 |
#define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK OS_CFG_MAIN_LOOP_IOEVENT_MASK
|
|
90 |
#endif /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */
|
|
86 |
#if !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK)
|
|
87 |
#define AMIROOS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK MODULE_OS_GPIOEVENTFLAG_USERBUTTON
|
|
88 |
#else /* !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK) */
|
|
89 |
#define AMIROOS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK
|
|
90 |
#endif /* !defined(OS_CFG_MAIN_LOOP_GPIOEVENT_FLAGSMASK) */
|
|
91 | 91 |
|
92 | 92 |
/** |
93 | 93 |
* @brief Timeout value when waiting for events in the main loop in microseconds. |
modules/NUCLEO-L476RG/module.h | ||
---|---|---|
105 | 105 |
/** |
106 | 106 |
* @brief Event flag to be set on a USER_BUTTON interrupt. |
107 | 107 |
*/ |
108 |
#define MODULE_OS_IOEVENTFLAGS_USERBUTTON AOS_IOEVENT_FLAG(PAL_PAD(LINE_BUTTON)) |
|
108 |
#define MODULE_OS_GPIOEVENTFLAG_USERBUTTON AOS_GPIOEVENT_FLAG(PAL_PAD(LINE_BUTTON)) |
Also available in: Unified diff