Artemis Teensy Flight Software
The software on the Teensy in the Artemis cubesat.
artemis_defs.cpp File Reference

The Artemis definitions. More...

Functions

bool kill_thread (uint8_t target_channel_id)
 Kill a running thread. More...
 
void PushQueue (PacketComm &packet, std::deque< PacketComm > &queue, Threads::Mutex &mtx)
 Push a packet into a queue. More...
 
bool PullQueue (PacketComm &packet, std::deque< PacketComm > &queue, Threads::Mutex &mtx)
 Pull a packet from a queue. More...
 
void route_packet_to_main (PacketComm packet)
 Wrapper function to send a packet to the main channel.
 
void route_packet_to_rfm23 (PacketComm packet)
 Wrapper function to send a packet to the RFM23.
 
void route_packet_to_pdu (PacketComm packet)
 Wrapper function to send a packet to the PDU.
 
void route_packet_to_rpi (PacketComm packet)
 Wrapper function to send a packet to the Raspberry Pi.
 

Variables

vector< struct thread_structthread_list
 The list of active threads. More...
 
std::map< string, NODESNodeType
 Mapping between string names and NodeType. More...
 
std::deque< PacketCommmain_queue
 The packet queue for the main channel.
 
std::deque< PacketCommrfm23_queue
 The packet queue for the RFM23 channel.
 
std::deque< PacketCommpdu_queue
 The packet queue for the PDU channel.
 
std::deque< PacketCommrpi_queue
 The packet queue for the Raspberry Pi channel.
 
Threads::Mutex main_queue_mtx
 The mutex for the main channel's packet queue.
 
Threads::Mutex rfm23_queue_mtx
 The mutex for the RFM23 channel's packet queue.
 
Threads::Mutex pdu_queue_mtx
 The mutex for the PDU channel's packet queue.
 
Threads::Mutex rpi_queue_mtx
 The mutex for the Raspberry Pi channel's packet queue.
 
Threads::Mutex spi1_mtx
 The mutex for the SPI1 interface.
 
Threads::Mutex i2c1_mtx
 The mutex for the I2C1 interface.
 
bool deploymentmode = false
 Whether the satellite is in deployment mode.
 

Detailed Description

The Artemis definitions.

This file defines global variables and functions used throughout the satellite.

Function Documentation

◆ kill_thread()

bool kill_thread ( uint8_t  target_channel_id)

Kill a running thread.

Todo:
Check return types here.
Parameters
target_channel_idThe Channel_ID of the channel to kill.
Returns
true The first channel that matches the target Channel_ID has been killed.
false The target Channel_ID has not been found in the thread_list.

◆ PullQueue()

bool PullQueue ( PacketComm packet,
std::deque< PacketComm > &  queue,
Threads::Mutex &  mtx 
)

Pull a packet from a queue.

This is a helper function to check a queue of packets for a packet.

Parameters
packetThe packet object that will carry the pulled packet, if there is one.
queueThe queue of packets to be pulled from.
mtxThe mutex used to lock the queue.
Returns
true A packet has been pulled from the queue. The passed-in packet now contains its contents.
false The queue does not contain any packets.

◆ PushQueue()

void PushQueue ( PacketComm packet,
std::deque< PacketComm > &  queue,
Threads::Mutex &  mtx 
)

Push a packet into a queue.

This is a helper function to push a packet into a queue of packets. It will push out the first packet in the queue if the queue is too large.

Parameters
packetThe packet object that will be pushed into the queue.
queueThe queue of packets to be pulled from.
mtxThe mutex used to lock the queue.

Variable Documentation

◆ NodeType

std::map<string, NODES> NodeType
Initial value:
= {
{ "ground", NODES::GROUND_NODE_ID},
{"artemis_teensy", NODES::TEENSY_NODE_ID},
{ "artemis_rpi", NODES::RPI_NODE_ID},
}

Mapping between string names and NodeType.

◆ thread_list

vector<struct thread_struct> thread_list

The list of active threads.

This is a list of thread_structs that correspond to each active thread, running a channel. There can be a maximum of 16 active threads.