Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Rockpi4/android-mraa

< Rockpi4
Revision as of 08:16, 19 March 2020 by Ahren (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Rock PI 4 Android Mraa API


Default IO Map



Class

class constructor constructor2 class constructor constructor2
Aio Aio (int pin_index) NA Gpio Gpio(int pin_index) NA
I2c I2c (int i2c_index) NA Pwm Pwm (int pin_index) NA
Spi Spi (int spi_index) NA Uart Uart(int uart_index) NA

Index Class

RockPI4I2C Field Index Value Hardware I2c Number RockPI4SPI Field Index Value Hardware Spi Number
ROCK_PI_4_I2C2 0 i2c2 ROCK_PI_4_SPI1 0 spi1
ROCK_PI_4_I2C6 1 i2c6 ROCK_PI_4_SPI2 1 spi2
ROCK_PI_4_I2C7 2 i2c7
RockPI4Uart Field Index Value Hardware Uart Number
ROCK_PI_4_UART2 0 uart2
ROCK_PI_4_UART4 1 uart4

Gpio

Methods Parameter Description Return
dir(Dir dir) Dir Set input/output Result
readDir() void Read input/output dir Dir
mode(Mode mode) Mode Set STRONG/PULLUP/PULLDOWN/HIZ Result
read() void Set input and read gpio value 0/1
write(int v) 0/1 Set output value Result
unexport() void Unexport gpio in /dev/class/gpio Result

Example

   import mraa.*;
   
   Gpio gpio40 = new Gpio(RockPI4.ROCK_PI_4_PIN40.swigValue());
   // output
   gpio40.dir(Dir.DIR_OUT);
   // set value
   gpio40.write(1);
   // release gpio if you want
   gpio40.unexport();

I2C

Methods Parameter Description Return
dir(Dir dir) Dir Set input/output Result
readDir() void Read input/output dir Dir
mode(Mode mode) Mode Set STRONG/PULLUP/PULLDOWN/HIZ Result
read() void Set input and read gpio value 0/1
write(int v) 0/1 Set output value Result
unexport() void Unexport gpio in /dev/class/gpio Result