Buffer Commands
All Buffer Commands must be prefaced by BUF[n] , where n is the index of the internal buffer. The Binho Multi-Protocol USB Host Adapter features just one internal buffer, therefore the only valid value for n at this time is n=0.

CLEAR

Clears the contents of the entire 256-byte buffer.
Parameters:
This function takes no parameters.
Response:
This function returns an ACK Response after clearing the buffer.
Example Usage:
1
BUF0 CLEAR
2
-OK
Copied!

ADD

Adds a single byte of data into the buffer and increments the pointer index by +1.
Add value to buffer: BUF[n] ADD [data]
Parameters:
This function takes one parameter, data. This is the 8-bit unsigned integer (byte) value that will be written to the buffer. Values outside of this range will be truncated to 8 bits.
Response:
This function returns an ACK Response after adding the byte the buffer if the command succeeds. If an invalid parameter is provided, the function will return a NAK Response.
Example Usage:
1
BUF0 ADD 0xAA
2
-OK
3
4
BUF0 READ 1
5
-BUF0 0xAA
Copied!

WRITE

Writes n bytes of data into the buffer, up to a maximum of 32 bytes at a time.
Add n bytes into the buffer beginning at startIndex: BUF[n] WRITE [startIndex] [data_0] [data_1] ... [data_n]
Parameters:
startIndex is the 8-bit integer index of the location that the first byte should be written to the buffer.
data_n is the 8-bit integer (byte) that will be written to the buffer. Values outside of this range will be truncated to 8 bits.
Response:
This function returns an ACK Response after writing the data into the buffer if the command succeeds. If an invalid value is provided, the function will return a NAK Response.
Example Usage:
1
BUF0 WRITE 0 10 15 20
2
-OK
3
4
BUF0 READ 4
5
-BUF0 10 15 20 0
Copied!

READ

Reads n bytes of data from the buffer beginning at the start of the buffer, up to a maximum of 256 bytes at a time (the entire buffer).
BUF[n] READ [byteCount]
Parameters:
byteCount is the 8-bit integer number of bytes to read from the buffer. Valid range is from 1 to 256 bytes.
Response:
This function returns a Data Response if the read command was successful. If an invalid value is provided, the function will return a NAK Response.
Example Usage:
1
BUF0 READ 16
2
-BUF0 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Copied!
Last modified 2yr ago
Copy link