This shows you the differences between two versions of the page.
milestone_3_task_2 [2023/02/20 21:23] scott [Trigger] |
milestone_3_task_2 [2023/03/02 17:53] (current) scott [Source Code] |
||
---|---|---|---|
Line 62: | Line 62: | ||
* drivers/switches.h | * drivers/switches.h | ||
* include/leds.h | * include/leds.h | ||
+ | * include/mio.h | ||
+ | * include/utils.h | ||
* lasertag/main.c | * lasertag/main.c | ||
* lasertag/transmitter.h | * lasertag/transmitter.h | ||
Line 323: | Line 325: | ||
void transmitter_runTest() { | void transmitter_runTest() { | ||
printf("starting transmitter_runTest()\n"); | printf("starting transmitter_runTest()\n"); | ||
- | mio_init(false); | ||
- | buttons_init(); // Using buttons | ||
- | switches_init(); // and switches. | ||
transmitter_init(); // init the transmitter. | transmitter_init(); // init the transmitter. | ||
- | transmitter_enableTestMode(); // Prints diagnostics to stdio. | + | while (!(buttons_read() & BUTTONS_BTN3_MASK)) { // Run continuously until BTN3 is pressed. |
- | while (!(buttons_read() & BUTTONS_BTN1_MASK)) { // Run continuously until BTN1 is pressed. | + | |
uint16_t switchValue = switches_read() % FILTER_FREQUENCY_COUNT; // Compute a safe number from the switches. | uint16_t switchValue = switches_read() % FILTER_FREQUENCY_COUNT; // Compute a safe number from the switches. | ||
transmitter_setFrequencyNumber(switchValue); // set the frequency number based upon switch value. | transmitter_setFrequencyNumber(switchValue); // set the frequency number based upon switch value. | ||
Line 338: | Line 336: | ||
printf("completed one test period.\n"); | printf("completed one test period.\n"); | ||
} | } | ||
- | transmitter_disableTestMode(); | ||
do {utils_msDelay(BOUNCE_DELAY);} while (buttons_read()); | do {utils_msDelay(BOUNCE_DELAY);} while (buttons_read()); | ||
printf("exiting transmitter_runTest()\n"); | printf("exiting transmitter_runTest()\n"); | ||
Line 464: | Line 461: | ||
- Print out the time duration from the interval timer. | - Print out the time duration from the interval timer. | ||
- | Show the TA the execution of ''lockoutTimer_runTest()''. | + | Show a TA the execution of ''lockoutTimer_runTest()''. |
==== Code Submission ==== | ==== Code Submission ==== |