JetBox-FloydSC User Manual rev 0.1
Page 24
. Digital I/O Control Software Commands
There are 4 commands to use the DIOs. They are as follows:
1. gpio_util setdir
This command configures the direction of a particular DIO. For example, to set DIO 3 as an input & DIO 4 as an
output, follow the command as provided below:
gpio_util setdir 3 in;
// sets DIO 3 as an input
gpio_util setdir 4 out;
// sets DIO 4 as an output
2. gpio_util getdir
This command reads the direction of a particular DIO. For example, to read the direction of DIO 2 (earlier set as
an input) & DIO 5 (earlier set as an output), use the command as follows:
gpio_util getdir 2
;
//read direction of GPIO port 2
in
// Prints out GPIO port 2 direction
gpio_util getdir 5;
//read direction of GPIO port 5
out
// Prints out GPIO port 2 direction
3. gpio_util setval
This command configures the logic driven to an output. For example, to drive a logic 0 to DIO 2 & a logic 1 to DIO
5, use the command as follows:
gpio_util setval 2 0;
// drives DIO 2 as logic 0
gpio_util setval 5 1
;
// drives DIO 5 as logic 1
4. gpio_util getval
This command reads the logic at an input pin. For example, to read the logic value at DIO 6, use the command as
follows:
gpio_util getval 6
// reads the logic of DIO 6
0
// prints the logic level of DIO
Total number of allowed GPIO numbers are 1-8.