API level 2
All interfaces are entirely abstracted at this level as Python objects, and packets are wholly hidden.
import uC_api, time
uc.async_to_chip[X]
uc.async_from_chip[X]
uc.i2c[X]
uc.pin[X]
uc.spi[X]
uc.pin[13].activate(pin_mode="OUTPUT")
uc.async_from_chip[0].activate(req_pin=0, ack_pin=1, data_width=2, data_pins=[2,3], mode="4Phase_Chigh_Dhigh", req_delay = 0)
uc.pin[13].send(value=1, time=10000)
uc.start_experiment()
time.sleep(1)
pin_13, pin_13_times = uc.pin[13].data_to_chip_and_clear()
print(async_from_chip[0])
us.close_connection()
the class uC_api exposes the full interface to the uC as an object, all the interface like i2c,...
All interfaces record data with timestamps for sending and receiving data from the uC to the DuT. For all available functions, see:
API level 1
This level handles the communication and buffering. The User has to construct and process all packets themselves.
import uC_api
header = uC_api.header.ConfigMainHeader.IN_CONF_PIN,
config_header = uC_api.header.ConfigSubHeader.CONF_OUTPUT,
value = 13)
uc.send_packet(pinConfigPacket)
time.sleep(1)
if uc.has_packet():
print(uc.read_packet())
us.close_connection()
The ConfigPacket is used to cumunicate configuration instructions with the uC all availible instructi...
For all available packets and headers, see: packet.py and header.py or datatypes.h
For all availible uC_api
commands see uC_api.uC.uC_api
API level 0
This level is the raw packets, and the User must handle the communication.
import serial, uC_api
packet_bytes = data_packet.to_bytearray()
uC_serial = serial.Serial('/dev/ttyACM0', 115200, timeout = 1)
uC_serial.reset_input_buffer()
uC_serial.write(packet_bytes)
read_bytes = uC_serial.read(size = len(packet_bytes))
print('> data read: {}'.format(read_packet))
uC_serial.close()
The Data32bitPacket is used to send 32bit data instructions to the uC all availible instructions are ...
def from_bytearray(cls, byte_array)
method to construct a packet from a bytearray depending on the header the correct packet type is retu...
For all available packets and headers, see: packet.py and header.py or datatypes.h