class spirack.SPI_rack(port=None, baud=None, timeout=None, use_lock=True)
The SPI rack class is used to interface with the SPI rack controller unit. It implements the protocol used to read and write data and set an active module. Use the writeData/readData functions instead of the read/write functions of the serial library.
An instance of SPI rack needs to be passed to every module object. Only one instance per SPI Rack.
Returns the temperature in the C1b module. Reads the temperature from the internal C1b temperature sensor. Does not work for the C1. Accuracy is +- 0.5 degrees in 0-70 degree range.
Returns - temperature in Celsius (float).
Returns battery voltages. Calculates the battery voltages from the ADC channel values. Currently only works for the C1b/C2 combination.
Returns - list of floats:
Returns the firmware version of the C1/C2 as a string in the format: ‘version - compilation date - author’. This has only been added from firmware version v1.5 onwards for the C2 and v1.3 for the C1.
Returns - firmware version (string)
Sends a trigger signal to the backplane on trigger 1 immediately. Only works on the C1b/C2 combination for now.
Sends a trigger signal to the backplane on trigger 1 at the next write_data or read_data call. Timing is assured by the C2 unit. Only works on the C1b/C2 combination for now.
Unlocks SPI communication. After power-up of the Arduino DUE, SPI write communication is blocked as a safety precaution when working with DAC Modules. By preventing SPI write actions to be performed, the current DAC state is preserved and can be read back by the user.
Locks SPI communication. Prevent SPI write actions. See
Set the reference frequency present on the backplane (Hz). The reference frequency is shared between all modules. This info can be used by other modules for calculation, for example the s5i RF generator module needs to know the frequency for external reference use.
write_data(module, chip, SPI_mode, SPI_speed, data)
Write data to selected module/chip combination.
read_data(module, chip, SPI_mode, SPI_speed, data)
Read data from selected module/chip combination
Returns - Bytes received from module/chip (list of integers).
_set_active(module, chip, SPI_mode, SPI_speed)
Set the current module/chip to active on controller unit. By writing ‘c’ and then chip/module combination, this chip will be set active in the SPI rack controller. This means that all the data send after this will go to that chip. This method is for internal use only!
Reads the ADC for battery voltage: it reads the given ADC channel. These channels are connected to the raw power supply of the battery. Output needs to calculated due to voltage divider. This method is for internal use only!
Returns - 12-bit ADC data (int).
||Keeps track of which module is currently active|
||Keeps track of which chip in a module is currently active|
||Keeps track of the current SPI speed the controller is set to|
||The current external reference frequency (in Hz)|