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.

Parameters

inst[in] 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.

Returns

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

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.

Parameters

volts[in] Desired DAC voltage in Volts

Returns

CY_RSLT_SUCCESS if successful, else an error about what went wrong

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.

Parameters

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

Returns

CY_RSLT_SUCCESS if successful, else an error about what went wrong

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.

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

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

Returns

CY_RSLT_SUCCESS if successful, else an error about what went wrong

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()).

Parameters

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

Returns

CY_RSLT_SUCCESS if successful, else an error about what went wrong

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()).

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

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

Returns

CY_RSLT_SUCCESS if successful, else an error about what went wrong

static inline cy_rslt_t cy8ckit_032_set_led_control(cy8ckit_032_led_ctrl_t control)

Sets the control behavior for the CapSense LEDs.

Parameters

control[in] The controller for the CLEDs

Returns

CY_RSLT_SUCCESS if successful, else an error about what went wrong

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.

Parameters

control[out] The controller mode for the CLEDs.

Returns

CY_RSLT_SUCCESS if successful, else an error about what went wrong

static inline cy_rslt_t cy8ckit_032_get_button_states(uint8_t *states)

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

Parameters

states[out] The current state of each of the Buttons. See cy8ckit_032_button_t for bitmasks.

Returns

CY_RSLT_SUCCESS if successful, else an error about what went wrong

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.

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

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

Returns

CY_RSLT_SUCCESS if successful, else an error about what went wrong

static inline cy_rslt_t cy8ckit_032_get_temperature_c(float *temperature)

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

Parameters

temperature[out] The current temperature in degrees C.

Returns

CY_RSLT_SUCCESS if successful, else an error about what went wrong

static inline cy_rslt_t cy8ckit_032_get_humidity_percent(float *humidity)

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

Parameters

humidity[out] The current humidity percent.

Returns

CY_RSLT_SUCCESS if successful, else an error about what went wrong

static inline cy_rslt_t cy8ckit_032_get_ambient_light_lux(float *light)

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

Parameters

light[out] The current ambient light in lux.

Returns

CY_RSLT_SUCCESS if successful, else an error about what went wrong

static inline cy_rslt_t cy8ckit_032_get_potentiometer_voltage(float *voltage)

Gets the current potentiomenter voltage from the shield board.

Parameters

voltage[out] The current potentiometer voltage.

Returns

CY_RSLT_SUCCESS if successful, else an error about what went wrong