11#include "support/configCosmosKernel.h"
13#include <TeensyThreads.h>
24#define PDU_CMD_OFFSET 48
132 uint8_t sw_state = 0;
168 uint8_t sw_state[12];
180 PDU(HardwareSerial *hw_serial,
int baud_rate);
184 int32_t
recv(std::string &response);
195 HardwareSerial *serial;
The satellite's Power Distribution Unit (PDU).
Definition pdu.h:29
int32_t recv(std::string &response)
Receive a PDU packet from the PDU.
Definition pdu.cpp:68
int32_t send(pdu_packet packet)
Send a PDU packet to the PDU.
Definition pdu.cpp:36
int32_t get_switch(PDU_SW sw, string &ret)
Gets the state of a switch on the PDU.
Definition pdu.cpp:154
std::map< std::string, PDU_SW > PDU_SW_Type
Mapping of string switch names to corresponding switch enums.
Definition pdu.h:85
PDU_Type
Enumeration of PDU packet type.
Definition pdu.h:37
@ NOP
No particular packet type. Just raw data.
@ DataPong
A pong reply from the PDU.
@ CommandSetSwitch
A command to set a switch on the PDU.
@ DataSwitchStatus
A switch status reply from the PDU.
@ CommandPing
A ping packet sent to the PDU.
PDU_SW
Enumeration of PDU switches.
Definition pdu.h:58
@ SW_5V_2
The second 5V switch.
@ BURN1
The first burnwire switch.
@ SW_5V_1
The first 5V switch.
@ SW_5V_3
The third 5V switch.
@ None
No particular switch.
@ VBATT
The battery voltage switch.
@ WDT
The PDU's WatchDog Timer (WDT).
@ SW_3V3_1
The first 3.3V switch.
@ HBRIDGE2
The first H-bridge.
@ RPI
The Raspberry Pi power switch.
@ SW_3V3_2
The second 3.3V switch.
@ All
All switches on the PDU.
@ HBRIDGE1
The first H-bridge.
@ BURN2
The second burnwire switch.
@ SW_5V_4
The fourth 5V switch.
int32_t set_switch(PDU_SW sw, uint8_t enable)
Set a switch on the PDU.
Definition pdu.cpp:98
Definitions of Serial Console helper functions.
The PDU packet structure.
Definition pdu.h:113
The PDU telemetry packet structure.
Definition pdu.h:152