-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathfx3_api_example.py
44 lines (30 loc) · 1.06 KB
/
fx3_api_example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#Copyright (c) 2018-2020 Analog Devices, Inc. All Rights Reserved.
#This software is proprietary to Analog Devices, Inc. and its licensors.
#
#Author: Alex Nolan
#requires pythonnet to be installed (pip install pythonnet)
import clr
from time import sleep
import os
#get path to resources folder and dll
topDir = os.path.join(os.getcwd(), '..\..\..')
#Load FX3 API Wrapper DLL
clr.AddReference(topDir + '\\resources\\FX3ApiWrapper.dll')
#Allows wrapper to be treated like standard python library
from FX3ApiWrapper import *
from System import Array
from System import String
#Create FX3 Wrapper and load ADIS1650x regmap
Dut = Wrapper(topDir + '\\resources\\', topDir + '\\regmaps\\ADIS1650x_Regmap.csv',SensorType.StandardImu)
print(Dut.FX3.GetFirmwareVersion)
Dut.UserLEDBlink(2.0)
#Create reg list
regs_py = ['DIAG_STAT','DATA_CNTR','X_GYRO_OUT','Y_GYRO_OUT','Z_GYRO_OUT','X_ACCL_OUT','Y_ACCL_OUT','Z_ACCL_OUT']
regs = Array[String](regs_py)
data = []
while True:
data = Dut.ReadSigned(regs)
for i in (data):
print(i, end =" ")
print()
sleep(0.5)