SRA Board Components
ESP-IDF component for SRA Board
Functions
switches.c File Reference
#include "switches.h"
Include dependency graph for switches.c:

Functions

esp_err_t enable_switches ()
 Enables tactile switches on the sra board, sets up required gpio's in input pull-up mode. More...
 
int read_switch (int switch_id)
 Reads the state of one of the four switches on sra board. More...
 

Function Documentation

◆ enable_switches()

esp_err_t enable_switches ( )

Enables tactile switches on the sra board, sets up required gpio's in input pull-up mode.

Returns
esp_err_t - returns ESP_OK if gpio's initialised, else it returns ESP_ERR_INVALID_ARG

◆ read_switch()

int read_switch ( int  switch_id)

Reads the state of one of the four switches on sra board.

Parameters
switch_idid of the switch which needs to be read, we can pass the following macros: SWITCH_1, SWITCH_2, SWITCH_3, SWITCH_4.
Returns
int - returns state of the switch, 1 if it is pressed and 0 if it is not pressed.