forked from ps2/subg_rfspy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
55 lines (43 loc) · 1.16 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
/* Control a cc1110 for sub-ghz RF comms over uart. */
#include <stdint.h>
#include "hardware.h"
#include "serial.h"
#include "radio.h"
#include "timer.h"
#include "commands.h"
// SDCC needs prototypes of all ISR functions in main. not sure why, but described in section 3.8.1
void t1_isr(void) __interrupt T1_VECTOR;
void rftxrx_isr(void) __interrupt RFTXRX_VECTOR;
void rf_isr(void) __interrupt RF_VECTOR;
#ifdef USES_USART1_RX_ISR
void rx1_isr(void) __interrupt URX1_VECTOR;
#endif
#ifdef USES_USART1_TX_ISR
void tx1_isr(void) __interrupt UTX1_VECTOR;
#endif
#if TI_DONGLE || SRF_STICK
void usb_isr() __interrupt 6;
#endif
int main(void)
{
// Set the system clock source to HS XOSC and max CPU speed,
// ref. [clk]=>[clk_xosc.c]
SLEEP &= ~SLEEP_OSC_PD;
while( !(SLEEP & SLEEP_XOSC_S) );
CLKCON = (CLKCON & ~(CLKCON_CLKSPD | CLKCON_OSC)) | CLKSPD_DIV_1;
while (CLKCON & CLKCON_OSC);
SLEEP |= SLEEP_OSC_PD;
// init LEDS
HARDWARE_LED_INIT; // see hardware.h
GREEN_LED = 0;
BLUE_LED = 0;
// Global interrupt enable
init_timer();
EA = 1;
configure_radio();
configure_serial();
while(1) {
GREEN_LED ^= 1;
get_command();
}
}