ESP8266_RTOS_SDK  v1.4.0
Macros | Functions
GPIO Driver APIs

GPIO APIs. More...

Macros

#define GPIO_OUTPUT_SET(gpio_no, bit_value)   gpio_output_conf(bit_value<<gpio_no, ((~bit_value)&0x01)<<gpio_no, 1<<gpio_no, 0)
 Set GPIO pin output level. More...
 
#define GPIO_OUTPUT(gpio_bits, bit_value)
 Set GPIO pin output level. More...
 
#define GPIO_DIS_OUTPUT(gpio_no)    gpio_output_conf(0, 0, 0, 1<<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. More...
 
#define GPIO_AS_OUTPUT(gpio_bits)    gpio_output_conf(0, 0, gpio_bits, 0)
 Enable GPIO pin output. More...
 
#define GPIO_INPUT_GET(gpio_no)    ((gpio_input_get()>>gpio_no)&BIT0)
 Sample the level of GPIO input. More...
 

Functions

void gpio16_output_conf (void)
 Enable GPIO16 output. More...
 
void gpio16_output_set (uint8 value)
 Set GPIO16 output level. More...
 
void gpio16_input_conf (void)
 Enable GPIO pin intput. More...
 
uint8 gpio16_input_get (void)
 Sample the value of GPIO16 input. 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_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 ()
 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. 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.

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.

Parameters
gpio_bits: The GPIO bit number.
Returns
null
#define GPIO_DIS_OUTPUT (   gpio_no)    gpio_output_conf(0, 0, 0, 1<<gpio_no)

Disable GPIO pin output.

Parameters
gpio_no: The GPIO sequence number.
Returns
null
#define GPIO_INPUT_GET (   gpio_no)    ((gpio_input_get()>>gpio_no)&BIT0)

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)
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_bits: The GPIO bit number.
bit_value: GPIO pin output level.
Returns
null
#define GPIO_OUTPUT_SET (   gpio_no,
  bit_value 
)    gpio_output_conf(bit_value<<gpio_no, ((~bit_value)&0x01)<<gpio_no, 1<<gpio_no, 0)

Set GPIO pin output level.

Parameters
gpio_no: The GPIO sequence number.
bit_value: GPIO pin output level.
Returns
null

Function Documentation

void gpio16_input_conf ( void  )

Enable GPIO pin intput.

Parameters
null
Returns
null
uint8 gpio16_input_get ( void  )

Sample the value of GPIO16 input.

Parameters
null
Returns
the level of GPIO16 input.
void gpio16_output_conf ( void  )

Enable GPIO16 output.

Parameters
null
Returns
null
void gpio16_output_set ( uint8  value)

Set GPIO16 output level.

Parameters
uint8value : GPIO16 output level.
Returns
null
uint32 gpio_input_get ( void  )

Sample the value of GPIO input pins and returns a bitmask.

Parameters
null
Returns
bitmask of GPIO pins input
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_output_conf ( uint32  set_mask,
uint32  clear_mask,
uint32  enable_mask,
uint32  disable_mask 
)

Configure Gpio pins out or input.

Parameters
uint32set_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.
uint32set_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.
uint32enable_mask : Enable Output
uint32disable_mask : Enable Input
Returns
null
void gpio_pin_intr_state_set ( uint32  i,
GPIO_INT_TYPE  intr_state 
)

Config interrupt types of GPIO pin.

Parameters
uint32i : The GPIO sequence number.
GPIO_INT_TYPEintr_state : GPIO interrupt types.
Returns
null
void gpio_pin_wakeup_disable ( )

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
uint32i : Gpio sequence number
GPIO_INT_TYPEintr_state : the level of wake up to light sleep
Returns
null