Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
GPIO functions

Provides general purpose input and output (GPIO) functions. More...

Functions

void pinMode (uint16_t pin, uint8_t mode)
 Set the mode of a GPIO pin. More...
 
void IRAM_ATTR digitalWrite (uint16_t pin, uint8_t val)
 Set a digital output. More...
 
uint8_t IRAM_ATTR digitalRead (uint16_t pin)
 Get the value of a digital input. More...
 
void IRAM_ATTR pullup (uint16_t pin)
 Enable pull-up on digital input. More...
 
void IRAM_ATTR noPullup (uint16_t pin)
 Disable pull-up on digital input. More...
 
bool IRAM_ATTR isInputPin (uint16_t pin)
 Check if GPIO is an input. More...
 
unsigned long pulseIn (uint16_t pin, uint8_t state, unsigned long timeout=1000000L)
 Measures duration of pulse on GPIO. More...
 

Detailed Description

Provides general purpose input and output (GPIO) functions.

See also
Pulse width modulation output functions

Function Documentation

uint8_t IRAM_ATTR digitalRead ( uint16_t  pin)

Get the value of a digital input.

Parameters
pinGPIO pin to read
Return values
uint8_tValue of GPIO
void IRAM_ATTR digitalWrite ( uint16_t  pin,
uint8_t  val 
)

Set a digital output.

Parameters
pinGPIO pin to set
valValue to set [0 | 1]
bool IRAM_ATTR isInputPin ( uint16_t  pin)

Check if GPIO is an input.

Parameters
pinGPIO to check
Return values
boolTrue if GPIO is an input
void IRAM_ATTR noPullup ( uint16_t  pin)

Disable pull-up on digital input.

Parameters
pinGPIO to disable pull-up resistor
void pinMode ( uint16_t  pin,
uint8_t  mode 
)

Set the mode of a GPIO pin.

Parameters
pinGPIO pin to configure
modeMode of pin [INPUT | INPUT_PULLUP | OUTPUT]
Todo:
ESP8266 supports pull-down on GPIO 0-15
void IRAM_ATTR pullup ( uint16_t  pin)

Enable pull-up on digital input.

Parameters
pinGPIO to enable pull-up resistor
unsigned long pulseIn ( uint16_t  pin,
uint8_t  state,
unsigned long  timeout = 1000000L 
)

Measures duration of pulse on GPIO.

Parameters
pinGPIO to measure
stateState of pulse to measure [HIGH | LOW]
timeoutMaximum duration of pulse
Return values
unsigned longPulse duration in microseconds
Note
Works on pulses from 2-3 microseconds to 3 minutes in length.
Must be called at least a few dozen microseconds before the start of the pulse.