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

The Artemis definitions. More...

#include <TeensyThreads.h>
#include <support/configCosmosKernel.h>
#include <support/packetcomm.h>

Go to the source code of this file.

Classes

struct  thread_struct
 The structure of a thread. More...
 

Macros

#define ARTEMIS_CURRENT_BEACON_1_COUNT   2
 
#define ARTEMIS_CURRENT_SENSOR_COUNT   5
 The number of current sensors in the satellite.
 
#define ARTEMIS_TEMP_SENSOR_COUNT   7
 The number of temperature sensors in the satellite.
 
#define MAXQUEUESIZE   8
 The maximum number of packets that a queue can hold.
 

Enumerations

enum class  NODES : uint8_t { GROUND_NODE_ID = 1 , TEENSY_NODE_ID = 2 , RPI_NODE_ID = 3 }
 Enumeration of Node ID.
 
enum  TEENSY_PINS {
  UART4_RXD , UART4_TXD , T_GPIO2 , T_GPIO3 ,
  T_GPIO4 , T_GPIO5 , T_GPIO6 , UART6_RX ,
  UART6_TX , T_CS1 , T_CS , SPI0_MOSI ,
  SPI0_MISO , SPI0_SCLK , AIN0 , AIN1 ,
  SCL1_I2C , SDA1_I2C , I2C2_SDA , I2C2_SCL ,
  AIN3 , AIN4 , AIN5 , AIN6 ,
  I2C1_SCL , I2C1_SDA , SPI1_D1 , SPI1_SCLK ,
  UART5_TXD , UART5_RXD , RX_ON , TX_ON ,
  RADIO_RESET , GPS_RSTN , UART2_RXD , UART2_TXD ,
  RPI_ENABLE , SDN , SPI1_CS1 , SPI1_D0 ,
  NIRQ , AIN2
}
 Enumeration of Teensy 4.1 pins, based on Artemis OBC v4.23.
 

Functions

bool kill_thread (uint8_t 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

const float MV_PER_DEGREE_F = 1.0
 The conversion factor between temperature and voltage. More...
 
const float OFFSET_F = 58.0
 The offset of the temperature sensors. More...
 
const float MV_PER_ADC_UNIT = 3300.0 / 1024.0
 The conversion factor between ADC units and voltage. More...
 
const float heater_threshold = -10.0
 The activation temperature, in Celsius, of the heater.
 
vector< struct thread_structthread_list
 The list of active threads. More...
 
std::map< string, NODESNodeType
 Mapping between string names and NodeType.
 
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
 Whether the satellite is in deployment mode.
 

Detailed Description

The Artemis definitions.

This file declares constants and functions used throughout the satellite.

Macro Definition Documentation

◆ ARTEMIS_CURRENT_BEACON_1_COUNT

#define ARTEMIS_CURRENT_BEACON_1_COUNT   2

The number of current sensor readings in the first current beacon.

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

◆ MV_PER_ADC_UNIT

const float MV_PER_ADC_UNIT = 3300.0 / 1024.0

The conversion factor between ADC units and voltage.

This value represents the ratio between the 10-bit value returned by the Analog-To-Digital (ADC) converter to millivolts DC. It is based off of the maximum value of 1024 representing 3.3VDC, and 0 representing 0.0VDC.

◆ MV_PER_DEGREE_F

const float MV_PER_DEGREE_F = 1.0

The conversion factor between temperature and voltage.

This value represents the relationship between millivolts and degrees Fahrenheit. It is currently 1 mV/°F.

◆ OFFSET_F

const float OFFSET_F = 58.0

The offset of the temperature sensors.

This value represents the offset in the output voltage. It is given as either degrees Fahrenheit or millivolts. It is currently 58 mV (58°F).

◆ thread_list

vector<struct thread_struct> thread_list
extern

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.