Midnight Sun Firmware
Loading...
Searching...
No Matches
Current Sensing

ACS37800 Current Sensing library. More...

Classes

struct  ACS37800_Storage
 

Functions

StatusCode acs37800_init (ACS37800_Storage *storage, I2CPort *i2c_port, I2CAddress *i2c_address)
 Initialize the ACS37800 driver. More...
 
StatusCode acs37800_get_current (ACS37800_Storage *storage, float *out_current_amps)
 Gets the instantaneous current in amps. More...
 
StatusCode acs37800_get_voltage (ACS37800_Storage *storage, float *out_voltage_mV)
 Gets the instantaneous voltage in volts. More...
 
StatusCode acs37800_get_active_power (ACS37800_Storage *storage, float *out_power_mW)
 Gets the instantaneous power in milliwatts. More...
 
StatusCode acs37800_get_overcurrent_flag (ACS37800_Storage *storage, bool *overcurrent_flag)
 Gets if the ACS37800 unit detects over-current (latched) More...
 
StatusCode acs37800_reset_overcurrent_flag (ACS37800_Storage *storage)
 Resets the latched overcurrent fault, needs to write 1 to 0x2D register. More...
 
StatusCode acs37800_get_overvoltage_flag (ACS37800_Storage *storage, bool *overvoltage_flag)
 Gets if the ACS37800 unit detects over-voltage. More...
 
StatusCode acs37800_get_undervoltage_flag (ACS37800_Storage *storage, bool *undervoltage_flag)
 Gets if the ACS37800 unit detects under-voltage. More...
 
StatusCode acs37800_get_register (ACS37800_Storage *storage, ACS37800_Registers reg, uint32_t *out_raw)
 Gets the 16 bit value from the ACS37800 volatile register. More...
 

Detailed Description

ACS37800 Current Sensing library.

Function Documentation

◆ acs37800_get_active_power()

StatusCode acs37800_get_active_power ( ACS37800_Storage storage,
float *  out_power_mW 
)

Gets the instantaneous power in milliwatts.

Parameters
storage- pointer to already initialized ACS37800 struct
out_power- power in milliwatts
Returns
STATUS_CODE_OK on success

◆ acs37800_get_current()

StatusCode acs37800_get_current ( ACS37800_Storage storage,
float *  out_current_amps 
)

Gets the instantaneous current in amps.

Parameters
storage- pointer to already initialized ACS37800 struct
out_current_amps- current in amps
Returns
STATUS_CODE_OK on success

◆ acs37800_get_overcurrent_flag()

StatusCode acs37800_get_overcurrent_flag ( ACS37800_Storage storage,
bool *  overcurrent_flag 
)

Gets if the ACS37800 unit detects over-current (latched)

Parameters
storage- pointer to already initialized ACS37800 struct
overcurrent_flag- boolean to state if over-current happened (true -> over-current active)
Returns
STATUS_CODE_OK on success

◆ acs37800_get_overvoltage_flag()

StatusCode acs37800_get_overvoltage_flag ( ACS37800_Storage storage,
bool *  overvoltage_flag 
)

Gets if the ACS37800 unit detects over-voltage.

Parameters
storage- pointer to already initialized ACS37800 struct
overcurrent_flag- boolean to state if over-voltage happened (true -> over-voltage active)
Returns
STATUS_CODE_OK on success

◆ acs37800_get_register()

StatusCode acs37800_get_register ( ACS37800_Storage storage,
ACS37800_Registers  reg,
uint32_t *  out_raw 
)

Gets the 16 bit value from the ACS37800 volatile register.

Parameters
storage- pointer to already initialized ACS37800 struct
reg- register address
out- 32 bit value at that register
Returns
STATUS_CODE_OK on success

◆ acs37800_get_undervoltage_flag()

StatusCode acs37800_get_undervoltage_flag ( ACS37800_Storage storage,
bool *  undervoltage_flag 
)

Gets if the ACS37800 unit detects under-voltage.

Parameters
storage- pointer to already initialized ACS37800 struct
overcurrent_flag- boolean to state if under-voltage happened (true -> under-voltage active)
Returns
STATUS_CODE_OK on success

◆ acs37800_get_voltage()

StatusCode acs37800_get_voltage ( ACS37800_Storage storage,
float *  out_voltage_mV 
)

Gets the instantaneous voltage in volts.

Parameters
storage- pointer to already initialized ACS37800 struct
out_voltage_mV- voltage in milivolts
Returns
STATUS_CODE_OK on success

◆ acs37800_init()

StatusCode acs37800_init ( ACS37800_Storage storage,
I2CPort i2c_port,
I2CAddress i2c_address 
)

Initialize the ACS37800 driver.

Parameters
storage- a pointer to the ACS37800 struct, to be initialized
i2c_port- I2C port peripheral
i2c_address- I2C address peripheral
Returns
STATUS_CODE_OK on success

◆ acs37800_reset_overcurrent_flag()

StatusCode acs37800_reset_overcurrent_flag ( ACS37800_Storage storage)

Resets the latched overcurrent fault, needs to write 1 to 0x2D register.

Parameters
storage- pointer to already initialized ACS37800 struct
Returns
STATUS_CODE_OK on success