int main(void) { #ifdef QUICKSTART test obj; test obj2; init_test(&obj); test_set_pins(&obj, 16, 17); init_test(&obj2); test_set_pins(&obj2, 20, 21); printf("defaultPin %d, defaultOtherPin %d, myFloatConstant %g\n", test_defaultPin, test_defaultOtherPin, test_myFloatConstant); printf("obj: pin %d, other pin %d\n", test_get_pin(&obj), test_get_other_pin(&obj)); printf("obj2: pin %d, other pin %d\n", test_get_pin(&obj2), test_get_other_pin(&obj2)); test_start_blinker(&obj); test_blink(&obj); test_set_pin(&obj, 18); test_blink(&obj); test_blink(&obj2); test_set_pin(&obj2, 22); test_blink(&obj2); while (1) { test_blink(&obj); test_blink(&obj2); } while (1) ; #endif #ifdef ACTIVITYBOARD test obj; init_test(&obj); test_set_pins(&obj, 26, 27); while (1) test_blink(); #endif return 0; }
int main(void) { /* Watchdog timer disabled */ WDTCTL = WDTPW + WDTHOLD; set_letter('B'); initPorts(); LED_OUT &= ~(LED0); BCSCTL3 |= LFXT1S_2; // Use slow oscillator (12kHz) TACTL = 0x0200 + TAIE + MC_3 + ID_3; //0x0200 = SMCLK TACCTL0 = CCIE; TACCR0 = 99; WRITE_SR(GIE); // Enable global interrupts test_blink(P1OUT_, LED0); //LED_OUT^= 0xff; while(1) { //Loop forever } }
void run_tests(TestState *parent, int selectedTest) { TestState state; initState(&state, "Test", parent); state.selectedTest = selectedTest; if (startTest(&state, "the empty command")) { if (serialRequest(&state, "")) checkSerialResponse(&state, "=S,0"); } if (startTest(&state, "an invalid command")) { if (serialRequest(&state, "FOO")) checkSerialResponse(&state, "=E,1"); } #ifdef DO_BLINK_TEST if (startTest(&state, "Blink LEDs on GPIO13 and GPIO15")) { if (test_blink(&state)) passTest(&state, ""); else failTest(&state, ""); } #endif if (state.ssid) { if (startTest(&state, "switch to STA+AP mode")) { if (serialRequest(&state, "SET:wifi-mode,3")) checkSerialResponse(&state, "=S,0"); } if (startTest(&state, "JOIN")) { if (serialRequest(&state, "JOIN:%s,%s", state.ssid, state.passwd)) checkSerialResponse(&state, "=S,0"); if (state.testPassed) msleep(10000); // wait for WX to disconnect. It has a .5 second delay } beginGroup(&state); if (startTest(&state, "CHECK:station-ipaddr")) { if (!skipTest(&state)) { char ipaddr[32]; do { if (!serialRequest(&state, "CHECK:station-ipaddr")) break; } while (!waitAndCheckSerialResponse(&state, "=S,0.0.0.0", "=S,^s", ipaddr, sizeof(ipaddr))); if (state.testPassed) { infoTest(&state, "got '%s'", ipaddr); if (GetInternetAddress(ipaddr, 80, &state.moduleAddr) != 0) infoTest(&state, "error: failed to parse IP address '%s'", ipaddr); } } } } if (startTest(&state, "simple transaction")) { if (test_001(&state)) passTest(&state, ""); else failTest(&state, ""); } testResults(&state); }