smbus context for devices that uses i2c as a form of input and output like ADC
adc device and analog input device
potentiometer device
new organization for sample file
Detailed changes
New syntax for declaring identifier
TL;DR
device_attr decorator has been converted to device with a new identifier function used to fill in the class attributes.
Explanation
@device_attr syntax worked fairly well for declaring multiple identifiers at once, if we threw in multiple attributes, but that became pretty repetitive as the class declaration also needed those attributes to be mentioned again for dataclass decorator. It also was a recursive function which made it pretty obscure. Instead, a new syntax borrowed from field function in dataclass is implemented where the identifer() function returns a identifier class which stores the context that will then be caught by the device decorator to swap the identifier attributes with a string on initialization/constructor.
smbus context for devices that uses i2c as a form of input and output like ADC
Storage for SMBus library class that will create analog input device in the store. This is also paired with a FakeSMBus library class in the device mock module.
adc device and analog input device
ADC device acts as an additional input device for analog inputs. Therefore this PR introduces two classes for ADC: ADC and Analog_input_device. ADC acts as a factory for analog input device. Other components that uses the ADC will have Analog_input_device as the attribute and grabs the data from the analog input device.
potentiometer device
Storage for potentiometer device for reading degrees of the pots.
new organization for sample file
Sample file now has "old" folder that contains python files that does not use any of the architecture stuff and is used for testing library classes. This may be potentially be renamed for sandbox as it is for any scripts for testing the device without having to worry about the architecture. Pot test file has also been created to contain any scripts related to testing pots and any hardware related to pots.
How to Test
Run catbot sample pot_test/read_singl_pot -D for running a script for reading a single pot's degree data and raw byte array.
Run catbot sample pot_test/read_multi_pot -D for running a script for reading multiple pots' degree at the same time.
Feature
Detailed changes
New syntax for declaring identifier
TL;DR
device_attr decorator has been converted to device with a new identifier function used to fill in the class attributes.
Explanation
@device_attr
syntax worked fairly well for declaring multiple identifiers at once, if we threw in multiple attributes, but that became pretty repetitive as the class declaration also needed those attributes to be mentioned again for dataclass decorator. It also was a recursive function which made it pretty obscure. Instead, a new syntax borrowed from field function in dataclass is implemented where the identifer() function returns a identifier class which stores the context that will then be caught by the device decorator to swap the identifier attributes with a string on initialization/constructor.smbus context for devices that uses i2c as a form of input and output like ADC
Storage for SMBus library class that will create analog input device in the store. This is also paired with a FakeSMBus library class in the device mock module.
adc device and analog input device
ADC device acts as an additional input device for analog inputs. Therefore this PR introduces two classes for ADC: ADC and Analog_input_device. ADC acts as a factory for analog input device. Other components that uses the ADC will have Analog_input_device as the attribute and grabs the data from the analog input device.
potentiometer device
Storage for potentiometer device for reading degrees of the pots.
new organization for sample file
Sample file now has "old" folder that contains python files that does not use any of the architecture stuff and is used for testing library classes. This may be potentially be renamed for sandbox as it is for any scripts for testing the device without having to worry about the architecture. Pot test file has also been created to contain any scripts related to testing pots and any hardware related to pots.
How to Test
catbot sample pot_test/read_singl_pot -D
for running a script for reading a single pot's degree data and raw byte array.catbot sample pot_test/read_multi_pot -D
for running a script for reading multiple pots' degree at the same time.