APIs for interacting with an NTC thermistor e.g the NCP18XH103F03RB resistor on the CY8CPROTO-062-4343W board or the CY8CKIT-028-EPD shield Note: This lib uses floating point calculations during temperature calculation so it is recommended to enable floating point support.
◆ mtb_thermistor_ntc_gpio_cfg_t
struct mtb_thermistor_ntc_gpio_cfg_t |
Data Fields |
float |
r_ref |
Resistance of the reference resistor. |
float |
b_const |
Beta constant of the thermistor. |
float |
r_infinity |
Projected resistance of the thermistor at infinity. |
◆ mtb_thermistor_ntc_gpio_t
struct mtb_thermistor_ntc_gpio_t |
Data Fields |
cyhal_adc_channel_t |
channel |
Adc channel obj. |
cyhal_gpio_t |
gnd |
Ground reference pin. |
cyhal_gpio_t |
vdd |
VDD reference pin. |
cyhal_gpio_t |
out |
Voltage output. |
mtb_thermistor_ntc_gpio_cfg_t * |
cfg |
Ptr to thermistor cfg structure. |
mtb_thermistor_ntc_wiring |
wiring |
How the thermistor is wired up. |
◆ mtb_thermistor_ntc_wiring
Defines the way the NTC thermistor is wired up: Vin-NTC-R-GND or Vin-R-NTC-GND.
Enumerator |
---|
MTB_THERMISTOR_NTC_WIRING_VIN_R_NTC_GND | The thermistor is connected to Ground with the resister between it and Vin.
|
MTB_THERMISTOR_NTC_WIRING_VIN_NTC_R_GND | The thermistor is connected to Vin with the resister between it and ground.
|
◆ mtb_thermistor_ntc_gpio_init()
Initialize the ADC Channel and Pins to communicate with the thermistor.
- Parameters
-
[in,out] | obj | Pointer to a thermistor object containing the set of pins and adc channel that are associated with the thermistor. Note: The caller must allocate the memory for this object but the init function will initialize its contents. |
[out] | obj | Pointer to a Thermistor object. The caller must allocate the memory for this object but the init function will initialize its contents. |
[in] | adc | Pointer to an already initialized adc object |
[in] | gnd | Ground reference pin |
[in] | vdd | VDD reference pin |
[in] | out | Voltage output pin |
[in] | cfg | Pointer to the cfg object containing the thermistor constants |
[in] | wiring | How the circuit is wired up |
- Returns
- CY_RSLT_SUCCESS if properly initialized, else an error indicating what went wrong.
◆ mtb_thermistor_ntc_gpio_get_temp()
Gets the temperature reading, in degrees C, from the thermistor.
- Parameters
-
[in] | obj | Pointer to a thermistor object containing the set of pins and adc channel that are associated with the thermistor. |
- Returns
- The temperature reading, in degrees C, from the hardware.
◆ mtb_thermistor_ntc_gpio_free()
Frees up the ADC channel and Pins allocated for the thermistor.
- Parameters
-
[in] | obj | The set of pins and adc channel that are associated with the thermistor |