5.d. 0x83 & 0x84: Get & Set Configuration Parameter
Command 0x83 (131): Get Configuration Parameter
Compact protocol: 0x83, parameter number
Pololu protocol: 0xAA, device ID, 0x03, parameter number
This command lets you request the current value of any of the twelve configuration parameters detailed in Section 5.a. This command prompts the qik to transmit a single byte that represents the requested parameter value. If you request an invalid parameter (i.e. if parameter number ≥ 12), the value transmitted by the qik (typically 0xFF) has no meaning and a format error is generated.
Command 0x84 (132): Set Configuration Parameter
Compact protocol: 0x84, parameter number, parameter value, 0x55, 0x2A
Pololu protocol: 0xAA, device ID, 0x04, parameter number, parameter value, 0x55, 0x2A
This command lets you set the value of any of the twelve configuration parameters detailed in Section 5.a. The final two bytes of the command packet—0x55 (85) and 0x2A (42)—are format bytes that make it more difficult for this command to be accidentally sent, as might result from a noisy serial connection or buggy user code. If either of the format bytes differs from the expected value, the command is ignored and a format error is generated.
It takes the qik approximately 4 ms to finish processing this command, at which point the qik transmits a single return byte that contains information about whether the process was successful. The return byte can have the following values:
- 0: Command OK (success)
- 1: Bad Parameter (failure due to invalid parameter number)
- 2: Bad value (failure due to invalid parameter value for the specified parameter number)
Failure results in a format error.
Once you have set the value of a configuration parameter, that value is saved in non-volatile memory, so it will persist even if the qik is subsequently turned off or reset. Please note that the memory used to store these parameters is only rated for approximately 100,000 erase/write cycles, so you should avoid putting this command within loops that are executed many times a second; it is intended that the configuration parameters will initially be set as desired and then only changed occasionally.