Ke Ao Teensy Flight Software
The software on the Teensy in the Ke Ao cubesat.
Loading...
Searching...
No Matches
artemis_defs.h
Go to the documentation of this file.
1
8#ifndef _ARTEMIS_DEFS_H
9#define _ARTEMIS_DEFS_H
10
11#include <TeensyThreads.h>
12#include <support/configCosmosKernel.h>
13#include <support/packetcomm.h>
14
16#define ARTEMIS_CURRENT_BEACON_1_COUNT 2
18#define ARTEMIS_CURRENT_SENSOR_COUNT 5
20#define ARTEMIS_TEMP_SENSOR_COUNT 7
22#define AREF_VOLTAGE 3.3
24#define MAXQUEUESIZE 50
25
26const float MV_PER_DEGREE_F = 1.0; // 1 mV/°F
27const float OFFSET_F = 58.0; // 58 mV (58°F) offset in the
28 // output voltage
29const float MV_PER_ADC_UNIT = 3300.0 / 1024.0; // 3.3V reference voltage and
30 // 10-bit ADC resolution
31const float heater_threshold = -10.0; // Heater
32
38enum class NODES : uint8_t {
39 GROUND_NODE_ID = 1,
40 TEENSY_NODE_ID = 2,
41 RPI_NODE_ID = 3,
43};
44
50 uint8_t channel_id;
51};
52
102 AIN2
104
105extern std::map<string, NODES> NodeType;
106
107// Max threads = 16
108extern vector<struct thread_struct> thread_list;
109
110// Mutex for Command Queues
111extern Threads::Mutex main_queue_mtx;
112extern Threads::Mutex astrodev_queue_mtx;
113extern Threads::Mutex rfm23_queue_mtx;
114extern Threads::Mutex rfm98_queue_mtx;
115extern Threads::Mutex pdu_queue_mtx;
116extern Threads::Mutex rpi_queue_mtx;
117
118// Command Queues
119extern std::deque<PacketComm> main_queue;
120extern std::deque<PacketComm> astrodev_queue;
121extern std::deque<PacketComm> rfm23_queue;
122extern std::deque<PacketComm> rfm98_queue;
123extern std::deque<PacketComm> pdu_queue;
124extern std::deque<PacketComm> rpi_queue;
125
126// Other Mutex
127extern Threads::Mutex spi1_mtx;
128extern Threads::Mutex i2c1_mtx;
129
130// Utility Functions
131int kill_thread(uint8_t channel_id);
132int32_t PushQueue(PacketComm &packet, std::deque<PacketComm> &queue,
133 Threads::Mutex &mtx);
134int32_t PullQueue(PacketComm &packet, std::deque<PacketComm> &queue,
135 Threads::Mutex &mtx);
136
137extern bool deploymentmode;
138
139#endif // _ARTEMIS_DEFS_H
Threads::Mutex rpi_queue_mtx
The mutex for the rpi_queue.
Definition artemis_defs.cpp:39
Threads::Mutex main_queue_mtx
The mutex for the main_queue.
Definition artemis_defs.cpp:29
Threads::Mutex rfm23_queue_mtx
The mutex for the rfm23_queue.
Definition artemis_defs.cpp:33
Threads::Mutex spi1_mtx
The mutex for the SPI1 interface on the Teensy.
Definition artemis_defs.cpp:55
std::deque< PacketComm > pdu_queue
The queue for packets to command the PDU.
Definition artemis_defs.cpp:50
Threads::Mutex i2c1_mtx
The mutex for the I2C1 interface on the Teensy.
Definition artemis_defs.cpp:57
std::map< string, NODES > NodeType
Mapping of string node types to corresponding node IDs.
Definition artemis_defs.cpp:21
vector< struct thread_struct > thread_list
The list of threads currently running on the Teensy.
Definition artemis_defs.cpp:13
std::deque< PacketComm > rfm98_queue
The queue for packets going to the RFM98 radio.
Definition artemis_defs.cpp:48
int kill_thread(uint8_t channel_id)
Kills a running thread.
Definition artemis_defs.cpp:66
Threads::Mutex astrodev_queue_mtx
The mutex for the astrodev_queue.
Definition artemis_defs.cpp:31
std::deque< PacketComm > rpi_queue
The queue for packets going to the Raspberry Pi.
Definition artemis_defs.cpp:52
int32_t PushQueue(PacketComm &packet, std::deque< PacketComm > &queue, Threads::Mutex &mtx)
Push a packet to the specified queue.
Definition artemis_defs.cpp:86
std::deque< PacketComm > rfm23_queue
The queue for packets going to the RFM23 radio.
Definition artemis_defs.cpp:46
Threads::Mutex rfm98_queue_mtx
The mutex for the rfm98_queue.
Definition artemis_defs.cpp:35
NODES
Enumeration of node ID.
Definition artemis_defs.h:38
@ TEENSY_NODE_ID
@ RPI_NODE_ID
@ GROUND_NODE_ID
@ PLEIADES_NODE_ID
TEENSY_PINS
Enumeration of Teensy pins.
Definition artemis_defs.h:60
@ SPI0_SCLK
Definition artemis_defs.h:74
@ RX_ON
Definition artemis_defs.h:91
@ I2C2_SCL
Definition artemis_defs.h:80
@ UART5_TXD
Definition artemis_defs.h:89
@ SCL1_I2C
Definition artemis_defs.h:77
@ UART6_TX
Definition artemis_defs.h:69
@ SPI0_MOSI
Definition artemis_defs.h:72
@ T_CS1
Definition artemis_defs.h:70
@ SDA1_I2C
Definition artemis_defs.h:78
@ SPI1_D1
Definition artemis_defs.h:87
@ GPS_RSTN
Definition artemis_defs.h:94
@ I2C1_SCL
Definition artemis_defs.h:85
@ SPI1_SCLK
Definition artemis_defs.h:88
@ UART6_RX
Definition artemis_defs.h:68
@ RADIO_RESET
Definition artemis_defs.h:93
@ T_GPIO6
Definition artemis_defs.h:67
@ I2C2_SDA
Definition artemis_defs.h:79
@ UART4_TXD
Definition artemis_defs.h:62
@ UART2_TXD
Definition artemis_defs.h:96
@ AIN5
Definition artemis_defs.h:83
@ T_GPIO2
Definition artemis_defs.h:63
@ T_GPIO5
Definition artemis_defs.h:66
@ NIRQ
Definition artemis_defs.h:101
@ AIN2
Definition artemis_defs.h:102
@ UART2_RXD
Definition artemis_defs.h:95
@ TX_ON
Definition artemis_defs.h:92
@ AIN4
Definition artemis_defs.h:82
@ T_GPIO3
Definition artemis_defs.h:64
@ SPI0_MISO
Definition artemis_defs.h:73
@ AIN0
Definition artemis_defs.h:75
@ AIN6
Definition artemis_defs.h:84
@ UART4_RXD
Definition artemis_defs.h:61
@ SDN
Definition artemis_defs.h:98
@ I2C1_SDA
Definition artemis_defs.h:86
@ AIN3
Definition artemis_defs.h:81
@ UART5_RXD
Definition artemis_defs.h:90
@ RPI_ENABLE
Definition artemis_defs.h:97
@ T_CS
Definition artemis_defs.h:71
@ SPI1_CS1
Definition artemis_defs.h:99
@ AIN1
Definition artemis_defs.h:76
@ SPI1_D0
Definition artemis_defs.h:100
@ T_GPIO4
Definition artemis_defs.h:65
std::deque< PacketComm > main_queue
The main queue for packets in the Teensy.
Definition artemis_defs.cpp:42
std::deque< PacketComm > astrodev_queue
The queue for packets going to the Astrodev (Li-3) radio.
Definition artemis_defs.cpp:44
int32_t PullQueue(PacketComm &packet, std::deque< PacketComm > &queue, Threads::Mutex &mtx)
Pulls a packet from the specified queue.
Definition artemis_defs.cpp:104
Threads::Mutex pdu_queue_mtx
The mutex for the pdu_queue.
Definition artemis_defs.cpp:37
The structure of a thread.
Definition artemis_defs.h:46
uint8_t channel_id
An enum describing what type of thread it is.
Definition artemis_defs.h:50
int thread_id
A unique identifying number for the thread.
Definition artemis_defs.h:48