uC chip interface arduino
0.9.0
A interface for async and neuromrphic IC testing
|
The interface SPI creates and object though which the interface can be accessed. More...
Public Member Functions | |
def | __init__ (self, api_object, interface_id) |
init creates a not activate interface object More... | |
def | __str__ (self) |
str will return the current state, properies and data as a string More... | |
def | activate (self, mode="SPI_MODE0", speed_class=0, order="LSBFIRST", number_of_bytes=1, time=0) |
activate activates and configures the interface, if the interface is not availible on the UC it will put its state in en error state and prevent further use More... | |
def | bit_order (self) |
bit_order the bit order in which the word is send More... | |
def | data_from_chip (self) |
data_from_chip will retun the data recoded by the uC send from the device under test (DUT) More... | |
def | data_from_chip_and_clear (self) |
def | data_to_chip (self) |
data_to_chip will retun the data send by the uC to the device under test (DUT) More... | |
def | data_to_chip_and_clear (self) |
def | errors (self) |
errors all errors corresponding to this interface More... | |
def | header (self) |
header returns the packet headers associated whith this interface More... | |
def | interface_mode (self) |
interface_mode the currently active mode, consult spi arduino docs for more information More... | |
def | number_of_bytes () |
number_of_bytes the width of each send word, it can be 1,2,3 or 4 bytes More... | |
def | process_packet (self, packet) |
process_packet this function accepts packages fro this interface from the api and updates its internal state More... | |
def | send (self, word, time=0) |
send send a word via this interface More... | |
def | speed (self) |
speed the speed class result of the current More... | |
def | status (self) |
status returns the state of this interface, More... | |
def | update (self) |
update updates the internal state form the uC More... | |
The interface SPI creates and object though which the interface can be accessed.
the pins on the uC are fixed and depend on the specific uC model, please consult the pin out diagram of you uC
to read out the state use the object funtions to get the state returned, this is done so an state ubdate can be triggered before returning the values
Definition at line 23 of file interface_spi.py.
def __init__ | ( | self, | |
api_object, | |||
interface_id | |||
) |
init creates a not activate interface object
:param api_object: the parent manageing the conection to the uC :type api_object: uC_api :param interface_id: the identifier of the interface, so the interface number in the hardware it is usulay depiced after the port name like 0 -> SCK, COPI, CIPO; 1-> SCK1, COPI1, CIPO1 and so on; :type interface_id: int
Definition at line 30 of file interface_spi.py.
def __str__ | ( | self | ) |
str will return the current state, properies and data as a string
:return: the current state, properies and data :rtype: string
Definition at line 176 of file interface_spi.py.
def activate | ( | self, | |
mode = "SPI_MODE0" , |
|||
speed_class = 0 , |
|||
order = "LSBFIRST" , |
|||
number_of_bytes = 1 , |
|||
time = 0 |
|||
) |
activate activates and configures the interface, if the interface is not availible on the UC it will put its state in en error state and prevent further use
:param mode: choose between "SPI_MODE0" "SPI_MODE1" "SPI_MODE2" or "SPI_MODE3" see arduino SPI docs, defaults to "SPI_MODE0" :type mode: str, optional :param speed_class: 0-8 0:10kHz 1:50kHz 2:100kHz 3:500kHz 4:1MHz 5:2MHz 6:4MHz 7:8MHz 8:12MHz, defaults to 0 :type speed_class: int, optional :param order: Choose between "MSBFIRST" or "LSBFIRST" for order in which the word is transmitted, defaults to "LSBFIRST" :type order: str, optional :param number_of_bytes: 1-4 number of bytes contained in a word or better the length of a word, defaults to 1 :type number_of_bytes: int, optional :param time: the time in us after start_experiment when this function should be executed, defaults to 0 (execute instantly) :type time: int, optional
Definition at line 234 of file interface_spi.py.
def bit_order | ( | self | ) |
bit_order the bit order in which the word is send
:return: the active bitorder and the timestamp in us :rtype: (string, int)
Definition at line 108 of file interface_spi.py.
def data_from_chip | ( | self | ) |
data_from_chip will retun the data recoded by the uC send from the device under test (DUT)
will retun 2 lists: one with the word recoded and one with the time when it was recorded, linked by index :return: the words from the DUT and the times of those words :rtype: ([int],[int])
Definition at line 126 of file interface_spi.py.
def data_from_chip_and_clear | ( | self | ) |
Definition at line 151 of file interface_spi.py.
def data_to_chip | ( | self | ) |
data_to_chip will retun the data send by the uC to the device under test (DUT)
will retun 2 lists: one with the word send and one with the exact time when it was send, linked by index the time might differ slightly from the time you sheduled the send word, as it is the time when it was send out and the uC can only send one word at a time :return: the words send to the DUT and the times of those words :rtype: ([int],[int])
Definition at line 137 of file interface_spi.py.
def data_to_chip_and_clear | ( | self | ) |
Definition at line 159 of file interface_spi.py.
def errors | ( | self | ) |
errors all errors corresponding to this interface
:return: list of all errors :rtype: [string]
Definition at line 167 of file interface_spi.py.
def header | ( | self | ) |
header returns the packet headers associated whith this interface
:return: packet headers of this interface :rtype: Header (IntEnum)
Definition at line 64 of file interface_spi.py.
def interface_mode | ( | self | ) |
interface_mode the currently active mode, consult spi arduino docs for more information
spi has 4 modes which are numbered SPI_MODE0 ... :return: the mode and the timestamp in us as touple :rtype: (string, int)
Definition at line 88 of file interface_spi.py.
def number_of_bytes | ( | ) |
number_of_bytes the width of each send word, it can be 1,2,3 or 4 bytes
:return: the wisth of each word and the timestamp in us :rtype: (int, int)
Definition at line 117 of file interface_spi.py.
def process_packet | ( | self, | |
packet | |||
) |
process_packet this function accepts packages fro this interface from the api and updates its internal state
:param packet: the packet to be processed :type packet: Packet, or any sub class
Definition at line 195 of file interface_spi.py.
def send | ( | self, | |
word, | |||
time = 0 |
|||
) |
send send a word via this interface
:param word: the word to send :type word: int :param time: the time in us after start_experiment when this word should be send, defaults to 0 (execute instantly) :type time: int, optional
Definition at line 261 of file interface_spi.py.
def speed | ( | self | ) |
speed the speed class result of the current
:return: the frequency and the timestamp in us :rtype: (int, int)
Definition at line 99 of file interface_spi.py.
def status | ( | self | ) |
status returns the state of this interface,
it can be: - active - everything is working fine - activation pending - the uC has not acknolaged the activation yet after the request to activate the interface - not active - the interface has not been configured and activate - error - there was an error during activation or during use, please consult the errors using the errors function :return: the state of the interface and the timestamp in us :rtype: (string, int)
Definition at line 72 of file interface_spi.py.
def update | ( | self | ) |
update updates the internal state form the uC
Definition at line 273 of file interface_spi.py.