Ke Ao Teensy Flight Software
The software on the Teensy in the Ke Ao cubesat.
Loading...
Searching...
No Matches
Artemis::Devices::CurrentSensors Class Reference

The current sensors on the satellite. More...

#include <artemis_devices.h>

Classes

struct  currentbeacon1
 The first current beacon structure. More...
 
struct  currentbeacon2
 The second current beacon structure. More...
 

Public Member Functions

int32_t setup (void)
 Sets up I2C connection to current sensors.
 
int32_t read (uint32_t uptime)
 Reads current sensors and generates two packets on both RFM23 and Astrodev queues.
 

Public Attributes

std::map< std::string, Adafruit_INA219 * > current_sensors
 Mapping between current sensor string names and current sensor objects.
 

Detailed Description

The current sensors on the satellite.

Member Function Documentation

◆ read()

int32_t Artemis::Devices::CurrentSensors::read ( uint32_t  uptime)

Reads current sensors and generates two packets on both RFM23 and Astrodev queues.

Parameters
uptimeThe time, in milliseconds, that the Teensy has been powered on.
Returns
int32_t Always returns 0.

It is possible to poll the remaining current sensors if one has not been set up.

A single packet is used in this function. It is copied as needed. Two current beacons are created, to hold all the current measurements.

The packet's header information is filled out, identifying the originator node, destination node, and packet type.

The current sensors are iterated over. Each sensor is polled for its bus voltage and current. The first few sensors, defined by ARTEMIS_CURRENT_BEACON_1_COUNT, are stored in the first current beacon's array, with the remainder stored in the second current beacon's array.

The first beacon is given an identifier value, then copied into the into the payload of the packet. The packet is then copied into the RFM23 and Astrodev queues for transmission.

The second beacon is given an identifier value, then copied into the into the payload of the packet. The packet is then copied into the RFM23 and Astrodev queues for transmission.

◆ setup()

int32_t Artemis::Devices::CurrentSensors::setup ( void  )

Sets up I2C connection to current sensors.

Returns
int32_t Returns 0 if sucessful, -1 if failed.
Todo:
go through library and see what we need to configure and callibrate

Member Data Documentation

◆ current_sensors

std::map<std::string, Adafruit_INA219 *> Artemis::Devices::CurrentSensors::current_sensors
Initial value:
= {
{"solar_panel_1", new Adafruit_INA219(0x40)},
{"solar_panel_2", new Adafruit_INA219(0x41)},
{"solar_panel_3", new Adafruit_INA219(0x42)},
{"solar_panel_4", new Adafruit_INA219(0x43)},
{"battery_board", new Adafruit_INA219(0x44)},
}

Mapping between current sensor string names and current sensor objects.

Each current sensor is instantiated as an Adafruit INA219 current sensor object. These objects are initialized with I2C addresses, allowing the sensors to share the I2C bus.

The mapping is as follows:

  • "solar_panel_1" to 0x40
  • "solar_panel_2" to 0x41
  • "solar_panel_3" to 0x42
  • "solar_panel_4" to 0x43
  • "battery_board" to 0x44

The documentation for this class was generated from the following files: