ESP32_RTOS_SDK V1.1.0

- Main Page
- Modules
- Data Structures
- Files

Macros | Functions
GPIO Driver APIs
Driver APIs

GPIO APIs. More...

## Macros

#define | GPIO_OUTPUT_SET(gpio_no, bit_value)
| Set GPIO pin output level. More...
#define | GPIO_OUTPUT(gpio_bits, bit_value)
| Set GPIO pin output level,This function only config GPIO0-GPIO31 . More...
#define | GPIO_OUTPUT_HIGH(gpio_bits, bit_value)
| Set GPIO pin output level,This function only config GPIO32-GPIO39. More...
#define | GPIO_DIS_OUTPUT(gpio_no)
| Disable GPIO pin output. More...
#define | GPIO_AS_INPUT(gpio_bits) gpio_output_conf(0, 0, 0, gpio_bits)
| Enable GPIO pin intput,This function only config GPIO0-GPIO31. More...
#define | GPIO_AS_INPUT_HIGH(gpio_bits) gpio_output_conf_high(0, 0, 0, gpio_bits)
| Enable GPIO pin intput,This function only config GPIO32-GPIO39. More...
#define | GPIO_AS_OUTPUT(gpio_bits) gpio_output_conf(0, 0, gpio_bits, 0)
| Enable GPIO pin output,This function only config GPIO0-GPIO31. More...
#define | GPIO_AS_OUTPUT_HIGH(gpio_bits) gpio_output_conf_high(0, 0, gpio_bits, 0)
| Enable GPIO pin output,This function only config GPIO32-GPIO39. More...
#define | GPIO_INPUT_GET(gpio_no)
| Sample the level of GPIO input. More...

## Functions

void | gpio_config (GPIO_ConfigTypeDef *pGPIOConfig)
| GPIO init . More...
void | gpio_output_conf (uint32 set_mask, uint32 clear_mask, uint32 enable_mask, uint32 disable_mask)
| Configure GPIO pins out or input. More...
void | gpio_output_conf_high (uint32 set_mask, uint32 clear_mask, uint32 enable_mask, uint32 disable_mask)
| Configure GPIO pins out or input. More...
void | gpio_intr_handler_register (void *fn, void *arg)
| Register an application-specific interrupt handler for GPIO pin interrupts. More...
void | gpio_pin_wakeup_enable (uint32 i, GPIO_INT_TYPE intr_state)
| Configure GPIO wake up to light sleep,Only level way is effective. More...
void | gpio_pin_wakeup_disable (void)
| Disable GPIO wake up to light sleep. More...
void | gpio_pin_intr_state_set (uint32 i, GPIO_INT_TYPE intr_state)
| Config interrupt types of GPIO pin. More...
uint32 | gpio_input_get (void)
| Sample the value of GPIO input pins and returns a bitmask. This function only get the level GPIO0-GPIO31. More...
uint32 | gpio_input_get_high (void)
| Sample the value of GPIO input pins and returns a bitmask. This function only get the level GPIO32-GPIO39. More...
void | gpio_output_sigmadelta_enable (uint32 gpio_num, uint32 sigma_num, uint32 prescale)
| Enable GPIO sigmadelta function. More...
void | gpio_output_sigmadelta_disable (void)
| Disable GPIO sigmadelta function. More...
void | gpio_intr_config (uint32 gpio_num, uint32 intr_num, GPIO_INT_TYPE intr_type)
| Configure GPIO interrupr. More...
void | gpio_intr_process (void)
| The GPIO interrupt function. More...
void | gpio_matrix_in (uint32 gpio, uint32 signal_idx)
| To bind GPIO input and a certain road input signal. More...
void | gpio_matrix_out (uint32 gpio, uint32 signal_idx)
| To bind GPIO ouput and a certain road output signal. More...
void | intr_matrix_set (uint32 model_num, uint32 intr_num)
| To bind mode interrupt and interrupt sequence number. More...

## Detailed Description

GPIO APIs.

## Macro Definition Documentation

#define GPIO_AS_INPUT | ( |  | gpio_bits | ) | gpio_output_conf(0, 0, 0, gpio_bits)

Enable GPIO pin intput,This function only config GPIO0-GPIO31.

Parameters

  gpio_bits | : The GPIO bit number.

Returns
  null

#define GPIO_AS_INPUT_HIGH | ( |  | gpio_bits | ) | gpio_output_conf_high(0, 0, 0, gpio_bits)

Enable GPIO pin intput,This function only config GPIO32-GPIO39.

Parameters

  gpio_bits | : The GPIO bit number.

Returns
  null

#define GPIO_AS_OUTPUT | ( |  | gpio_bits | ) | gpio_output_conf(0, 0, gpio_bits, 0)

Enable GPIO pin output,This function only config GPIO0-GPIO31.

Parameters

  gpio_bits | : The GPIO bit number.

Returns
  null

#define GPIO_AS_OUTPUT_HIGH | ( |  | gpio_bits | ) | gpio_output_conf_high(0, 0, gpio_bits, 0)

Enable GPIO pin output,This function only config GPIO32-GPIO39.

Parameters

  gpio_bits | : The GPIO bit number.

Returns
  null

#define GPIO_DIS_OUTPUT | ( |  | gpio_no | ) |

Value:
((gpio_no < 32) ? \
gpio_output_conf(0, 0, 0, 1 << gpio_no) : gpio_output_conf_high(0, 0, 0, 1 << gpio_no))
gpio_output_conf_high
void gpio_output_conf_high(uint32 set_mask, uint32 clear_mask, uint32 enable_mask, uint32 disable_mask)
Configure GPIO pins out or input.
gpio_output_conf
void gpio_output_conf(uint32 set_mask, uint32 clear_mask, uint32 enable_mask, uint32 disable_mask)
Configure GPIO pins out or input.

Disable GPIO pin output.

Parameters

  gpio_no | : The GPIO sequence number.

Returns
  null

#define GPIO_INPUT_GET | ( |  | gpio_no | ) |

Value:
((gpio_no < 32) ? \
((gpio_input_get() >> gpio_no) & BIT0) : ((gpio_input_get_high() >> (gpio_no - 32)) & BIT0))
gpio_input_get_high
uint32 gpio_input_get_high(void)
Sample the value of GPIO input pins and returns a bitmask. This function only get the level GPIO32-GP...
gpio_input_get
uint32 gpio_input_get(void)
Sample the value of GPIO input pins and returns a bitmask. This function only get the level GPIO0-GPI...

Sample the level of GPIO input.

Parameters

  gpio_no | : The GPIO sequence number.

Returns
  the level of GPIO input

#define GPIO_OUTPUT | ( |  | gpio_bits,
|  |  | bit_value
| ) |  |

Value:
if(bit_value) gpio_output_conf(gpio_bits, 0, gpio_bits, 0);\
else gpio_output_conf(0, gpio_bits, gpio_bits, 0)
gpio_output_conf
void gpio_output_conf(uint32 set_mask, uint32 clear_mask, uint32 enable_mask, uint32 disable_mask)
Configure GPIO pins out or input.

Set GPIO pin output level,This function only config GPIO0-GPIO31 .

Parameters

  gpio_bits | : The GPIO bit number.
  bit_value | : GPIO pin output level.

Returns
  null

#define GPIO_OUTPUT_HIGH | ( |  | gpio_bits,
|  |  | bit_value
| ) |  |

Value:
if(bit_value) gpio_output_conf_high(gpio_bits, 0, gpio_bits, 0);\
else gpio_output_conf_high(0, gpio_bits, gpio_bits, 0)
gpio_output_conf_high
void gpio_output_conf_high(uint32 set_mask, uint32 clear_mask, uint32 enable_mask, uint32 disable_mask)
Configure GPIO pins out or input.

Set GPIO pin output level,This function only config GPIO32-GPIO39.

Parameters

  gpio_bits | : The GPIO bit number.
  bit_value | : GPIO pin output level.

Returns
  null

#define GPIO_OUTPUT_SET | ( |  | gpio_no,
|  |  | bit_value
| ) |  |

Value:
((gpio_no < 32) ? gpio_output_conf(bit_value << gpio_no, (bit_value ? 0 : 1) << gpio_no, 1 << gpio_no, 0) : \
gpio_output_conf_high(bit_value << (gpio_no - 32), (bit_value ? 0 : 1) << (gpio_no - 32), 1 << (gpio_no - 32),0))
gpio_output_conf_high
void gpio_output_conf_high(uint32 set_mask, uint32 clear_mask, uint32 enable_mask, uint32 disable_mask)
Configure GPIO pins out or input.
gpio_output_conf
void gpio_output_conf(uint32 set_mask, uint32 clear_mask, uint32 enable_mask, uint32 disable_mask)
Configure GPIO pins out or input.

Set GPIO pin output level.

Parameters

  gpio_no | : The GPIO sequence number.
  bit_value | : GPIO pin output level.

Returns
  null

## Function Documentation

void gpio_config | ( | GPIO_ConfigTypeDef * | pGPIOConfig | ) |

GPIO init .

Parameters

  pGPIOConfig | : through this structure initialization GPIO.

Returns
  null

uint32 gpio_input_get | ( | void |  | ) |

Sample the value of GPIO input pins and returns a bitmask. This function only get the level GPIO0-GPIO31.

Parameters

  null |

Returns
  bitmask of GPIO pins input

uint32 gpio_input_get_high | ( | void |  | ) |

Sample the value of GPIO input pins and returns a bitmask. This function only get the level GPIO32-GPIO39.

Parameters

  null |

Returns
  bitmask of GPIO pins input

void gpio_intr_config | ( | uint32 | gpio_num,
|  | uint32 | intr_num,
|  | GPIO_INT_TYPE | intr_type
| ) |  |

Configure GPIO interrupr.

Parameters

  uint32 | gpio_num : The GPIO sequence number.
  uint32 | intr_num : the interrupt source sequence number 0-7.
  GPIO_INT_TYPE | intr_type : The type of interrupt.

Returns
  null

void gpio_intr_handler_register | ( | void * | fn,
|  | void * | arg
| ) |  |

Register an application-specific interrupt handler for GPIO pin interrupts.

Parameters

  void | *fn : interrupt handler for GPIO pin interrupts.
  void | *arg : interrupt handler's arg

Returns
  null

void gpio_intr_process | ( | void |  | ) |

The GPIO interrupt function.

Parameters

  null |

Returns
  null

void gpio_matrix_in | ( | uint32 | gpio,
|  | uint32 | signal_idx
| ) |  |

To bind GPIO input and a certain road input signal.

Parameters

  uint32 | gpio_num : The GPIO sequence number.
  uint32 | signal_idx : input signal sequence number.

Returns
  null

void gpio_matrix_out | ( | uint32 | gpio,
|  | uint32 | signal_idx
| ) |  |

To bind GPIO ouput and a certain road output signal.

Parameters

  uint32 | gpio_num : The GPIO sequence number.
  uint32 | signal_idx : out signal sequence number.

Returns
  null

void gpio_output_conf | ( | uint32 | set_mask,
|  | uint32 | clear_mask,
|  | uint32 | enable_mask,
|  | uint32 | disable_mask
| ) |  |

Configure GPIO pins out or input.

Parameters

  uint32 | set_mask : Set the output for the high bit, the corresponding bit is 1, the output of high, the corresponding bit is 0, do not change the state.
  uint32 | set_mask : Set the output for the high bit, the corresponding bit is 1, the output of low, the corresponding bit is 0, do not change the state.
  uint32 | enable_mask : Enable Output
  uint32 | disable_mask : Enable Input

Returns
  null

void gpio_output_conf_high | ( | uint32 | set_mask,
|  | uint32 | clear_mask,
|  | uint32 | enable_mask,
|  | uint32 | disable_mask
| ) |  |

Configure GPIO pins out or input.

Parameters

  uint32 | set_mask : Set the output for the high bit, the corresponding bit is 1, the output of high, the corresponding bit is 0, do not change the state.
  uint32 | set_mask : Set the output for the high bit, the corresponding bit is 1, the output of low, the corresponding bit is 0, do not change the state.
  uint32 | enable_mask : Enable Output
  uint32 | disable_mask : Enable Input

Returns
  null

void gpio_output_sigmadelta_disable | ( | void |  | ) |

Disable GPIO sigmadelta function.

Parameters

  null |

Returns
  null

void gpio_output_sigmadelta_enable | ( | uint32 | gpio_num,
|  | uint32 | sigma_num,
|  | uint32 | prescale
| ) |  |

Enable GPIO sigmadelta function.

Parameters

  uint32 | gpio_num : The GPIO sequence number.
  uint32 | sigma_num : the sigmadelta source sequence number 0-7.
  uint32 | prescale : Clock divide factor.

Returns
  null

void gpio_pin_intr_state_set | ( | uint32 | i,
|  | GPIO_INT_TYPE | intr_state
| ) |  |

Config interrupt types of GPIO pin.

Parameters

  uint32 | i : The GPIO sequence number.
  GPIO_INT_TYPE | intr_state : GPIO interrupt types.

Returns
  null

void gpio_pin_wakeup_disable | ( | void |  | ) |

Disable GPIO wake up to light sleep.

Parameters

  null |

Returns
  null

void gpio_pin_wakeup_enable | ( | uint32 | i,
|  | GPIO_INT_TYPE | intr_state
| ) |  |

Configure GPIO wake up to light sleep,Only level way is effective.

Parameters

  uint32 | i : GPIO sequence number
  GPIO_INT_TYPE | intr_state : the level of wake up to light sleep

Returns
  null

void intr_matrix_set | ( | uint32 | model_num,
|  | uint32 | intr_num
| ) |  |

To bind mode interrupt and interrupt sequence number.

Parameters

  uint32 | model_num : The mode sequence number.
  uint32 | intr_num : interrupt sequence number.

Returns
  null