coincellhell 1.0.x
Data Structures | Functions
User API

API to control EISmultiplexer devices. More...

Data Structures

struct  coincellhell
 
struct  heater_state
 
struct  cell_state
 
struct  trigger_state
 

Functions

uint16_t * coincellhell_list_available_devices (size_t *count)
 Lists the available coincellhell devices.
 
int coincellhell_connect (struct coincellhell *hell, uint16_t serial)
 Attempts to connect to a coincellhell device and initializes a coincellhell struct.
 
void coincellhell_register_disconnect_callback (struct coincellhell *hell, void(*deviceDisconnectedCb)(struct coincellhell *hell, void *user_data), void *user_data)
 Registers a callback that will be called when the device disconnects, the callback is called from a different thread and must be thread-safe.
 
int coincellhell_get_temperature (struct coincellhell *hell, uint8_t heater, temperature_sensor_location_t location, float *temperature)
 Reads the current temperature of the given heater at given location.
 
int coincellhell_set_temperature (struct coincellhell *hell, uint8_t heater, float temperature)
 Sets the target temperature of the given heater.
 
int coincellhell_set_max_current (struct coincellhell *hell, uint8_t heater, uint8_t maxCurrent)
 Sets the maximum current (really just the maximum dac commend) of the given heater.
 
int coincellhell_get_temperature_setpoint (struct coincellhell *hell, uint8_t heater, float *temperature)
 Gets the target temperature of the given heater.
 
int coincellhell_get_state (struct coincellhell *hell, uint8_t heater, struct heater_state *state)
 Gets the state struct for the given heater.
 
int coincellhell_set_enabled (struct coincellhell *hell, uint8_t heater, bool enabled)
 Sets the enabled state for a give heater.
 
int coincellhell_check_ready (struct coincellhell *hell, bool *ready)
 Checks if all temperatures are close to their set points.
 
int coincellhell_set_temperature_ramp (struct coincellhell *hell, uint8_t heater, time_t end_time, float temperature)
 Will linearly ramp the temperature to the one provided from now until end_time.
 
int coincellhell_cancle_ramp (struct coincellhell *hell, uint8_t heater)
 Cancels any previously set ramp, the set points of the heater will hold the current temperature.
 
int coincellhell_set_led (struct coincellhell *hell, bool on)
 Turns the led on the PCB on or off.
 
int coincellhell_set_pid (struct coincellhell *hell, float kp, float ki, float kd)
 Sets the heater pid coefficants.
 
int coincellhell_get_pid (struct coincellhell *hell, float *kp, float *ki, float *kd)
 Gets the heater pid coefficants.
 
int coincellhell_cell_set_voltage_limits (struct coincellhell *hell, uint8_t cell, float max, float min)
 Sets the voltage limits of the given cell.
 
int coincellhell_cell_set_charge_current (struct coincellhell *hell, uint8_t cell, float current)
 Sets the charge current for the given cell, chargeing is not commenced until the cell is put in the corrisponding state.
 
int coincellhell_cell_get_state (struct coincellhell *hell, uint8_t cell, struct cell_state *state)
 Gets the status struct for the specified cell.
 
int coincellhell_cell_set_state (struct coincellhell *hell, uint8_t cell, cell_state_t state)
 Gets the status struct for the specified cell.
 
int coincellhell_reset (struct coincellhell *hell)
 resets the device
 
void coincellhell_disconnect (struct coincellhell *hell)
 Disconnects from the coincellhell.
 
const char * coincellhell_string_for_fault (fault_t fault)
 Returns a human readable string for a given fault.
 
int coincellhell_get_trigger_state (struct coincellhell *hell, uint8_t trigger, struct trigger_state *state)
 
int coincellhell_set_trigger_state (struct coincellhell *hell, uint8_t trigger, trigger_state_t state)
 
int coincellhell_get_trigger_count (struct coincellhell *hell, uint8_t *count)
 
int coincellhell_write_eeprom (struct coincellhell *hell, uint16_t addr, uint16_t value)
 
uint16_t coincellhell_read_eeprom (struct coincellhell *hell, uint16_t addr)
 
uint8_t coincellhell_read_oscal (struct coincellhell *hell)
 
uint8_t coincellhell_read_oscal_error (struct coincellhell *hell)
 
uint32_t coincellhell_get_seconds (struct coincellhell *hell)
 
int coincellhell_cell_set_ignore_limits (struct coincellhell *hell, uint8_t cell, bool ignore_limits)
 
const char * coincellhell_get_fw_git_revision (struct coincellhell *hell)
 
int coincellhell_enable_watchdog (struct coincellhell *hell)
 
void coincellhell_reset_bus (struct coincellhell *hell)
 
int coincellhell_reboot_to_bootloader (struct coincellhell *hell)
 
int coincellhell_read_print_buffer (struct coincellhell *hell, char *buffer, size_t length)
 
int coincellhell_testcase (struct coincellhell *hell)
 

Detailed Description

API to control EISmultiplexer devices.

This API allows you to control the EISmultiplexer device.

Function Documentation

◆ coincellhell_cancle_ramp()

int coincellhell_cancle_ramp ( struct coincellhell hell,
uint8_t  heater 
)

Cancels any previously set ramp, the set points of the heater will hold the current temperature.

Parameters
heaterheater for which to cancel the ramp
Returns
0 on success and < 0 on failure

◆ coincellhell_cell_get_state()

int coincellhell_cell_get_state ( struct coincellhell hell,
uint8_t  cell,
struct cell_state state 
)

Gets the status struct for the specified cell.

Parameters
cellcell id
statestate struct to fill with the information on the cell
Returns
0 on success and < 0 on failure

◆ coincellhell_cell_set_charge_current()

int coincellhell_cell_set_charge_current ( struct coincellhell hell,
uint8_t  cell,
float  current 
)

Sets the charge current for the given cell, chargeing is not commenced until the cell is put in the corrisponding state.

Parameters
cellcell id
floatmax maximum voltage in volts
floatminimume voltage in volts
Returns
0 on success and < 0 on failure

◆ coincellhell_cell_set_state()

int coincellhell_cell_set_state ( struct coincellhell hell,
uint8_t  cell,
cell_state_t  state 
)

Gets the status struct for the specified cell.

Parameters
cellcell id
statestate struct to fill with the information on the cell
Returns
0 on success and < 0 on failure

◆ coincellhell_cell_set_voltage_limits()

int coincellhell_cell_set_voltage_limits ( struct coincellhell hell,
uint8_t  cell,
float  max,
float  min 
)

Sets the voltage limits of the given cell.

Parameters
cellcell id
floatmax maximum voltage in volts
floatminimume voltage in volts
Returns
0 on success and < 0 on failure

◆ coincellhell_check_ready()

int coincellhell_check_ready ( struct coincellhell hell,
bool *  ready 
)

Checks if all temperatures are close to their set points.

Parameters
readya pointer to a bool where the result will be stored, true if all temperatures have been reach, false otherwise
Returns
0 on success and < 0 on failure

◆ coincellhell_connect()

int coincellhell_connect ( struct coincellhell hell,
uint16_t  serial 
)

Attempts to connect to a coincellhell device and initializes a coincellhell struct.

Parameters
hellpointer to a coincellhell struct to initialize
serialThe serial number of the device to connect to, or 0 for any
Returns
0 on success and < 0 on failure

◆ coincellhell_get_pid()

int coincellhell_get_pid ( struct coincellhell hell,
float *  kp,
float *  ki,
float *  kd 
)

Gets the heater pid coefficants.

Parameters
hellpointer to a coincellhell struct
kpthe proportional coefficant
kithe integral coefficant
kdthe derivative coefficant
Returns
0 on success and < 0 on failure

◆ coincellhell_get_state()

int coincellhell_get_state ( struct coincellhell hell,
uint8_t  heater,
struct heater_state state 
)

Gets the state struct for the given heater.

Parameters
heaterheater for which to set the temperature
stateA struct where the state will be stored
Returns
0 on success and < 0 on failure

◆ coincellhell_get_temperature()

int coincellhell_get_temperature ( struct coincellhell hell,
uint8_t  heater,
temperature_sensor_location_t  location,
float *  temperature 
)

Reads the current temperature of the given heater at given location.

Parameters
heaterheater from which to get the temperature
locationPlace where temperature shall be measured
temperatureA float where the temperature in degrees Celsius will be stored
Returns
0 on success and < 0 on failure

◆ coincellhell_get_temperature_setpoint()

int coincellhell_get_temperature_setpoint ( struct coincellhell hell,
uint8_t  heater,
float *  temperature 
)

Gets the target temperature of the given heater.

Parameters
heaterheater for which to set the temperature
temperatureA float where the temperature in degrees Celsius will be stored
Returns
0 on success and < 0 on failure

◆ coincellhell_list_available_devices()

uint16_t * coincellhell_list_available_devices ( size_t *  count)

Lists the available coincellhell devices.

Parameters
countThe number of available coincellhell devices
Returns
An newly allocated array of length count with the serial numbers of the available devices to be freed by the user with free()

◆ coincellhell_register_disconnect_callback()

void coincellhell_register_disconnect_callback ( struct coincellhell hell,
void(*)(struct coincellhell *hell, void *user_data)  deviceDisconnectedCb,
void *  user_data 
)

Registers a callback that will be called when the device disconnects, the callback is called from a different thread and must be thread-safe.

Parameters
hellpointer to a coincellhell struct to initialize
deviceDisconnectedCbCallback function to call, Set to NULL to deregister
user_dataA user data pointer to be given to the callback function

◆ coincellhell_reset()

int coincellhell_reset ( struct coincellhell hell)

resets the device

Parameters
hellpointer to a coincellhell struct

◆ coincellhell_set_enabled()

int coincellhell_set_enabled ( struct coincellhell hell,
uint8_t  heater,
bool  enabled 
)

Sets the enabled state for a give heater.

Parameters
heaterheater for which to set the enabled state
stateA struct where the state will be stored
Returns
0 on success and < 0 on failure

◆ coincellhell_set_led()

int coincellhell_set_led ( struct coincellhell hell,
bool  on 
)

Turns the led on the PCB on or off.

Parameters
hellpointer to a coincellhell struct
ontrue to turn the led on, false to turn it off
Returns
0 on success and < 0 on failure

◆ coincellhell_set_max_current()

int coincellhell_set_max_current ( struct coincellhell hell,
uint8_t  heater,
uint8_t  maxCurrent 
)

Sets the maximum current (really just the maximum dac commend) of the given heater.

Parameters
heaterheater for which to set the temperature
maxCurrentthe unitless "current" to set
Returns
0 on success and < 0 on failure

◆ coincellhell_set_pid()

int coincellhell_set_pid ( struct coincellhell hell,
float  kp,
float  ki,
float  kd 
)

Sets the heater pid coefficants.

Parameters
hellpointer to a coincellhell struct
kpthe proportional coefficant
kithe integral coefficant
kdthe derivative coefficant
Returns
0 on success and < 0 on failure

◆ coincellhell_set_temperature()

int coincellhell_set_temperature ( struct coincellhell hell,
uint8_t  heater,
float  temperature 
)

Sets the target temperature of the given heater.

Parameters
heaterheater for which to set the temperature
temperaturetemperature to set
Returns
0 on success and < 0 on failure

◆ coincellhell_set_temperature_ramp()

int coincellhell_set_temperature_ramp ( struct coincellhell hell,
uint8_t  heater,
time_t  end_time,
float  temperature 
)

Will linearly ramp the temperature to the one provided from now until end_time.

Parameters
heaterheater for which to set the ramp
temperaturetemperature to ramp to
Returns
0 on success and < 0 on failure

◆ coincellhell_string_for_fault()

const char * coincellhell_string_for_fault ( fault_t  fault)

Returns a human readable string for a given fault.

Parameters
faultthe fault code
Returns
a const string describing the fault