CaryCoders
/
demo_SX1276_standalone
standalone sx1276 demo program
Fork of SX1276_GPS by
Diff: main.cpp
- Revision:
- 11:96146db429de
- Parent:
- 10:3fcab08717fc
- Child:
- 13:9641bc42db92
--- a/main.cpp Sun Aug 10 12:34:44 2014 +0000 +++ b/main.cpp Sun Aug 10 15:45:03 2014 +0000 @@ -26,6 +26,20 @@ eModeLast }; +void ChangeModule +( + Module ** in_pModuleList, + size_t in_nModuleListSize, + size_t in_nMenuPos, + int in_nIndexX, + int in_nCursorY, + bool in_bUp +) +{ + size_t nModule = (in_nMenuPos + in_nCursorY) % in_nModuleListSize; + in_pModuleList[nModule]->change(in_nIndexX,in_nCursorY,in_bUp); +} + void CreateChars() { //uint8_t k_aUp[] = { 0x4,0xe,0x1f,0x15,0x4,0x4,0x4,0x4 }; @@ -193,12 +207,21 @@ if ((nCursorY < k_nHeightLCD - 1) && (nKeys & BUTTON_DOWN)) nCursorY++; if (nKeys & BUTTON_LEFT) nIndexX--; - if (nKeys & BUTTON_RIGHT) nIndexX++; + if (nKeys & BUTTON_RIGHT) nIndexX++; break; case eModeChange: SetCursor(false,true); ShowTracking(true); + + if (nKeys & (BUTTON_UP | BUTTON_DOWN)) + { + bool bUp = (nKeys & BUTTON_UP) ? true : false; + ChangeModule(aModules,_countof(aModules),nMenuPos,nIndexX,nCursorY,bUp); + } + + if (nKeys & BUTTON_LEFT) nIndexX--; + if (nKeys & BUTTON_RIGHT) nIndexX++; break; }