PER Firmware
Loading...
Searching...
No Matches
auto_switch.h File Reference
#include <source/pdu/main.h>
#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Classes

struct  voltage_t
 
struct  auto_switches_t
 

Macros

#define SHUNT_R   10000000
 
#define ADC_MAX   4095
 
#define LV_24V_R1   47000
 
#define LV_24V_R2   3400
 
#define LV_5V_R1   4300
 
#define LV_5V_R2   3400
 
#define LV_3V3_R1   4300
 
#define LV_3V3_R2   10000
 
#define AMK_24V_R1   124300
 
#define AMK_24V_R2   10000
 
#define HP_CS_R1   180
 
#define HP_CS_R2   330
 
#define HP_CS_R3   500
 
#define HP_CS_R_SENSE   0.002
 
#define CS_GAIN   100
 

Enumerations

enum  switches_t {
  SW_PUMP_1 , SW_PUMP_2 , SW_SDC , SW_HXFAN ,
  SW_FAN_1 , SW_FAN_2 , SW_FAN_3 , SW_FAN_4 ,
  SW_AMK1 , SW_AMK2 , SW_DASH , SW_ABOX ,
  SW_MAIN , SW_DLFR , SW_DLBK , CS_24V ,
  CS_5V , CS_SWITCH_COUNT , SW_BLT , SW_CRIT_5V ,
  SW_TV , SW_DAQ , SW_FAN_5V
}
 

Functions

void setSwitch (switches_t auto_switch_enum, bool state)
 Enable or disable a switch.
 
bool getSwitchStatus (switches_t auto_switch_enum)
 Check if a switch is enabled.
 
void autoSwitchPeriodic ()
 Combined function that calls updateVoltage() and updateCurrent()
 
void checkSwitchFaults ()
 Checks the status of various auto switches to ensure rails are ok. Sets fault and activates blink indicator if not..
 
uint16_t getMuxReading (uint8_t channel)
 

Variables

auto_switches_t auto_switches
 

Detailed Description

Author
Gavin Zyonse (gzyon.nosp@m.se@p.nosp@m.urdue.nosp@m..edu)
Version
1.0
Date
2023-11-09

Function Documentation

◆ autoSwitchPeriodic()

void autoSwitchPeriodic ( )

Combined function that calls updateVoltage() and updateCurrent()

Voltage on each rail is stored at: auto_switches.voltage.in_24v auto_switches.voltage.out_5v auto_switches.voltage.out_3v3

Current through each switch is stored at: auto_switches.current[auto_switch_enum]

◆ getSwitchStatus()

bool getSwitchStatus ( switches_t auto_switch_enum)

Check if a switch is enabled.

Parameters
auto_switch_enumSwitch to check
Returns
1 if enabled, 0 if disabled

◆ setSwitch()

void setSwitch ( switches_t auto_switch_enum,
bool state )

Enable or disable a switch.

Parameters
auto_switch_enumSwitch to enable or disable
state1 to enable, 0 to disable