API Reference¶
-
group
group_board_libs
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.
Enums
-
enum
mtb_thermistor_ntc_wiring
¶ mtb_thermistor_ntc_wiring: Defines the way the NTC thermistor is wired up: Vin-NTC-R-GND or Vin-R-NTC-GND.
Values:
-
enumerator
MTB_THERMISTOR_NTC_WIRING_VIN_R_NTC_GND
¶ The thermistor is connected to Ground with the resister between it and Vin.
-
enumerator
MTB_THERMISTOR_NTC_WIRING_VIN_NTC_R_GND
¶ The thermistor is connected to Vin with the resister between it and ground.
-
enumerator
Functions
-
cy_rslt_t
mtb_thermistor_ntc_gpio_init
(mtb_thermistor_ntc_gpio_t *obj, cyhal_adc_t *adc, cyhal_gpio_t gnd, cyhal_gpio_t vdd, cyhal_gpio_t out, mtb_thermistor_ntc_gpio_cfg_t *cfg, mtb_thermistor_ntc_wiring wiring)¶ Initialize the ADC Channel and Pins to communicate with the thermistor.
- Parameters
obj – [inout] 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.
obj – [out] Pointer to a Thermistor object. The caller must allocate the memory for this object but the init function will initialize its contents.
adc – [in] Pointer to an already initialized adc object
gnd – [in] Ground reference pin
vdd – [in] VDD reference pin
out – [in] Voltage output pin
cfg – [in] Pointer to the cfg object containing the thermistor constants
wiring – [in] How the circuit is wired up
- Returns
CY_RSLT_SUCCESS if properly initialized, else an error indicating what went wrong.
-
float
mtb_thermistor_ntc_gpio_get_temp
(mtb_thermistor_ntc_gpio_t *obj)¶ Gets the temperature reading, in degrees C, from the thermistor.
- Parameters
obj – [in] 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.
-
void
mtb_thermistor_ntc_gpio_free
(mtb_thermistor_ntc_gpio_t *obj)¶ Frees up the ADC channel and Pins allocated for the thermistor.
- Parameters
obj – [in] The set of pins and adc channel that are associated with the thermistor
-
struct
mtb_thermistor_ntc_gpio_cfg_t
¶ - #include <>
Configuration structure containing ntc thermistor constants.
-
struct
mtb_thermistor_ntc_gpio_t
¶ - #include <>
Structure defining the pins and adc channel used to interact with the ntc thermistor.
-
enum