Ke Ao Teensy Flight Software
The software on the Teensy in the Ke Ao cubesat.
|
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. | |
The current sensors on the satellite.
int32_t Artemis::Devices::CurrentSensors::read | ( | uint32_t | uptime | ) |
Reads current sensors and generates two packets on both RFM23 and Astrodev queues.
uptime | The time, in milliseconds, that the Teensy has been powered on. |
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.
int32_t Artemis::Devices::CurrentSensors::setup | ( | void | ) |
Sets up I2C connection to current sensors.
std::map<std::string, Adafruit_INA219 *> Artemis::Devices::CurrentSensors::current_sensors |
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: