Treehopper Java API
|
A GPIO/Analog pin on the board. More...
Public Member Functions | |
int | getPinNumber () |
Gets the pin number of this pin. More... | |
Spi | getSpiModule () |
Gets the SPI module that can use this pin as an SpiChipSelectPin. More... | |
TreehopperUsb | getBoard () |
Get the board this pin belongs to. More... | |
PinMode | getMode () |
Get the current PinMode of the pin. More... | |
void | setMode (PinMode value) |
Set this pin's mode. More... | |
void | addDigitalInValueChangedEventHandler (DigitalInValueChangedEventHandler handler) |
Add a DigitalInValueCHangedEventHandler. More... | |
void | removeDigitalInValueChangedEventHandler (DigitalInValueChangedEventHandler handler) |
Remove a DigitalInValueCHangedEventHandler. More... | |
boolean | getDigitalValue () |
Gets the current digital value of the pin. More... | |
void | setDigitalValue (boolean value) |
Sets the digital value of this pin. More... | |
void | toggleOutput () |
Toggles the output of the pin. More... | |
void | makeDigitalPushPullOutput () |
Make this pin a digital push-pull output. More... | |
void | makeDigitalIn () |
Make this pin a digital input. More... | |
void | addAdcValueChangedEventHandler (AdcValueChangedEventHandler handler) |
Add an AdcValueChangedEventHandler. More... | |
void | removeAdcValueChangedEventHandler (AdcValueChangedEventHandler handler) |
Remove an AdcValueChangedEventHandler. More... | |
void | addAnalogValueChangedEventHandler (AnalogValueChangedEventHandler handler) |
Add an AnalogValueChangedEventHandler. More... | |
void | removeAnalogValueChangedEventHandler (AnalogValueChangedEventHandler handler) |
Remove an AnalogValueChangedEventHandler. More... | |
void | addAnalogVoltageChangedEventHandler (AnalogVoltageChangedEventHandler handler) |
Add an AnalogVoltageChangedEventHandler. More... | |
void | removeAnalogVoltageChangedEventHandler (AnalogVoltageChangedEventHandler handler) |
Remove an AnalogVoltageChangedEventHandler. More... | |
int | getAdcValueChangedThreshold () |
Gets the threshold the ADC value must change by for the event to fire. More... | |
void | setAdcValueChangedThreshold (int adcValueChangedThreshold) |
Sets the threshold the ADC value must change by for the event to fire. More... | |
double | getAnalogValueChangedThreshold () |
Gets the threshold the analog value must change by for the event to fire. More... | |
void | setAnalogValueChangedThreshold (double analogValueChangedThreshold) |
Sets the threshold the ADC value must change by for the event to fire. More... | |
double | getAnalogVoltageChangedThreshold () |
Gets the threshold the analog voltage must change by for the event to fire. More... | |
void | setAnalogVoltageChangedThreshold (double analogVoltageChangedThreshold) |
Sets the threshold the analog voltage must change by for the event to fire. More... | |
int | getAdcValue () |
Get the ADC value, 0-4091, of the pin. More... | |
double | getAnalogVoltage () |
Gets the analog voltage (0-3.3) of this pin. More... | |
double | getAnalogValue () |
Gets the analog value (from 0-1) of this pin. More... | |
AdcReferenceLevel | getReferenceLevel () |
Gets the AdcReferenceLevel of this pin. More... | |
void | setReferenceLevel (AdcReferenceLevel referenceLevel) |
Set the AdcReferenceLevel of this pin. More... | |
Public Attributes | |
final SoftPwm | softPwm |
A GPIO/Analog pin on the board.
void io.treehopper.Pin.addAdcValueChangedEventHandler | ( | AdcValueChangedEventHandler | handler | ) |
Add an AdcValueChangedEventHandler.
handler | the AdcValueChangedEventHandler to add |
void io.treehopper.Pin.addAnalogValueChangedEventHandler | ( | AnalogValueChangedEventHandler | handler | ) |
Add an AnalogValueChangedEventHandler.
handler | the AnalogValueChangedEventHandler to add |
void io.treehopper.Pin.addAnalogVoltageChangedEventHandler | ( | AnalogVoltageChangedEventHandler | handler | ) |
Add an AnalogVoltageChangedEventHandler.
handler | the AnalogVoltageChangedEventHandler to add |
void io.treehopper.Pin.addDigitalInValueChangedEventHandler | ( | DigitalInValueChangedEventHandler | handler | ) |
Add a DigitalInValueCHangedEventHandler.
handler | the handler to add |
Implements io.treehopper.interfaces.DigitalIn.
int io.treehopper.Pin.getAdcValue | ( | ) |
Get the ADC value, 0-4091, of the pin.
int io.treehopper.Pin.getAdcValueChangedThreshold | ( | ) |
Gets the threshold the ADC value must change by for the event to fire.
double io.treehopper.Pin.getAnalogValue | ( | ) |
Gets the analog value (from 0-1) of this pin.
double io.treehopper.Pin.getAnalogValueChangedThreshold | ( | ) |
Gets the threshold the analog value must change by for the event to fire.
double io.treehopper.Pin.getAnalogVoltage | ( | ) |
Gets the analog voltage (0-3.3) of this pin.
double io.treehopper.Pin.getAnalogVoltageChangedThreshold | ( | ) |
Gets the threshold the analog voltage must change by for the event to fire.
TreehopperUsb io.treehopper.Pin.getBoard | ( | ) |
Get the board this pin belongs to.
boolean io.treehopper.Pin.getDigitalValue | ( | ) |
Gets the current digital value of the pin.
If the pin is an input, this function returns the last-read value of the pin. If the pin is an output, this function returns the value this pin is currently outputting.
Implements io.treehopper.interfaces.DigitalBase.
PinMode io.treehopper.Pin.getMode | ( | ) |
Get the current PinMode of the pin.
int io.treehopper.Pin.getPinNumber | ( | ) |
Gets the pin number of this pin.
Implements io.treehopper.interfaces.SpiChipSelectPin.
AdcReferenceLevel io.treehopper.Pin.getReferenceLevel | ( | ) |
Gets the AdcReferenceLevel of this pin.
Spi io.treehopper.Pin.getSpiModule | ( | ) |
Gets the SPI module that can use this pin as an SpiChipSelectPin.
Implements io.treehopper.interfaces.SpiChipSelectPin.
void io.treehopper.Pin.makeDigitalIn | ( | ) |
Make this pin a digital input.
Implements io.treehopper.interfaces.DigitalIn.
void io.treehopper.Pin.makeDigitalPushPullOutput | ( | ) |
Make this pin a digital push-pull output.
Implements io.treehopper.interfaces.DigitalOut.
void io.treehopper.Pin.removeAdcValueChangedEventHandler | ( | AdcValueChangedEventHandler | handler | ) |
Remove an AdcValueChangedEventHandler.
handler | the AdcValueChangedEventHandler to remove |
void io.treehopper.Pin.removeAnalogValueChangedEventHandler | ( | AnalogValueChangedEventHandler | handler | ) |
Remove an AnalogValueChangedEventHandler.
handler | the AnalogValueChangedEventHandler to remove |
void io.treehopper.Pin.removeAnalogVoltageChangedEventHandler | ( | AnalogVoltageChangedEventHandler | handler | ) |
Remove an AnalogVoltageChangedEventHandler.
handler | the AnalogVoltageChangedEventHandler to remove |
void io.treehopper.Pin.removeDigitalInValueChangedEventHandler | ( | DigitalInValueChangedEventHandler | handler | ) |
Remove a DigitalInValueCHangedEventHandler.
handler | the handler to remove |
Implements io.treehopper.interfaces.DigitalIn.
void io.treehopper.Pin.setAdcValueChangedThreshold | ( | int | adcValueChangedThreshold | ) |
Sets the threshold the ADC value must change by for the event to fire.
adcValueChangedThreshold | the ADC threshold value |
void io.treehopper.Pin.setAnalogValueChangedThreshold | ( | double | analogValueChangedThreshold | ) |
Sets the threshold the ADC value must change by for the event to fire.
analogValueChangedThreshold | the ADC threshold value |
void io.treehopper.Pin.setAnalogVoltageChangedThreshold | ( | double | analogVoltageChangedThreshold | ) |
Sets the threshold the analog voltage must change by for the event to fire.
analogVoltageChangedThreshold | the analog voltage threshold value |
void io.treehopper.Pin.setDigitalValue | ( | boolean | value | ) |
Sets the digital value of this pin.
value | the digital value |
Implements io.treehopper.interfaces.DigitalOut.
void io.treehopper.Pin.setMode | ( | PinMode | value | ) |
Set this pin's mode.
value | the mode of the pin |
void io.treehopper.Pin.setReferenceLevel | ( | AdcReferenceLevel | referenceLevel | ) |
Set the AdcReferenceLevel of this pin.
referenceLevel | the ADC reference level to use |
void io.treehopper.Pin.toggleOutput | ( | ) |
Toggles the output of the pin.
Just like setDigitalValue(), this function will turn the pin into a push-pull output if it is not already a push-pull or open-drain output.
Implements io.treehopper.interfaces.DigitalOut.
final SoftPwm io.treehopper.Pin.softPwm |