X2Cscope / pyx2cscope

python implementation of x2cscope
Other
1 stars 0 forks source link

read array variable #11

Closed edras closed 4 months ago

edras commented 10 months ago

It is not possible to access an array variable, i.e.:

C: uint16_t my_var[8];

it would be interesting to access this variable "my_var" through variable_factory in python

either by: my_var = [ ] my_var = variable_factory.get_variable_elf("my_var")

or

my_var0 = variable_factory.get_variable_elf("my_var[0]")

edras commented 7 months ago

This issue is being addressed on the branch assigned. Functionality is implemented, it needs to be tested

edras commented 4 months ago

accessing array variable, i.e., motorbench:

x2c_scope = X2CScope(...) variable = x2c_scope.get_variable("motor.estimator.zsmt.iqHistory") iqHistory = variable.get_value()

iqHistory is a python array with all current values captured over X2C

or you may use item functions for get and set iqHistory[0] # retrieve the first element iqHistory[-1] # retrieve the last element

iqHistory[0] = 9 # set the first element iqHistory[-1] = 10 # set the last element