DESK-MP1-L/Peripherals/GPIOs

From DAVE Developer's Wiki
< DESK-MP1-L
Revision as of 14:30, 28 July 2023 by U0031 (talk | contribs) (Created page with "==Peripheral GPIOs == ETRA can handle external pins in many different ways and most of them can be configured as GPIOs. When a pin is set as a GPIO, it is possible to read it...")

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Peripheral GPIOs[edit | edit source]

ETRA can handle external pins in many different ways and most of them can be configured as GPIOs. When a pin is set as a GPIO, it is possible to read its value, change its direction or change output value directly from the shell.

Accessing the peripheral[edit | edit source]

Usage with i2c command[edit | edit source]

Set all GPIO on output mode, all pin low

root@desk-mp1:~# i2cset -y 1 0x34 0x30 0xff
root@desk-mp1:~# i2cset -y 1 0x34 0x31 0xff
root@desk-mp1:~# i2cset -y 1 0x34 0x32 0x07

set all pin to high, one by one

root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0x01
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0x02
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0x04
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0x08
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0x10
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0x20
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0x40
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0x80
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0x01
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0x02
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0x04
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0x08
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0x10
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0x20
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0x40
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0x80
root@desk-mp1:~# i2cset -y 1 0x34 0x2c 0x01
root@desk-mp1:~# i2cset -y 1 0x34 0x2c 0x02
root@desk-mp1:~# i2cset -y 1 0x34 0x2c 0x04

set all pin to high and set all to low one by one

root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0xff
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0xff
root@desk-mp1:~# i2cset -y 1 0x34 0x2c 0x07

root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0xfe
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0xfd
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0xfb
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0xf7
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0xef
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0xdf
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0xbf
root@desk-mp1:~# i2cset -y 1 0x34 0x2a 0x7f
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0xfe
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0xfd
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0xfb
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0xf7
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0xef
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0xdf
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0xbf
root@desk-mp1:~# i2cset -y 1 0x34 0x2b 0x7f
root@desk-mp1:~# i2cset -y 1 0x34 0x2c 0x06
root@desk-mp1:~# i2cset -y 1 0x34 0x2c 0x05
root@desk-mp1:~# i2cset -y 1 0x34 0x2c 0x03

set gpio input mode, disable debounce

root@desk-mp1:~# i2cset -y 1 0x34 0x30 0x00
root@desk-mp1:~# i2cset -y 1 0x34 0x31 0x00
root@desk-mp1:~# i2cset -y 1 0x34 0x32 0x00

root@desk-mp1:~# i2cset -y 1 0x34 0x27 0xff
root@desk-mp1:~# i2cset -y 1 0x34 0x28 0xff
root@desk-mp1:~# i2cset -y 1 0x34 0x29 0x07

Read input value

root@desk-mp1:~# i2cget -y 1 0x34 0x16
root@desk-mp1:~# i2cget -y 1 0x34 0x17
root@desk-mp1:~# i2cget -y 1 0x34 0x18