-
-
Notifications
You must be signed in to change notification settings - Fork 24
pin
This class includes support for using K210 gpios
GPIOHS
are used for Pin functions
- Configurable as input or output
- Each IO is an independent interrupt source
- Edge-triggered or level-triggered interrupt support
- Each IO can be assigned to one of the 48 pins on the FPIOA
- Configurable pull-up and pull-down resistors, or high impedance in input mode
Argument | Description |
---|---|
gpio |
gpio number, if invalid or used gpio number is entered, an exception will be raised |
mode |
optional; pin operating mode use one of the constants: IN , OUT default: IN
|
pull |
optional; activate internal pull resistor if pin is configured as input use one of the constants: PULL_UP , PULL_DOWN , PULL_FLOAT default: PULL_FLOAT
|
value |
optional; set the initial value for an output pin; default: do not set |
handler |
optional; Pin irq callback function If set, the pin interrupt will be enabled and the given function will be called on interrupt default: no irq enabled |
trigger |
optional; the pin interrupt mode use on of the constants: IRQ_DISABLE , IRQ_RISING , IRQ_FALLING , IRQ_ANYEDGE default: IRQ_DISABLE Note: Level interrupts are currently not enabled. |
debounce |
optional; debounce time on pin interrupt in micro seconds, 0 for debounce disablevalid range: 100 - 500000 µs default: 0
|
Only gpio
argument is required, all the other are optional and will be set to the default values if not given.
Arguments value
, handler
, trigger
, debounce
must be given as kw arguments (arg=value
)
Change the pin configuration and options after the pin instance object was created.
For arguments description see Create the Pin instance object above.
Deinitialize the Pin object, free all resources..
Get or set the pin value.
If no argument is given, returns the current pin value (level), 0
or 1
It the val
argument is given, set the pin level. val
can be 0
, 1
, False
or True
Note: If the pin is set to output mode (OUT
), the returned value will always be 0
Returns the pin level at the time when the last interrupt occured.
Can be used inside the interrupt handling function.
Enable or disable pin interrupt.
Returns the pin interrupt counters tuple:
(pin, gpio_id, num_interrupts, num_callbacks, num_missed_cb)
It the optional agumetn reset
is True
, resets all interrupt counters.
- Maix-M1 schematic
- Maix-Bit schematic
- Maix-Go schematic
- Kendryte K210 datasheet
- RISC-V ISA Design
- RISC-V ISA Manual
- Forum
- MicroPython documentation
If you find this project useful, you can contribute by making a donation