uC chip interface arduino  0.9.0
A interface for async and neuromrphic IC testing
Loading...
Searching...
No Matches
uC_api Class Reference

the class uC_api exposes the full interface to the uC as an object, all the interface like i2c, spi, pin and async can be found as exposed variables More...

Public Member Functions

def __init__ (self, serial_port_path, api_level=2)
 init creates the uC interface object and establishes the connection to the uC on the given port More...
 
def __str__ (self)
 
def close_connection (self)
 close_connection closes the serial connection to the uC and blocks until this is done resets the uC too More...
 
def experiment_state (self)
 experiment_state returns the state history More...
 
def has_packet (self)
 has_packet checks if a packet is availible for reading from the buffer More...
 
def read_packet (self)
 read_packet returns one package from the uC via the "infinte" buffer More...
 
def reset (self)
 reset uC and hope the serial connection survives More...
 
def send_packet (self, packet_to_send)
 send_packet send a packet to the uC via the "infinite" buffer needs a package object see package.py More...
 
def start_experiment (self)
 start_experiment This will reset the uC clock, enable that data is collected and that timed instructions are executed by the uC latest after 72min stop_experiment has to be called, after which a new experiment can be programmed and the function can be called again. More...
 
def stop_experiment (self, time=0)
 stop_experiment this will stop recording and flush all not jet excecuted timed instructions More...
 
def update_state (self)
 update_state This method processes all availible messages from the uC and updates the internal representaion in detail it distributes the recorded packages to the coresponding interfaces for processing. More...
 

Public Attributes

 async_from_chip
 
 async_to_chip
 
 errors
 
 i2c
 
 pin
 
 spi
 

Detailed Description

the class uC_api exposes the full interface to the uC as an object, all the interface like i2c, spi, pin and async can be found as exposed variables

Interfaces need to be activated before use, and the activation is ackloaged by the uC you might need to time.sleep(0.01) after the activation for the python object to update register the state change

if you want to record data you need to use function start_experiment() to be abel to see the data send back the maximum time of each experiment is 72min, please call stop experiment before that to start agian

after you are done call close_connection to sever the serial connection to the uC, the recorded data in the python object remains and can be processed after

Definition at line 41 of file uC.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  serial_port_path,
  api_level = 2 
)

init creates the uC interface object and establishes the connection to the uC on the given port

    :param serial_port_path: the path of your system to the serial port, eg. on linux it might be /dev/ttyAMC0 or higher, on mac /dev/tty.usbmodem<XXXXX> on windows <COM port>
    :type serial_port_path: string 
    :param api_level: level 1 is that the api only espablishes the connection to the uC and the "infinite" write and read buffers, you need to construct the instruction packages your self, 
    level 2 it wraps the full representation of the uC interfaces in objects that are made availible as variables on this object, defaults to 2
    :type api_level: int, optional

Definition at line 55 of file uC.py.

Member Function Documentation

◆ __str__()

def __str__ (   self)

Definition at line 149 of file uC.py.

◆ close_connection()

def close_connection (   self)

close_connection closes the serial connection to the uC and blocks until this is done resets the uC too

Definition at line 244 of file uC.py.

◆ experiment_state()

def experiment_state (   self)

experiment_state returns the state history

    1 or larger: experiment is running
    0 experiment stopped
    -1 uC reset

    :return: 2 lists: first the state second the uC timesteps in us of the state change
    :rtype: ([int],[int])

Definition at line 185 of file uC.py.

◆ has_packet()

def has_packet (   self)

has_packet checks if a packet is availible for reading from the buffer

    :return: true if packet is avilible, false if not
    :rtype: boolean

Definition at line 231 of file uC.py.

◆ read_packet()

def read_packet (   self)

read_packet returns one package from the uC via the "infinte" buffer

    if there is no packet availible it blocks and waits until a packet becomes availible

    :return: one package from the uC
    :rtype: Packet, or any subclass

Definition at line 216 of file uC.py.

◆ reset()

def reset (   self)

reset uC and hope the serial connection survives

Definition at line 256 of file uC.py.

◆ send_packet()

def send_packet (   self,
  packet_to_send 
)

send_packet send a packet to the uC via the "infinite" buffer needs a package object see package.py

:param packet_to_send: the package to be send :type packet_to_send: Packet, or any subclass

Definition at line 197 of file uC.py.

◆ start_experiment()

def start_experiment (   self)

start_experiment This will reset the uC clock, enable that data is collected and that timed instructions are executed by the uC latest after 72min stop_experiment has to be called, after which a new experiment can be programmed and the function can be called again.

Definition at line 159 of file uC.py.

◆ stop_experiment()

def stop_experiment (   self,
  time = 0 
)

stop_experiment this will stop recording and flush all not jet excecuted timed instructions

    :param time: the time in us after start_experiment when this function should be called, defaults to 0 (execute instantly)
    :type time: int, optional

Definition at line 171 of file uC.py.

◆ update_state()

def update_state (   self)

update_state This method processes all availible messages from the uC and updates the internal representaion in detail it distributes the recorded packages to the coresponding interfaces for processing.

level 2 only

Definition at line 103 of file uC.py.

Member Data Documentation

◆ async_from_chip

async_from_chip

Definition at line 89 of file uC.py.

◆ async_to_chip

async_to_chip

Definition at line 86 of file uC.py.

◆ errors

errors

Definition at line 80 of file uC.py.

◆ i2c

i2c

Definition at line 82 of file uC.py.

◆ pin

pin

Definition at line 83 of file uC.py.

◆ spi

spi

Definition at line 81 of file uC.py.


The documentation for this class was generated from the following file: