forked from ps2/subg_rfspy
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathhardware.c
More file actions
46 lines (42 loc) · 735 Bytes
/
hardware.c
File metadata and controls
46 lines (42 loc) · 735 Bytes
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
/* 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"
#include "delay.h"
uint8_t green_mode = 2;
uint8_t blue_mode = 2;
void led_set_mode(uint8_t led, uint8_t new_mode)
{
if(led == 0){
green_mode = new_mode;
if(new_mode != 2){
GREEN_LED = new_mode;
}
}
else if(led == 1){
blue_mode = new_mode;
if(new_mode != 2){
BLUE_LED = new_mode;
}
}
}
void led_set_state(uint8_t led, uint8_t command)
{
if(led == 0){
if(green_mode == 2){
if(command < 2){
GREEN_LED = command;
}
}
}
else if(led == 1){
if(blue_mode == 2){
if(command < 2){
BLUE_LED = command;
}
}
}
}