-
Notifications
You must be signed in to change notification settings - Fork 38
/
subg_rfspy.c
49 lines (39 loc) · 996 Bytes
/
subg_rfspy.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
/* Control a cc1110 for sub-ghz RF comms over uart. */
#include <stdint.h>
#include <stdio.h>
#include "hardware.h"
#include "serial.h"
#include "radio.h"
#include "timer.h"
#include "commands.h"
#include "subg_rfspy.h"
bool __xdata subg_rfspy_init_finished;
bool __xdata subg_rfspy_should_exit;
void subg_rfspy_main() {
// 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();
// Global interrupt enable
init_timer();
EA = 1;
configure_serial();
configure_radio();
//LED test
GREEN_LED_PIN = 1;
delay(100);
GREEN_LED_PIN = 0;
BLUE_LED_PIN = 1;
delay(100);
BLUE_LED_PIN = 0;
subg_rfspy_init_finished = true;
// Start watchdog at 1s interval
WDCTL = WDCTL_EN;
while(!subg_rfspy_should_exit) {
get_command();
}
}