Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: C12832 MMA7660 mbed
main.cpp
- Committer:
- suzukimitsuru
- Date:
- 2018-03-28
- Revision:
- 12:1d5832974d41
- Parent:
- 11:28887549c7d5
File content as of revision 12:1d5832974d41:
#include "mbed.h"
#include "C12832.h"
#include "commands.h"
extern COMMAND_TRRIGER commandList[];
extern COMMAND_TRRIGER trrigerNull;
BusIn joyStick(p15,p12,p13,p16,p14);
C12832 lcd(p5, p7, p6, p8, p11);
int main()
{
lcd.cls();
lcd.locate(0,3);
lcd.printf("mbed Switches application");
for(int index = 0; commandList[index].trigger != nothing; index++) {
commandList[index].command->initialize();
}
COMMAND_TRRIGER *current = &trrigerNull;
while(true) {
COMMAND_TRRIGER *request = NULL;
for(int index = 0; commandList[index].trigger != nothing; index++) {
if (joyStick == commandList[index].trigger) {
request = &commandList[index];
}
}
if (request != NULL && request != current) {
current->command->finalize();
current = &trrigerNull;
}
if (current->trigger == nothing) {
if (request != NULL){
current = request;
lcd.locate(0,15);
lcd.printf(" ");
lcd.locate(0,15);
lcd.printf(current->command->name);
current->command->processInitialize();
}
} else {
current->command->processRunning();
if (! current->command->processIsContinue()){
current->command->finalize();
current = &trrigerNull;
}
}
}
}