The RIU-9000 is a versatile Remote Interface Unit (RIU) designed for spacecraft sensor management. This device interfaces with an Adafruit BMP280 sensor to provide accurate pressure and temperature readings. The RIU-9000 allows users to configure sensor parameters and retrieve sensor data through a structured 4-step communication protocol.
### Features
- **Sensor Support**: Integrated support for BMP280 pressure and temperature sensor.
- **Configurable Parameters**: Offset and sampling rate adjustments for both pressure and temperature readings.
- **Reliable Communication**: 4-step communication protocol to ensure data integrity.
- **Error Handling**: Error messages for invalid commands or parameters.
- **Industry Standard Data Format**: Sensor data is sent in binary format representing 32 bit IEEE-754 Floating Point values.
Commands should be sent as strings over the serial interface at 115200 baud rate. Commands are case-sensitive and must be followed by a newline character (`\n`). Parameters and values should be separated by a space. Responses from the RIU-9000 will also be in string format.
- **Description**: Initializes the device. This command must be sent before any other commands are accepted.
#### GET_SENSOR
- **Command**: `GET_SENSOR [COMMAND] [SENSOR]`
- **Description**: Initiates a 4-step communication process to read sensor data.
- **Steps**:
1.**REQUEST**: Command the device to read sensor value.
- **Command**: `GET_SENSOR REQUEST [SENSOR]`
- **Response**: `OK` or `ERROR`
2.**CONFIRM**: Ask if the device requested the data from the sensor.
- **Command**: `GET_SENSOR CONFIRM [SENSOR]`
- **Response**: `TRUE` or `FALSE`
3.**CHECK**: Ask if the data is present now.
- **Command**: `GET_SENSOR CHECK [SENSOR]`
- **Response**: `TRUE` or `FALSE`
4.**SEND**: Command the device to send the data to the user.
- **Command**: `GET_SENSOR SEND [SENSOR]`
- **Response**: `[DATA]` or `FALSE`
5.**CANCEL**: Cancel the sensor reading request.
- **Command**: `GET_SENSOR CANCEL [SENSOR]`
- **Response**: `OK`
#### SET_PARAMETER
- **Command**: `SET_PARAMETER [PARAM] [VALUE]`
- **Response**: `OK` or `ERROR: UNKNOWN PARAMETER`
- **Parameters**:
-`PRESSURE_OFFSET`: Sets the offset for pressure readings. (In hPa)
-`TEMPERATURE_OFFSET`: Sets the offset for temperature readings. (In °C)
-`PRESSURE_SAMPLING`: Sets the oversampling rate for the pressure sensor (`SAMPLING_NONE`, `SAMPLING_X1`, `SAMPLING_X2`, `SAMPLING_X4`, `SAMPLING_X8`, `SAMPLING_X16`).
-`TEMPERATURE_SAMPLING`: Sets the oversampling rate for the temperature sensor (`SAMPLING_NONE`, `SAMPLING_X1`, `SAMPLING_X2`, `SAMPLING_X4`, `SAMPLING_X8`, `SAMPLING_X16`).
#### GET_PARAMETER
- **Command**: `GET_PARAMETER [PARAM]`
- **Response**: `[VALUE]` or `ERROR: UNKNOWN PARAMETER`
- **Parameters**:
-`PRESSURE_OFFSET`: Retrieves the current pressure offset.
-`TEMPERATURE_OFFSET`: Retrieves the current temperature offset.
-`PRESSURE_SAMPLING`: Retrieves the current pressure oversampling rate.
-`TEMPERATURE_SAMPLING`: Retrieves the current temperature oversampling rate.
#### RESET_SENSORS
- **Command**: `RESET_SENSORS`
- **Response**: `OK`
- **Description**: Resets the request count and communication state.
#### Communication Errors
- **BUSY**: Device is busy. Every 20th request, the device will respond with `BUSY` and not process the command.
- **ERROR**: Generic error message for invalid commands or failed operations.
- **FALSE**: Response for confirmation checks that fail.
- **[NO RESPONSE]**: After 100 requests, the device will stop responding to commands until a `RESET_SENSORS` command is issued.