Package org.deepjava.flink.subdevices
Class FlinkGPIO
- java.lang.Object
-
- org.deepjava.flink.subdevices.FlinkGPIO
-
- All Implemented Interfaces:
FlinkDefinitions
public class FlinkGPIO extends Object implements FlinkDefinitions
The flink GPIO subdevice realizes digital input and output within a flink device. It offers several channels. Each channel drives a single pin.- Author:
- Urs Graf
-
-
Field Summary
Fields Modifier and Type Field Description FlinkSubDevice
dev
Handle to the subdevice within our flink device-
Fields inherited from interface org.deepjava.flink.core.FlinkDefinitions
ANALOG_INPUT_INTERFACE_ID, ANALOG_OUTPUT_INTERFACE_ID, CHANNEL_OFFSET, COUNTER_INTERFACE_ID, GPIO_INTERFACE_ID, HEADER_SIZE, INFO_DEVICE_ID, INFO_DEVICE_SIZE, INTERFACE_TYPE_MASK, MOD_CONF_OFFSET, MOD_STATUS_OFFSET, PPWA_INTERFACE_ID, PWM_INTERFACE_ID, REGISTER_WIDTH, REGISTER_WIDTH_BIT, SIZE_OFFSET, SUBHEADER_SIZE, TOTAL_HEADER_SIZE, TYPE_OFFSET, UART_INTERFACE_ID, UNIQUE_ID_OFFSET, WD_INTERFACE_ID
-
-
Constructor Summary
Constructors Constructor Description FlinkGPIO(FlinkSubDevice dev)
Creates a GPIO subdevice.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getDir(int channel)
Reads the direction of a single channel within a GPIO subdevice.boolean
getValue(int channel)
Reads the value of a single channel within a GPIO subdevice.void
setDir(int channel, boolean output)
Sets the direction of a single channel within a GPIO subdevice.void
setValue(int channel, boolean value)
Sets the logical level of a single channel within a GPIO subdevice.
-
-
-
Field Detail
-
dev
public FlinkSubDevice dev
Handle to the subdevice within our flink device
-
-
Constructor Detail
-
FlinkGPIO
public FlinkGPIO(FlinkSubDevice dev)
Creates a GPIO subdevice.- Parameters:
dev
- handle to the subdevice
-
-
Method Detail
-
setDir
public void setDir(int channel, boolean output)
Sets the direction of a single channel within a GPIO subdevice. Each channel can work as either digital input or output. Channel number must be 0 <= channel < nof available channels.- Parameters:
channel
- channel numberoutput
- false = input, true = output
-
getDir
public boolean getDir(int channel)
Reads the direction of a single channel within a GPIO subdevice. Each channel can work as either digital input or output. Channel number must be 0 <= channel < nof available channels- Parameters:
channel
- channel number- Returns:
- false = input, true = output
-
getValue
public boolean getValue(int channel)
Reads the value of a single channel within a GPIO subdevice. Channel number must be 0 <= channel < nof available channels- Parameters:
channel
- channel number- Returns:
- false = low, true = high
-
setValue
public void setValue(int channel, boolean value)
Sets the logical level of a single channel within a GPIO subdevice. Channel number must be 0 <= channel < nof available channels- Parameters:
channel
- channel numbervalue
- false = low, true = high
-
-