public class TiGPIO extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
EVT_BOTHEDGE
Both edge event
|
static int |
EVT_FALLINGEDGE
Falling edge event
|
static int |
EVT_NONE
None event
|
static int |
EVT_RISINGEDGE
Rising edge event
|
static int |
INPUT_FLOATING
Floating input
|
static int |
INPUT_PULLDOWN
Pull-down input
|
static int |
INPUT_PULLUP
Pull-up input
|
static int |
IO_FLOATING_OD
Floating input and open drain output
|
static int |
OUTPUT_OD
Open drain output
|
static int |
OUTPUT_PP
Push-pull output
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the port of current object
|
int |
getPort()
Gets the port id of current object
|
static TiGPIO |
open(int portID,
int... pinIDs)
Open the TiGPIO port by port id and the pin list, and return the object
|
static int |
portNumber()
Maximum number of port supported
|
int |
readPin(int pinID)
Read the pin level value
|
int |
readPort()
Read the port value
|
void |
setEventParameters(int pinID,
int evt,
int captureFilter)
Set the pin event parameters
|
void |
setWorkMode(int pinID,
int mode)
Set the pin work mode
|
void |
writePin(int pinID,
int levelValue)
Write the pin level value
|
void |
writePort(int value)
Write the port value
|
public static final int EVT_BOTHEDGE
public static final int EVT_FALLINGEDGE
public static final int EVT_NONE
public static final int EVT_RISINGEDGE
public static final int INPUT_FLOATING
public static final int INPUT_PULLDOWN
public static final int INPUT_PULLUP
public static final int IO_FLOATING_OD
public static final int OUTPUT_OD
public static final int OUTPUT_PP
public void close()
throws IOException
IOException - If a TiGPIO error occurspublic int getPort()
public static TiGPIO open(int portID, int... pinIDs) throws IOException
portID - port idpinIDs - the pin id use, range:0-15IOException - If a TiGPIO error occurspublic static int portNumber()
public int readPin(int pinID)
throws IOException
pinID - the pin id, range:0-15IOException - If a TiGPIO error occurspublic int readPort()
throws IOException
IOException - If a TiGPIO error occurspublic void setEventParameters(int pinID,
int evt,
int captureFilter)
throws IOException
pinID - pin id, range:0-15evt - pin event, captureFilter - the event capture filter time window, unit:usIOException - If a TiGPIO error occurspublic void setWorkMode(int pinID,
int mode)
throws IOException
pinID - pin id, range:0-15mode - pin mode, IOException - If a TiGPIO error occurspublic void writePin(int pinID,
int levelValue)
throws IOException
pinID - the pin id, range:0-15levelValue - pin level value, 0:low level, 1:high levelIOException - If a TiGPIO error occurspublic void writePort(int value)
throws IOException
value - port value, For example: if pinIDs = {0,3,5}, it means pin0, pin3,
pin5 are enabledIOException - If a TiGPIO error occurs