This repository has been archived by the owner on Jun 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
62 lines (51 loc) · 1.53 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* Main file for the TAP (Technology Access Platform)
*
* Copyright (C) 2016 TheLab.ms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
#include "main.h"
/* Had to change demo.c to demo.h and include it here to get it working without errors @alt_bier */
#include "demo.h"
volatile bool run_program = false;
/* Can be overridden by user program */
//void __attribute__((weak)) setup(void) {} /* Had to comment this out due to errors @alt_bier */
/* Can be overridden by user program */
//void __attribute__((weak)) loop(void) {} /* Had to comment this out due to errors @alt_bier */
void main_loop(void)
{
// Step the demo
// if (run_program)
loop();
state.frame_sync++;
// Master sends a frame sync packet every 100 frames
if (i_am_master && !(state.frame_sync % 100))
{
set_id(0, 0);
send_frame_sync(state.frame_sync);
}
// Scan through all LEDs once
scan_LEDs();
}
int main(void)
{
WDT_A_hold(WDT_A_BASE); // Stop watchdog timer
init_tap();
// Initialize the demo
setup();
while (true)
#ifdef USB_SUPPORT
// USB loop polls for input and calls main_loop()
USB_loop();
#else // USB_SUPPORT
main_loop();
#endif // USB_SUPPORT
}