maix.peripheral.gpio
maix.peripheral.gpio module
You can use
maix.peripheral.gpio
to access this module with MaixPy
This module is generated from MaixCDK
Module
No module
Enum
Mode
item | doc |
---|---|
brief | GPIO mode |
values | IN: input mode OUT: output mode OUT_OD: output open drain mode MODE_MAX: |
C++ defination code:
enum Mode
{
IN = 0x01, // input mode
OUT = 0x02, // output mode
OUT_OD = 0x03, // output open drain mode
MODE_MAX
}
Pull
item | doc |
---|---|
brief | GPIO pull mode |
values | PULL_NONE: pull none mode PULL_UP: pull up mode PULL_DOWN: pull down mode PULL_MAX: |
C++ defination code:
enum Pull
{
PULL_NONE = 0x00, // pull none mode
PULL_UP = 0x01, // pull up mode
PULL_DOWN = 0x02, // pull down mode
PULL_MAX
}
Variable
Function
Class
GPIO
item | doc |
---|---|
brief | Peripheral gpio class |
C++ defination code:
class GPIO
__init__
def __init__(self, pin: str, mode: Mode = ..., pull: Pull = ...) -> None
item | doc |
---|---|
type | func |
brief | GPIO constructor |
param | pin: direction [in], gpio pin name, string type the same as board's pin name, e.g. "B14" or "GPIOB14", or number string like "10" if board no gpiochipe name. mode: direction [in], gpio mode. gpio.Mode type, default is gpio.Mode.IN (input) mode. pull: direction [in], gpio pull. gpio.Pull type, default is gpio.Pull.PULL_NONE (pull none) mode. For input mode, this will set gpio default status(value), if set to gpio.Pull.PULL_NONE, gpio value will be floating. For output mode, this will set gpio default status(value), if set to gpio.Pull.PULL_UP, gpio value will be 1, else 0. |
throw | err::Exception if open gpio device failed. |
static | False |
C++ defination code:
GPIO(std::string pin, gpio::Mode mode = gpio::Mode::IN, gpio::Pull pull = gpio::Pull::PULL_NONE)
value
def value(self, value: int = -1) -> int
item | doc |
---|---|
type | func |
brief | set and get gpio value |
param | value: direction [in], gpio value. int type. 0, means write gpio to low level 1, means write gpio to high level -1, means read gpio value, not set |
return | int type, return gpio value, can be 0 or 1 |
static | False |
C++ defination code:
int value(int value = -1)
high
def high(self) -> None
item | doc |
---|---|
type | func |
brief | set gpio high (value to 1) |
static | False |
C++ defination code:
void high()
low
def low(self) -> None
item | doc |
---|---|
type | func |
brief | set gpio low (value to 0) |
static | False |
C++ defination code:
void low()
toggle
def toggle(self) -> None
item | doc |
---|---|
type | func |
brief | gpio toggle |
static | False |
C++ defination code:
void toggle()