pin - Pin Naming Map#
Adapted Air601 Air101/Air103 Air105
Note
This page document is automatically generated by this file. If there is any error, please submit issue or help modify pr, thank you!
Example
-- This library is to solve the mapping problem of PIN pin naming in text form and GPIO number.
-- In function implementation, pin.PA01 corresponds to the value 1, representing GPIO 1, which corresponds to the silk screen PA01
-- PA12, GPIO12, set to output, and low.
gpio.setup(12, 0)
gpio.setup(pin.PA12, 0) -- recommend use
gpio.setup(pin.get("PA12"), 0) -- Not recommended, too long^_^
-- Only some BSPs have this library, but the ESP series does not have this library.
-- This library is meaningful on Air101/Air103/Air105, but it is not necessary to use this library. Writing GPIO number directly has the same effect.
-- In ESP32 series, EC618 series (Air780E, etc.), GPIO numbers are given directly, there is no "Pxxx" form, so this library does not exist
pin.get(name)#
Obtain the GPIO number corresponding to the pin, which can be abbreviated as pin.PA01, recommend using the abbreviation
Parameters
Incoming Value Type |
Explanation |
---|---|
name |
The name of the pin, for example PA01, PB12 |
Return Value
return value type |
explanation |
---|---|
int |
The corresponding GPIO number. If it does not exist, return -1 and print a warning message. |
Examples
-- The following three statements are completely equivalent. If you are prompted that the pin library does not exist, or the firmware version is low, please upgrade the underlying firmware, or you do not need this library.
-- PA12, GPIO12, set to output, and low.
gpio.setup(12, 0)
gpio.setup(pin.PA12, 0) -- recommend use
gpio.setup(pin.get("PA12"), 0) -- Not recommended, too long^_^