-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystem_mgr.h
More file actions
114 lines (74 loc) · 2.55 KB
/
system_mgr.h
File metadata and controls
114 lines (74 loc) · 2.55 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#pragma once
#include <msg.h>
#include <funcs.h>
#include <list>
#include <systemobject.h>
#include <fhmotor.h>
#include "SparkFun_BNO080_Arduino_Library.h"
#include <radio.h>
#include <arduino.h>
#include <string>
#include <mdrive.h>
#include <unordered_set>
#if defined(ARDUINO_PORTENTA_H7_M4) || defined(ARDUINO_PORTENTA_H7_M7)
// #include <pinDefinitions.h>
/*
#define IMU_OBC_NSS PinNameToIndex(PB_4)
#define IMU_OBC_RST PinNameToIndex(PI_14)
#define IMU_OBC_INT PinNameToIndex(PI_15)
#define IMU_OBC_WAKE PinNameToIndex(PB_3)
*/
#define IMU_OBC_NSS PinNameToIndex(PJ_8)
#define IMU_OBC_RST PinNameToIndex(PI_14)
#define IMU_OBC_INT PinNameToIndex(PI_15)
#define IMU_OBC_WAKE PinNameToIndex(PJ_9)
#else
#define TTGO
typedef int PinName;
#endif
class CSystemMgr:public CSystemObject{
std::list<CMsg> ToDoList;
std::list<CMsg> DoneList;
int _channel=0;
const int freq = 5000;
const int resolution = 8;
std::map<std::string, PinName> Pins;
std::unordered_set<std::string> pwmPins;
public:
CSystemMgr() {Name("SYSTEMMGR");_forever=true;_INTERVAL=30000;};
~CSystemMgr();
bool init();
void setup();
void loop();
void callCustomFunctions(CMsg &msg);
void powerLevel(CMsg &msg);
void chkClocks(){writeconsoleln("Checking Clocks & Counters...");};
void chkRadio(){writeconsoleln("Checking Radio...");};
void chkCurrentState(){writeconsoleln("Checking Current...");};
void chkAllStates(){writeconsoleln("Checking All States...");};
void chkTemperature(){writeconsoleln("Checking Temps...");};
void chkBattery(){writeconsoleln("Checking Battery...");};
void chkRotation(){};
void chkCoreSystems(){writeconsoleln("Checking CoreSystems...");};
void chkMessages(){writeconsoleln("Checking Messages...");};
void stateLowPower(){newState("LOWPOWER");};
void stateReallyLowPower(){newState("LOWPOWER");};
void stateDetumble(){newState("DETUMBLE");};
void sendHealth(){writeconsoleln("Send Health...");};
void sendBeacon(){writeconsoleln("Send Beacon...");};
void sendError(std::string str){};
void RESET(){};
void loopWire(TwoWire *wire);
void enableI2C();
void SendCmd(std::string str);
void newState(const char *str="LOWPOWER");
void burn();
void phone();
void pinsOn();
void pinsOff();
void setupIMUSPI();
void setupIMUI2C(TwoWire *wire);
void displayCMDs();
void initPins();
void sendSerial(const char* cmd);
};