Cube instruction set

nop

parameters: -

description: Does nothing (might send back some default "hearbeat" data.

status

parameters: -

description: Sends back hardware status.

move_to

parameters: target_pos

description: Moves the sensor head to target pos, expects the data to be in suitable format depending on mode (cartesian, polar, relative etc.).

get_abs_pos

parameters: -

description: Sends back current absolute position in current coordinate format (polar or cartesian).

get_rel_pos

parameters: -

description: Sends back current relative position in current coordinate format (polar or cartesian).

set_zero_pos

parameters: -

description: Sets current position as the relative zero of the coordinate system.

reset_zero_pos

parameters: -

description: Resets the relative zero of the coordinate system to absolute zero.

set_coordinate_mode

parameters: {cartesian, cylindrical, spherical}

description: Sets the coordinate mode to specified.

home

parameters: -

description: Launches the homing procedure and resets the whole machine to absolute zero, including relative zero.

spi_transfer

parameters: chip_select{0 - 3}, mode{0 - 3}, length{0-64}, data

description: Executes SPI transfer with the specified chip select. The transfer is symmetrical - bytes in == bytes out. The max length of the transfer is 64 bytes. Returns the transfer status and received bytes.

i2c_transfer

parameters: rx_length{0-64}, tx_length{0-64}, address, data

description: Executes I2C transfer with the specified rx and tx length, address and sends the specified data. Returns the status of the transfer and received bytes.

set_gpio_mode

parameters: gpio_index{0-15}, {input_output}

description: Sets the GPIO pin to input or output.

set_gpio

parameters: gpio_index{0-15}, bool value

description: Sets the pin output to specified value. Returns error if pin is configured as input.

get_gpio

parameters: gpio_index{0-15}

description: Reads the pin value and sends it back. If the pin is set as a output, it returns the current set value.

set_parameter

parameters: parameter_id, parameter_value

description: Sets the specified parameter. parameter_id is 16bit integer maybe? parameter_value is raw 32bit binary form of the value to be set?

get_parameter

parameters: parameter_id

description: Sets the specified parameter. parameter_id is 16bit integer maybe? Returns the raw binary form of the value of the parameter.