Class QuattrocentoProtocol
Builds and validates the 40-byte configuration command for the Quattrocento amplifier, including CRC-8 calculation.
Inherited Members
Namespace: MOSAIC.Components.Devices.Quattrocento
Assembly: MOSAIC.dll
Syntax
public static class QuattrocentoProtocol
Remarks
The command layout (per OT Bioelettronica Configuration Protocol v1.7):
| Byte(s) | Content |
|---|---|
| 0 | ACQ_SETT: [1|DECIM|REC_ON|FSAMP1|FSAMP0|NCH1|NCH0|ACQ_ON] |
| 1 | AN_OUT_IN_SEL (analog output source + gain) |
| 2 | AN_OUT_CH_SEL (analog output channel) |
| 3–38 | 12 × 3 bytes: per-input CONF0/1/2 |
| 39 | CRC-8 |
Methods
BuildCommand(bool, bool, bool, int, int, InputConfig[]?, int, int, int)
Builds the complete 40-byte configuration command.
Declaration
public static byte[] BuildCommand(bool acqOn, bool recOn, bool decimator = true, int fsamp = 3, int nch = 3, InputConfig[]? inputConfigs = null, int anOutSource = 0, int anOutChannel = 0, int anOutGain = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | acqOn | |
| bool | recOn | Set the REC_ON trigger bit for external synchronisation. |
| bool | decimator | Enable the decimator for stable sampling. |
| int | fsamp | Sampling frequency selector (0–3). |
| int | nch | Channel count selector (0–3). |
| InputConfig[] | inputConfigs | Per-input configurations (12 entries for IN1–IN8 + MULT1–MULT4). If null, all inputs use Default. |
| int | anOutSource | Analog output source input (0–12). Default 0 (disabled). |
| int | anOutChannel | Analog output channel within the source (0–63). Default 0. |
| int | anOutGain | Analog output gain code (0=×1, 1=×2, 2=×4, 3=×16). Default 0. |
Returns
| Type | Description |
|---|---|
| byte[] | 40-byte command array with CRC-8 in byte 39. |
ComputeCrc8(byte[], int)
CRC-8 calculation matching the Quattrocento firmware. Uses reflected polynomial 0x8C (CRC-8/MAXIM variant).
Declaration
public static byte ComputeCrc8(byte[] data, int length)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | data | Input byte array. |
| int | length | Number of bytes to include in the calculation. |
Returns
| Type | Description |
|---|---|
| byte | The computed CRC-8 check byte. |