Ke Ao Teensy Flight Software
The software on the Teensy in the Ke Ao cubesat.
Loading...
Searching...
No Matches
artemis_defs.h File Reference

The Artemis definitions header file. 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
 The number of readings that can fit in the first beacon.
 
#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 AREF_VOLTAGE   3.3
 The analog reference voltage used for the temperature sensors.
 
#define MAXQUEUESIZE   50
 The maximum number of packets that can fit in a queue.
 

Enumerations

enum class  NODES : uint8_t { GROUND_NODE_ID = 1 , TEENSY_NODE_ID = 2 , RPI_NODE_ID = 3 , PLEIADES_NODE_ID = 4 }
 Enumeration of node ID. More...
 
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 pins. More...
 

Functions

int kill_thread (uint8_t channel_id)
 Kills a running thread.
 
int32_t PushQueue (PacketComm &packet, std::deque< PacketComm > &queue, Threads::Mutex &mtx)
 Push a packet to the specified queue.
 
int32_t PullQueue (PacketComm &packet, std::deque< PacketComm > &queue, Threads::Mutex &mtx)
 Pulls a packet from the specified queue.
 

Variables

const float MV_PER_DEGREE_F = 1.0
 
const float OFFSET_F = 58.0
 
const float MV_PER_ADC_UNIT = 3300.0 / 1024.0
 
const float heater_threshold = -10.0
 
std::map< string, NODESNodeType
 Mapping of string node types to corresponding node IDs.
 
vector< struct thread_structthread_list
 The list of threads currently running on the Teensy.
 
Threads::Mutex main_queue_mtx
 The mutex for the main_queue.
 
Threads::Mutex astrodev_queue_mtx
 The mutex for the astrodev_queue.
 
Threads::Mutex rfm23_queue_mtx
 The mutex for the rfm23_queue.
 
Threads::Mutex rfm98_queue_mtx
 The mutex for the rfm98_queue.
 
Threads::Mutex pdu_queue_mtx
 The mutex for the pdu_queue.
 
Threads::Mutex rpi_queue_mtx
 The mutex for the rpi_queue.
 
std::deque< PacketComm > main_queue
 The main queue for packets in the Teensy.
 
std::deque< PacketComm > astrodev_queue
 The queue for packets going to the Astrodev (Li-3) radio.
 
std::deque< PacketComm > rfm23_queue
 The queue for packets going to the RFM23 radio.
 
std::deque< PacketComm > rfm98_queue
 The queue for packets going to the RFM98 radio.
 
std::deque< PacketComm > pdu_queue
 The queue for packets to command the PDU.
 
std::deque< PacketComm > rpi_queue
 The queue for packets going to the Raspberry Pi.
 
Threads::Mutex spi1_mtx
 The mutex for the SPI1 interface on the Teensy.
 
Threads::Mutex i2c1_mtx
 The mutex for the I2C1 interface on the Teensy.
 
bool deploymentmode
 

Detailed Description

The Artemis definitions header file.

This contains useful definitions used in the satellite.

Enumeration Type Documentation

◆ NODES

enum class NODES : uint8_t
strong

Enumeration of node ID.

This is part of the packet header, describing the source or destination node.

Enumerator
GROUND_NODE_ID 

ID for the ground station node.

TEENSY_NODE_ID 

ID for the Teensy node.

RPI_NODE_ID 

ID for the Raspberry Pi node.

PLEIADES_NODE_ID 

ID for the Pleiades node.

◆ TEENSY_PINS

Enumeration of Teensy pins.

Current for Artemis OBC v4.23.

Todo:
Fill out completely.
Enumerator
UART4_RXD 

Physical 0:

UART4_TXD 

Physical 1:

T_GPIO2 

Physical 2:

T_GPIO3 

Physical 3:

T_GPIO4 

Physical 4:

T_GPIO5 

Physical 5:

T_GPIO6 

Physical 6:

UART6_RX 

Physical 7:

UART6_TX 

Physical 8:

T_CS1 

Physical 9:

T_CS 

Physical 10:

SPI0_MOSI 

Physical 11:

SPI0_MISO 

Physical 12:

SPI0_SCLK 

Physical 13:

AIN0 

Physical 14:

AIN1 

Physical 15:

SCL1_I2C 

Physical 16:

SDA1_I2C 

Physical 17:

I2C2_SDA 

Physical 18:

I2C2_SCL 

Physical 19:

AIN3 

Physical 20:

AIN4 

Physical 21:

AIN5 

Physical 22:

AIN6 

Physical 23:

I2C1_SCL 

Physical 24:

I2C1_SDA 

Physical 25:

SPI1_D1 

Physical 26:

SPI1_SCLK 

Physical 27:

UART5_TXD 

Physical 28:

UART5_RXD 

Physical 29:

RX_ON 

Physical 30:

TX_ON 

Physical 31:

RADIO_RESET 

Physical 32:

GPS_RSTN 

Physical 33:

UART2_RXD 

Physical 34:

UART2_TXD 

Physical 35:

RPI_ENABLE 

Physical 36:

SDN 

Physical 37:

SPI1_CS1 

Physical 38:

SPI1_D0 

Physical 39:

NIRQ 

Physical 40:

AIN2 

Physical 41:

Function Documentation

◆ kill_thread()

int kill_thread ( uint8_t  channel_id)

Kills a running thread.

Parameters
channel_idThe ID of the thread to be killed.
Returns
int Returns the thread ID of the thread if it is successfully killed, or -1 if unsuccessful.

◆ PullQueue()

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

Pulls a packet from the specified queue.

Parameters
packetThe packet that will be pulled into.
queueThe queue that the packet will be pulled from.
mtxThe mutex used to lock the queue.
Returns
int32_t Returns 1 if queue is not empty, 0 if the queue is empty.

◆ PushQueue()

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

Push a packet to the specified queue.

Parameters
packetThe packet to be pushed.
queueThe queue that the packet will be pushed into.
mtxThe mutex used to lock the queue.
Returns
int32_t This function always returns 1.

Variable Documentation

◆ NodeType

std::map<string, NODES> NodeType
extern

Mapping of string node types to corresponding node IDs.

This map associates string keys with NODES values, allowing for easy translation between string names and numerical IDs.

◆ thread_list

vector<struct thread_struct> thread_list
extern

The list of threads currently running on the Teensy.

A maximum of 16 threads can be handled by the thread list.