Zephyr API Documentation 4.0.0-rc3
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
current_sense_shunt.h File Reference

Go to the source code of this file.

Data Structures

struct  current_sense_shunt_dt_spec
 

Macros

#define CURRENT_SENSE_SHUNT_DT_SPEC_GET(node_id)
 Get current sensor information from devicetree.
 

Functions

static void current_sense_shunt_scale_dt (const struct current_sense_shunt_dt_spec *spec, int32_t *v_to_i)
 Calculates the actual amperage from the measured voltage.
 

Macro Definition Documentation

◆ CURRENT_SENSE_SHUNT_DT_SPEC_GET

#define CURRENT_SENSE_SHUNT_DT_SPEC_GET ( node_id)
Value:
{ \
.port = ADC_DT_SPEC_GET(node_id), \
.shunt_micro_ohms = DT_PROP(node_id, shunt_resistor_micro_ohms), \
}
#define ADC_DT_SPEC_GET(node_id)
Equivalent to ADC_DT_SPEC_GET_BY_IDX(node_id, 0).
Definition adc.h:516
#define DT_PROP(node_id, prop)
Get a devicetree property value.
Definition devicetree.h:745

Get current sensor information from devicetree.

This returns a static initializer for a current_sense_shunt_dt_spec structure given a devicetree node.

Parameters
node_idDevicetree node identifier.
Returns
Static initializer for an current_sense_shunt_dt_spec structure.

Function Documentation

◆ current_sense_shunt_scale_dt()

static void current_sense_shunt_scale_dt ( const struct current_sense_shunt_dt_spec * spec,
int32_t * v_to_i )
inlinestatic

Calculates the actual amperage from the measured voltage.

Parameters
[in]speccurrent sensor specification from Devicetree.
[in,out]v_to_iPointer to the measured voltage in millivolts on input, and the corresponding scaled current value in milliamps on output.