-
Notifications
You must be signed in to change notification settings - Fork 0
/
state_machine.h
57 lines (47 loc) · 1.42 KB
/
state_machine.h
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
/*
* state_machine.h
*
* Created on: 09.05.2016
* Author: beat
*/
#ifndef STATE_MACHINE_H_
#define STATE_MACHINE_H_
#include "eps_hal.h"
#include <stdint.h>
typedef struct _eps_status { //stores the answers to be sent to an eventual i2c request
uint16_t v_bat; //mV
int16_t t_bat; //0.01�C
uint16_t v_solar; //mV
uint16_t current_in; //mA
uint16_t current_out; //mA
uint16_t analog_ext1; //units
// uint16_t analog_ext2; //units
// uint16_t analog_ext3; //units
// uint16_t analog_ext4; //units
uint8_t v_bat_8; //.1V
int8_t t_bat_8; //�C
uint8_t v_solar_8; //.1V
uint8_t current_in_8; //0.1A
uint8_t current_out_8; //0.1A
uint8_t analog_ext1_8; //units/256
// uint8_t analog_ext2_8; //units/256
// uint8_t analog_ext3_8; //units/256
// uint8_t analog_ext4_8; //units/256
} eps_status_t;
typedef enum _module_status{
MODULE_OFF=0,
TURN_OFF,
TURN_ON,
MODULE_ON,
FAULT
} module_status_t;
extern eps_status_t eps_status;
extern module_status_t module_status[N_MODULES]; //stores the answers to be sent to an eventual i2c request
void eps_update_values();
void eps_update_states();
void eps_update_user_interface();
void turn_off_all_modules(char lowbat); //if lowbat==1, this forces everything to turn off immediately and enables comparator before deepsleep
#ifndef FIRMWARE_BASE_STATION
void turn_on_all_rover_modules();
#endif
#endif /* STATE_MACHINE_H_ */