forked from ghoti57/evofw3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
evo.c
60 lines (46 loc) · 947 Bytes
/
evo.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
#include <stdio.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>
#include <avr/boot.h>
#include "config.h"
#include "led.h"
#include "spi.h"
#include "cc1101.h"
#include "frame.h"
#include "message.h"
#include "tty.h"
void main_init(void) {
uint8_t myClass = 18;
uint32_t myId = 0x4DADA;
// OSCCAL=((uint32_t)OSCCAL * 10368) / 10000;
#if defined(DEBUG_PORT)
DEBUG_DDR = DEBUG_MASK;
DEBUG_PORT = 0;
#endif
wdt_disable();
led_init();
tty_init();
myId =( ( (uint32_t)boot_signature_byte_get(0x15) << 16 )
+ ( (uint32_t)boot_signature_byte_get(0x16) << 8 )
+ ( (uint32_t)boot_signature_byte_get(0x17) << 0 )
);
// Wire up components
spi_init();
cc_init();
frame_init();
msg_init( myClass, myId );
sei();
}
void main_work(void) {
frame_work();
msg_work();
tty_work();
}
#ifdef NEEDS_MAIN
int main(void) {
main_init();
while(1) {
main_work();
}
}
#endif