PER Firmware
Loading...
Searching...
No Matches
auto_switch.c File Reference
#include "auto_switch.h"
#include "common/can_library/faults_common.h"
#include "common/can_library/generated/PDU.h"
#include "common/phal/gpio.h"
#include "led.h"
#include "main.h"

Functions

uint16_t getMuxReading (uint8_t channel)
 
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..
 

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