Analog Front End

group group_board_libs_afe

APIs for interacting with the sensors and user interface widgets on the board.

Enums

enum cy8ckit_032_led_ctrl_t

cy8ckit_032_led_ctrl_t: Different operating mode for the CapSense LEDs (CLED0, CLED1, CLED2, CLED3).

cy8ckit_032_set_led_control()

Values:

enumerator CY8CKIT_032_LED_CTRL_CAPSENSE

LEDs are controlled by CapSense signal detect.

enumerator CY8CKIT_032_LED_CTRL_SW

LEDs are controlled by sofware.

cy8ckit_032_set_cled_states()

enum cy8ckit_032_cled_t

cy8ckit_032_cled_t: The CapSense LEDs that can be controlled by the CapSense detection, or software.

See:

Values:

enumerator CY8CKIT_032_CLED0

CapSense LED0.

enumerator CY8CKIT_032_CLED1

CapSense LED1.

enumerator CY8CKIT_032_CLED2

CapSense LED2.

enumerator CY8CKIT_032_CLED3

CapSense LED3.

enum cy8ckit_032_button_t

cy8ckit_032_button_t: The different buttons that are read by cy8ckit_032_get_button_states() or cy8ckit_032_get_button_state()

Values:

enumerator CY8CKIT_032_BTN_CAPSENSE_B0

CapSense Button 0 (B0)

enumerator CY8CKIT_032_BTN_CAPSENSE_B1

CapSense Button 1 (B1)

enumerator CY8CKIT_032_BTN_CAPSENSE_B2

CapSense Button 2 (B2)

enumerator CY8CKIT_032_BTN_CAPSENSE_B3

CapSense Button 3 (B3)

enumerator CY8CKIT_032_BTN_MECHANICAL_B1

Mechanical Button 1 (MB1)

enumerator CY8CKIT_032_BTN_MECHANICAL_B2

Mechanical Button 2 (MB2)

enumerator CY8CKIT_032_BTN_PROXIMITY

Proximity Sensor (Proximity Loop)

Functions

cy_rslt_t cy8ckit_032_init(cyhal_i2c_t *inst)

Initializes the I2C interface for communicating with the AFE and OLED components on the board.

Return

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

Parameters
  • [in] inst: An optional I2C instance to use for communicating with the peripherals on the shield. If NULL, a new instance will be allocated using the CYBSP_I2C_SCL & CYBSP_I2C_SDA pins.

void cy8ckit_032_free(void)

Frees up any resources allocated as part of cy8ckit_032_init().

static inline cy_rslt_t cy8ckit_032_set_dac_voltage(float volts)

Updates the output voltage from the DAC on the shield board.

Return

CY_RSLT_SUCCESS if successful, else an error about what went wrong

Parameters
  • [in] volts: Desired DAC voltage in Volts

static inline cy_rslt_t cy8ckit_032_get_cled_states(uint8_t *states)

Gets the current state of the CapSense LEDs on the shield board.

Return

CY_RSLT_SUCCESS if successful, else an error about what went wrong

Parameters
  • [out] states: The current state of each of the CLEDs. See cy8ckit_032_cled_t for bitmasks.

cy_rslt_t cy8ckit_032_get_cled_state(cy8ckit_032_cled_t cled, bool *state)

Gets the current state of a single CapSense LED on the shield board.

Return

CY_RSLT_SUCCESS if successful, else an error about what went wrong

Parameters
  • [in] cled: The CLED to get the state for

  • [out] state: The current state of the requested CLED.

static inline cy_rslt_t cy8ckit_032_set_cled_states(uint8_t states)

Sets the current state of the CapSense LEDs on the shield board if it is configured for Software Control (cy8ckit_032_set_led_control()).

Return

CY_RSLT_SUCCESS if successful, else an error about what went wrong

Parameters
  • [in] states: The desired state of each of the CLED pins. See cy8ckit_032_cled_t for bitmasks.

cy_rslt_t cy8ckit_032_set_cled_state(cy8ckit_032_cled_t cled, bool state)

Sets the current state of the referenced CapSense LED on the shield board if it is configured for Software Control (cy8ckit_032_set_led_control()).

Return

CY_RSLT_SUCCESS if successful, else an error about what went wrong

Parameters
  • [in] cled: The CLED to get the state for

  • [in] state: The desired state of the requested CLED.

static inline cy_rslt_t cy8ckit_032_set_led_control(cy8ckit_032_led_ctrl_t control)

Sets the control behavior for the CapSense LEDs.

Return

CY_RSLT_SUCCESS if successful, else an error about what went wrong

Parameters
  • [in] control: The controller for the CLEDs

static inline cy_rslt_t cy8ckit_032_get_led_control(cy8ckit_032_led_ctrl_t *control)

Gets the current controller mode for the CapSense LEDs.

Return

CY_RSLT_SUCCESS if successful, else an error about what went wrong

Parameters
  • [out] control: The controller mode for the CLEDs.

static inline cy_rslt_t cy8ckit_032_get_button_states(uint8_t *states)

Gets the current state of the Buttons on the shield board.

Return

CY_RSLT_SUCCESS if successful, else an error about what went wrong

Parameters

cy_rslt_t cy8ckit_032_get_button_state(cy8ckit_032_button_t button, bool *state)

Gets the current state of a single Button on the shield board.

Return

CY_RSLT_SUCCESS if successful, else an error about what went wrong

Parameters
  • [in] button: The Button to get the state for

  • [out] state: The current state of the requested Button.

static inline cy_rslt_t cy8ckit_032_get_temperature_c(float *temperature)

Gets the current temperature, in degrees C, from the shield board.

Return

CY_RSLT_SUCCESS if successful, else an error about what went wrong

Parameters
  • [out] temperature: The current temperature in degrees C.

static inline cy_rslt_t cy8ckit_032_get_humidity_percent(float *humidity)

Gets the current humidity, in percent, from the shield board.

Return

CY_RSLT_SUCCESS if successful, else an error about what went wrong

Parameters
  • [out] humidity: The current humidity percent.

static inline cy_rslt_t cy8ckit_032_get_ambient_light_lux(float *light)

Gets the ambient light measurement, in lux, from the shield board.

Return

CY_RSLT_SUCCESS if successful, else an error about what went wrong

Parameters
  • [out] light: The current ambient light in lux.

static inline cy_rslt_t cy8ckit_032_get_potentiometer_voltage(float *voltage)

Gets the current potentiomenter voltage from the shield board.

Return

CY_RSLT_SUCCESS if successful, else an error about what went wrong

Parameters
  • [out] voltage: The current potentiometer voltage.