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.

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.

Return

CY_RSLT_SUCCESS if properly initialized, else an error indicating what went wrong.

Parameters
  • [inout] 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

float mtb_thermistor_ntc_gpio_get_temp(mtb_thermistor_ntc_gpio_t *obj)

Gets the temperature reading, in degrees C, from the thermistor.

Return

The temperature reading, in degrees C, from the hardware.

Parameters
  • [in] obj: Pointer to a thermistor object containing the set of pins and adc channel that are associated with the thermistor.

void mtb_thermistor_ntc_gpio_free(mtb_thermistor_ntc_gpio_t *obj)

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

struct mtb_thermistor_ntc_gpio_cfg_t
#include <mtb_thermistor_ntc_gpio.h>

Configuration structure containing ntc thermistor constants.

struct mtb_thermistor_ntc_gpio_t
#include <mtb_thermistor_ntc_gpio.h>

Structure defining the pins and adc channel used to interact with the ntc thermistor.