...
Code Block |
---|
echo 482 > /sys/class/gpio/export echo out > /sys/class/gpio/P45_2/direction echo 1 > /sys/class/gpio/P45_2/value |
The GPIO number can be calculated using the function bellow:
XX = linux gpio number = <GPIO_controll_base> + <GPIO_Bank> * 8 + <GPIO_Bit>
→ XX = 120 <GPIO_Bank> * 8 + <gpio_bit>
Example: to calculate the GPIO number of mikroBus J8 [pin 2] (RST)
Pad Name: P45_2 → {GPIO_Bank= 45; GPIO_Bit = 2}
XX = 120 + ( 45) * 8 + 2 = 120 + 362 = 482
UART
UART is available in Linux as a standard serial device /dev/ttySC1.
...