Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_gpio

Driver for general purpose input/output. More...

Enumerations

enum  bc_gpio_channel_t {
  BC_GPIO_P0 = 0,
  BC_GPIO_P1 = 1,
  BC_GPIO_P2 = 2,
  BC_GPIO_P3 = 3,
  BC_GPIO_P4 = 4,
  BC_GPIO_P5 = 5,
  BC_GPIO_P6 = 6,
  BC_GPIO_P7 = 7,
  BC_GPIO_P8 = 8,
  BC_GPIO_P9 = 9,
  BC_GPIO_P10 = 10,
  BC_GPIO_P11 = 11,
  BC_GPIO_P12 = 12,
  BC_GPIO_P13 = 13,
  BC_GPIO_P14 = 14,
  BC_GPIO_P15 = 15,
  BC_GPIO_P16 = 16,
  BC_GPIO_P17 = 17,
  BC_GPIO_LED = 18,
  BC_GPIO_BUTTON = 19,
  BC_GPIO_INT = 20
}
 GPIO channels. More...
 
enum  bc_gpio_pull_t {
  BC_GPIO_PULL_NONE = 0,
  BC_GPIO_PULL_UP = 1,
  BC_GPIO_PULL_DOWN = 2
}
 GPIO pull-up/pull-down setting. More...
 
enum  bc_gpio_mode_t {
  BC_GPIO_MODE_INPUT = 0,
  BC_GPIO_MODE_OUTPUT = 1,
  BC_GPIO_MODE_ALTERNATE = 2,
  BC_GPIO_MODE_ANALOG = 3,
  BC_GPIO_MODE_OUTPUT_OD = 4,
  BC_GPIO_MODE_ALTERNATE_0 = (0 << 4) | 2,
  BC_GPIO_MODE_ALTERNATE_1 = (1 << 4) | 2,
  BC_GPIO_MODE_ALTERNATE_2 = (2 << 4) | 2,
  BC_GPIO_MODE_ALTERNATE_3 = (3 << 4) | 2,
  BC_GPIO_MODE_ALTERNATE_4 = (4 << 4) | 2,
  BC_GPIO_MODE_ALTERNATE_5 = (5 << 4) | 2,
  BC_GPIO_MODE_ALTERNATE_6 = (6 << 4) | 2,
  BC_GPIO_MODE_ALTERNATE_7 = (7 << 4) | 2
}
 GPIO mode of operation. More...
 

Functions

void bc_gpio_init (bc_gpio_channel_t channel)
 Initialize GPIO channel. More...
 
void bc_gpio_set_pull (bc_gpio_channel_t channel, bc_gpio_pull_t pull)
 Set pull-up/pull-down configuration for GPIO channel. More...
 
bc_gpio_pull_t bc_gpio_get_pull (bc_gpio_channel_t channel)
 Get pull-up/pull-down configuration for GPIO channel. More...
 
void bc_gpio_set_mode (bc_gpio_channel_t channel, bc_gpio_mode_t mode)
 Set mode of operation for GPIO channel. More...
 
bc_gpio_mode_t bc_gpio_get_mode (bc_gpio_channel_t channel)
 Get mode of operation for GPIO channel. More...
 
int bc_gpio_get_input (bc_gpio_channel_t channel)
 Get input state for GPIO channel. More...
 
void bc_gpio_set_output (bc_gpio_channel_t channel, int state)
 Set output state for GPIO channel. More...
 
int bc_gpio_get_output (bc_gpio_channel_t channel)
 Get output state for GPIO channel. More...
 
void bc_gpio_toggle_output (bc_gpio_channel_t channel)
 Toggle output state for GPIO channel. More...
 

Detailed Description

Driver for general purpose input/output.

Enumeration Type Documentation

GPIO channels.

Enumerator
BC_GPIO_P0 

GPIO channel P0.

BC_GPIO_P1 

GPIO channel P1.

BC_GPIO_P2 

GPIO channel P2.

BC_GPIO_P3 

GPIO channel P3.

BC_GPIO_P4 

GPIO channel P4.

BC_GPIO_P5 

GPIO channel P5.

BC_GPIO_P6 

GPIO channel P6.

BC_GPIO_P7 

GPIO channel P7.

BC_GPIO_P8 

GPIO channel P8.

BC_GPIO_P9 

GPIO channel P9.

BC_GPIO_P10 

GPIO channel P10.

BC_GPIO_P11 

GPIO channel P11.

BC_GPIO_P12 

GPIO channel P12.

BC_GPIO_P13 

GPIO channel P13.

BC_GPIO_P14 

GPIO channel P14.

BC_GPIO_P15 

GPIO channel P15.

BC_GPIO_P16 

GPIO channel P16.

BC_GPIO_P17 

GPIO channel P17.

BC_GPIO_LED 

GPIO channel LED.

BC_GPIO_BUTTON 

GPIO channel BUTTON.

BC_GPIO_INT 

GPIO channel BUTTON.

Definition at line 12 of file bc_gpio.h.

GPIO mode of operation.

Enumerator
BC_GPIO_MODE_INPUT 

GPIO channel operates as input.

BC_GPIO_MODE_OUTPUT 

GPIO channel operates as output.

BC_GPIO_MODE_ALTERNATE 

GPIO channel operates in alternate mode.

BC_GPIO_MODE_ANALOG 

GPIO channel operates in analog mode.

BC_GPIO_MODE_OUTPUT_OD 

GPIO channel operates as open-drain output.

BC_GPIO_MODE_ALTERNATE_0 

GPIO channel operates in alternate mode AF0.

BC_GPIO_MODE_ALTERNATE_1 

GPIO channel operates in alternate mode AF1.

BC_GPIO_MODE_ALTERNATE_2 

GPIO channel operates in alternate mode AF2.

BC_GPIO_MODE_ALTERNATE_3 

GPIO channel operates in alternate mode AF3.

BC_GPIO_MODE_ALTERNATE_4 

GPIO channel operates in alternate mode AF4.

BC_GPIO_MODE_ALTERNATE_5 

GPIO channel operates in alternate mode AF5.

BC_GPIO_MODE_ALTERNATE_6 

GPIO channel operates in alternate mode AF6.

BC_GPIO_MODE_ALTERNATE_7 

GPIO channel operates in alternate mode AF7.

Definition at line 96 of file bc_gpio.h.

GPIO pull-up/pull-down setting.

Enumerator
BC_GPIO_PULL_NONE 

GPIO channel has no pull-up/pull-down.

BC_GPIO_PULL_UP 

GPIO channel has pull-up.

BC_GPIO_PULL_DOWN 

GPIO channel has pull-down.

Definition at line 81 of file bc_gpio.h.

Function Documentation

int bc_gpio_get_input ( bc_gpio_channel_t  channel)

Get input state for GPIO channel.

Parameters
channelGPIO channel
Returns
state Input state

Definition at line 436 of file bc_gpio.c.

Referenced by bc_module_sensor_get_input().

Here is the caller graph for this function:

bc_gpio_mode_t bc_gpio_get_mode ( bc_gpio_channel_t  channel)

Get mode of operation for GPIO channel.

Parameters
[in]channelGPIO channel
Returns
Mode of operation

Definition at line 399 of file bc_gpio.c.

int bc_gpio_get_output ( bc_gpio_channel_t  channel)

Get output state for GPIO channel.

Parameters
[in]channelGPIO channel
Returns
Output state

Definition at line 448 of file bc_gpio.c.

Referenced by bc_module_sensor_get_output().

Here is the caller graph for this function:

bc_gpio_pull_t bc_gpio_get_pull ( bc_gpio_channel_t  channel)

Get pull-up/pull-down configuration for GPIO channel.

Parameters
[in]channelGPIO channel
Returns
Pull-up/pull-down configuration

Definition at line 334 of file bc_gpio.c.

Referenced by bc_module_sensor_get_pull().

Here is the caller graph for this function:

void bc_gpio_init ( bc_gpio_channel_t  channel)

Initialize GPIO channel.

Parameters
channelGPIO channel

Definition at line 301 of file bc_gpio.c.

Referenced by bc_esp8266_init(), bc_module_battery_init(), bc_module_encoder_init(), bc_module_power_init(), bc_module_sensor_init(), bc_onewire_init(), bc_pwm_enable(), bc_rf_ook_init(), bc_switch_init(), bc_td1207r_init(), and bc_wssfm10r1at_init().

Here is the call graph for this function:

Here is the caller graph for this function:

void bc_gpio_set_mode ( bc_gpio_channel_t  channel,
bc_gpio_mode_t  mode 
)

Set mode of operation for GPIO channel.

Parameters
[in]channelGPIO channel
[in]modeDesired mode of operation

Definition at line 340 of file bc_gpio.c.

Referenced by bc_button_init(), bc_esp8266_init(), bc_led_init(), bc_module_encoder_deinit(), bc_module_power_init(), bc_module_sensor_set_mode(), bc_onewire_init(), bc_pwm_disable(), bc_pwm_enable(), bc_rf_ook_init(), bc_switch_init(), bc_td1207r_init(), and bc_wssfm10r1at_init().

Here is the call graph for this function:

Here is the caller graph for this function:

void bc_gpio_set_output ( bc_gpio_channel_t  channel,
int  state 
)

Set output state for GPIO channel.

Parameters
[in]channelGPIO channel
[in]stateDesired output state

Definition at line 442 of file bc_gpio.c.

Referenced by bc_esp8266_init(), bc_hc_sr04_measure(), bc_module_power_relay_set_state(), bc_module_sensor_set_output(), bc_td1207r_init(), and bc_wssfm10r1at_init().

Here is the caller graph for this function:

void bc_gpio_set_pull ( bc_gpio_channel_t  channel,
bc_gpio_pull_t  pull 
)

Set pull-up/pull-down configuration for GPIO channel.

Parameters
[in]channelGPIO channel
[in]pullDesired pull-up/pull-down configuration

Definition at line 313 of file bc_gpio.c.

Referenced by bc_button_init(), bc_module_sensor_set_pull(), bc_onewire_init(), and bc_switch_init().

Here is the call graph for this function:

Here is the caller graph for this function:

void bc_gpio_toggle_output ( bc_gpio_channel_t  channel)

Toggle output state for GPIO channel.

Parameters
[in]channelGPIO channel

Definition at line 454 of file bc_gpio.c.

Referenced by bc_module_sensor_toggle_output().

Here is the call graph for this function:

Here is the caller graph for this function: