static void run_weather() { enum Joystick_dir curJoy = getJoyDirection(); switch (curJoy) { case RIGHT: get_weather(B_WEATHER_CURR); print_weather("Current Weather\n", "^ Forecast"); break; case LEFT: get_weather(B_WEATHER_FOR); print_weather("Forecast\n", "v Current Weather"); break; case IN: next_state = MAIN_WATCH; break; default: break; } }
void main_debug() { if (run_state == START){ debugScreen(); run_state = RUN; } enum Joystick_dir curJoy = getJoyDirection(); switch (curJoy) { case IN: next_state = MAIN_WATCH; break; default: break; } char text[20]; sprintf(text ,"Joystick Enum %d\n", joystick_dir); writeString(text); update_acc_data(); sprintf(text, "Accel x: %u \n", x_g); writeString(text); sprintf(text, "Accel y: %u \n", y_g); writeString(text); sprintf(text, "Accel z: %u \n", z_g); writeString(text); // if (is_running_on_battery()) // { // sprintf(text, "Battery: %u%%\n", get_power_remaining()); // writeString(text); // } // else // { // sprintf(text, "Watch plugged in\n", get_power_remaining()); // writeString(text); // } moveCursor(1,0); }
int main(void) { initUART(UBBR); printf("Simple RAM TEST \r\n"); initExtMemIface(); initTimer(); initInterrupts(); SRAM_test(); joyInit(); initOLED(); initSPI(); initCAN(NORMAL); struct joypos_t p; enum joydir_t d; struct canMessage m0,m1,m2s; while(1){ /* slide1Point=getSlidePosition(1); slide2Point=getSlidePosition(2); printf("SLIDE1 -> %d",slide1Point.x); printf("SLIDE2 -> %d",slide2Point.x);SLIDE READINGS*/ if (readControl) { readControl = 0; d = getJoyDirection(); p = getJoyPosition(); sendCANJoy(2,p,d); if (d == TOP || d == RIGHT_TOP || d == LEFT_TOP) menuOption = (menuOption-1)%NUM_MENU_OPTIONS; else if (d == BOTTOM || d == RIGHT_BOTTOM|| d == LEFT_BOTTOM) menuOption = (menuOption+1)%NUM_MENU_OPTIONS; printMenu(menuOption); } if (flagJoyButton) { m2s.id = JOY_BUTTON; m2s.size = 0; printf("Sending joy bu\r\n"); fillTxBufferMCP(0,m2s); requestToSendMCP(0); struct canMessage m2s; flagJoyButton = 0; gotoCharOLED(7,0); putsOLED(" "); //Cleans last selected option from screen switch(menuOption){ case 0: //Play gotoCharOLED(7,0); putsOLED("PLAY"); break; case 1: //Options gotoCharOLED(7,0); putsOLED("OPTIONS"); break; case 2: //Help printHelp(); break; default: gotoCharOLED(7,0); putsOLED("Stick to the OPTIONS !!!"); break; } } /* if(flagMCP) { flagMCP = 0; struct canMessage m0,m1; m0 = readRxBufferMCP(0); m1 = readRxBufferMCP(1); printf ("Buffer 0 ID: %d, Size: %d, Data: %s \r\n", m0.id, m0.size, m0.data); printf ("Buffer 1 ID: %d, Size: %d, Data: %s \r\n", m1.id, m1.size, m1.data); }*/ } }