HydraFW binary PIN mode guide - hydrabus/hydrafw GitHub Wiki
HydraFW binary PIN mode guide
This guide is updated towards firmware release HydraFW v0.9 Beta and later
This mode allows to freely control the HydraBus pins PA0 to PA7 (also called GPIO).
Commands
Once the PIN mode has been selected, the following commands are available :
0b00000000
Return to main mode. ReturnsBBIO1
0b00000001
Mode identification. ReturnsPIN1
0b00000010
Read all pin0b00000011
Set pin mode on selected pins0b00000100
Disable pull on selected pins0b00000101
Set pull-up on selected pins0b00000110
Set pull-down on selected pins0b00001000
Set pin state on selected pins
Command details
0b00000010
)
Read all pin (Once the command has been issued, Hydrabus will send a status byte (0x01
if success, 0x00
otherwise) and the corresponding status of each pin. LSB is always pin PA0.
0b00000011
)
Set pin mode on selected pins (This command must be followed by 1 byte, representing the mode for each pin. (LSB is PA0).
The mode is either 0
for output or 1
for input.
For instance, the command 0x00000011 0b00001111
sets the pins PA0 to PA3 in input mode, and pins PA4 to PA7 to output mode.
This command returns 0x01
if successful, 0x00
in case of error.
Pull-up/down commands
All these commands allow to set the pull-up/down on each pins individually. If multiple commands are issued on the same pin, only the last one will be used.
0b00000100
)
Disable pull on selected pins (This command must be followed by 1 byte, representing the status for each pin. (LSB is PA0).
Set the corresponding bit to 1
to disable the pull resistor (MCU internal pull up/down resistors) on the pin.
This command returns 0x01
if successful, 0x00
in case of error.
0b00000101
)
Set pull-up on selected pins (This command must be followed by 1 byte, representing the status for each pin. (LSB is PA0).
Set the corresponding bit to 1
to enable the MCU internal pull-up resistor on the pin.
This command returns 0x01
if successful, 0x00
in case of error.
0b00000110
)
Set pull-down on selected pins (This command must be followed by 1 byte, representing the status for each pin. (LSB is PA0).
Set the corresponding bit to 1
to enable the MCU internal pull-down on the pin.
This command returns 0x01
if successful, 0x00
in case of error.
0b00001000
)
Set pin state on selected pins (This command must be followed by 1 byte, representing the mode for each pin. (LSB is PA0). The corresponding bit value will be written on the pin for each output pin. Obviously, setting any value on an input port will have no effect.
This command returns 0x01
if successful, 0x00
in case of error.