Skip to content

Commit e720214

Browse files
authored
Merge pull request #35 from tmytek/hotfix/matlab_example
Hotfix for MATLAB example
2 parents 1737df9 + 9911ed7 commit e720214

File tree

13 files changed

+424
-23
lines changed

13 files changed

+424
-23
lines changed

README.md

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
* TMYTEK general API for Windows/Linux platform.
44

5+
# Menu
6+
7+
* [Introduction](#introduction)
8+
* [Latest Release & Examples](#latest-release--examples)
9+
* [Prerequisites](#prerequisites)
10+
* [Troubleshooting](#troubleshooting)
11+
512
## Introduction
613

714
**TLKCore** is a core service which inside the TMXLAB KIT(TLK/[WEB-TLK](https://web-tlk.tmytek.com/)), it integrates Python built libraries which developing mmWave( n257 / n258 / n260 / n261 ) **beamforming** and **beam steering** applications on **BBox 5G Series(mmwave beamformer)** and **UDBox 5G Series(mmwave Up-down frequency converter)** and other standard products developed by TMYTEK.
@@ -22,19 +29,39 @@ The **.pyd** format release is for Windows shared library and **.so** format rel
2229
* TMYCommService is maintaining physical communications for all devices, it usually not handled directly by developer.
2330
* TMYUtils defines all data structure for return data, let developer more easier to know current status of processed function.
2431
* **TMYPublic** is a open source code, it defines all data structure which developer might used, e.g. RFMode(TX/RX), RetCode(OK/ERROR/...), UDState...etc.
25-
* (Optional) **TMYBeamConfig** is option solution for FBS (fast beam steering), it aims to parse assigned csv file to a dict structure and check beam configuration, please reference [FBS](/examples//Python/README.md#FBS)
32+
* (Optional) **TMYBeamConfig** is option solution for FBS (fast beam steering), it aims to parse assigned csv file to a dict structure and check beam configuration, please reference [FBS](/examples/Python/README.md#FBS)
2633
* All files/function under tmydev/ are all operating logic of standard products
2734
* db/ used for WEB-TLK, developer could ignore it.
2835

2936
![architecture](/images/TLKCore_architecture.png)
3037

31-
##### Latest Release & Reference Guide
38+
## Latest Release & Examples
3239

3340
* [[Download Link](/release)]
3441

35-
* Supported languages
36-
37-
![support](/images/support_languages.png)
42+
* [[Doc for function reference](/release/doc/)]
43+
44+
* [[Example code for supported languages](/examples/)]
45+
46+
<!-- [![support](/images/support_languages.png)](/examples/) -->
47+
48+
<p style="display:flex;justify-content:space-between;align-items:center">
49+
<a href="/examples/C_Cpp">
50+
<img src="/images/Logo_Cpp.png" alt="Image 1" width="100" height="100"/>
51+
</a>
52+
<a href="/examples/CSharp">
53+
<img src="/images/Logo_CSharp.png" alt="Image 1" width="100" height="100"/>
54+
</a>
55+
<a href="/examples/LabVIEW">
56+
<img src="/images/Logo_LabVIEW.svg" alt="Image 1" width="140" height="100"/>
57+
</a>
58+
<a href="/examples/MATLAB">
59+
<img src="/images/Logo_MATLAB.png" alt="Image 1" width="170" height="100"/>
60+
</a>
61+
<a href="/examples/Python">
62+
<img src="/images/Logo_Python.png" alt="Image 1" width="110" height="100"/>
63+
</a>
64+
</p>
3865

3966
## Prerequisites
4067

@@ -48,7 +75,7 @@ Host PC can communicate with TMYTEK product through physical connection as the f
4875

4976
#### Ethernet/RJ-45
5077

51-
* DHCP - Put devide and host PC in the LAN.
78+
* DHCP - Put the device and host PC in the LAN.
5279
* Static IP - Configure your network environment to IP: **192.168.100**.xxx, and Subnet Mask Bits <= `/24`, likes: 255.255.255.0
5380

5481
![network](/images/Network.png)

examples/C_Cpp/lib_tlkcore_cpp/src/tlkcore_lib.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class tlkcore_lib_impl : public tlkcore_lib
129129
}
130130
auto config = devs.attr("get")(sn);
131131
if (config == Py_None) { // equals Python: if config is None:
132-
cout << "[TLKCore] Not found: " << sn << endl;
132+
cout << "[TLKCore] Not found: " << sn << "in the config file" << endl;
133133
return -1;
134134
}
135135
// cout << config << endl;

examples/MATLAB/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,8 @@ P.S. The following example executes *MATLAB R2021b & Pyhton 3.8 64bit* on Window
2323
![MATLAB_copy](/images/MATLAB_copy.png)
2424

2525
2. Double-click TLKCoreExample.m to launch MATLAB process.
26-
3. Press **Run** to execute.
26+
3. Modify to your Python version
27+
28+
![MATLAB_ver](/images/MATLAB_Python_version.png)
29+
30+
4. Press **Run** to execute.

examples/MATLAB/TLKCoreExample.m

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,35 @@
1-
% Setup your Python execution version for MATLAB interface engine (just
1+
% Setup your Python execution version for MATLAB interface engine (just
22
% execute it once after MATLAB started), assign the version name to Windows
33
% registry (Windows Only) or set the full path
4+
5+
terminate(pyenv)
46
pe = pyenv;
57
if pe.Status == "NotLoaded"
6-
disp("Set to out")
8+
disp(" ----- Calling pyenv to check Python environment, and it's NotLoaded -> Start loading(OutOfProcess) -----")
9+
10+
% PLEASE MODIFY TO YOUR PYTHON VERSION (3.8/3.10/...) HERE
711
pyenv(ExecutionMode="OutOfProcess")%, "Version", "3.8")
812
end
9-
py.list % Call a Python function to load interpreter
13+
disp(" ----- Calling a simple Pytohn function: py.list to load Python interpreter -----")
14+
py.list
15+
disp(" ----- Calling pyenv to check Python environment -----")
1016
pyenv
1117

1218
% Setup TLKCore lib path
1319
pylibfolder = '.\lib';
1420
if count(py.sys.path, pylibfolder) == 0
1521
insert(py.sys.path, int64(0), pylibfolder);
1622
end
23+
disp(" ----- Calling py.sys.path to get Python execute sequence -----")
1724
py.sys.path
1825

19-
% Create instance
20-
tlkcore = py.TLKCoreService.TLKCoreService;
26+
% Create instance, it finds TLKCoreService class under pylibfolder
27+
tlkcore = py.tlkcore.TLKCoreService.TLKCoreService;
2128
disp("TLKCore version: " + tlkcore.version)
2229

23-
% Exevute scan devices
30+
% Scan devices via your main.py calls "scanDevices" function
2431
scan_list = py.main.wrapper("scanDevices");
32+
disp("Scan result:")
2533
disp(scan_list)
2634

2735
% Display system information then init each device to control
@@ -42,7 +50,7 @@
4250
% Initial device
4351
ret = py.main.wrapper("initDev", SN);
4452
disp(ret)
45-
53+
4654
% Simple query test
4755
disp(py.main.wrapper("querySN", SN))
4856
disp(py.main.wrapper("queryFWVer", SN))
@@ -64,17 +72,19 @@
6472
% Remember to de-int device to free memory
6573
py.main.wrapper("DeInitDev", SN)
6674
end
75+
disp(" ----- Terminate pyenv -----")
6776
terminate(pyenv)
6877

6978
function testBBox(SN)
7079
disp("Test BBox")
7180

7281
% Load basic enums
73-
tmy_public = py.importlib.import_module('TMYPublic');
82+
tmy_public = py.importlib.import_module('tlkcore.TMYPublic');
7483
RFMode = tmy_public.RFMode;
7584

76-
% Set TX, 28GHz here, please modify for your purpose, and make sure
77-
% related tables exist
85+
% Set TX & 28GHz here as example,
86+
% please modify for your purpose,
87+
% and make sure related tables exist.
7888
mode = RFMode.TX;
7989
py.main.wrapper("setRFMode", SN, mode)
8090
py.main.wrapper("setOperatingFreq", SN, 28)
@@ -87,7 +97,7 @@ function testBBox(SN)
8797
aakit_pat = "4x4";
8898
aakitList = py.main.wrapper("getAAKitList", SN, mode);
8999
disp(aakitList)
90-
if length(aakitList) == 0
100+
if isempty(aakitList)
91101
warning("PhiA mode")
92102
end
93103
% Check each aakit_name in aakitList meets the seaching pattern
@@ -114,7 +124,7 @@ function testUDBox(SN)
114124
disp("Test UDBox")
115125

116126
% Load basic enums
117-
tmy_public = py.importlib.import_module('TMYPublic');
127+
tmy_public = py.importlib.import_module('tlkcore.TMYPublic');
118128
UDState = tmy_public.UDState;
119129

120130
state = py.main.wrapper("getUDState", SN, UDState.PLO_LOCK);
@@ -127,7 +137,7 @@ function testUDBox(SN)
127137
disp(py.main.wrapper("setUDState", SN, int32(0), UDState.CH1))
128138
input("Wait for ch1 off")
129139
disp(py.main.wrapper("setUDState", SN, int32(1), UDState.CH1))
130-
140+
131141
disp(py.main.wrapper("setUDState", SN, int32(1), UDState.OUT_10M))
132142
disp(py.main.wrapper("setUDState", SN, int32(1), UDState.OUT_100M))
133143
disp(py.main.wrapper("setUDState", SN, int32(1), UDState.PWR_5V))
@@ -138,4 +148,4 @@ function testUDBox(SN)
138148
disp(py.main.wrapper("getHarmonic", SN, 24e6, 28e6, 4e6, 100000))
139149

140150
disp(py.main.wrapper("setUDFreq", SN, 24e6, 28e6, 4e6, 100000))
141-
end
151+
end

examples/Python/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ This topic introduces TLKCore how to process FBS (Fast Beam Steering), it loads
209209

210210
![scanned](/images/scanned.png)
211211

212-
2. Direct connect v
212+
2. Direct connect
213213
1. Via typing:
214214

215215
python3 main.py --dc D2230E013-28 192.168.100.121 9

images/Logo_CSharp.png

23.1 KB
Loading

images/Logo_Cpp.png

25.3 KB
Loading

images/Logo_LabVIEW.svg

Lines changed: 360 additions & 0 deletions
Loading

images/Logo_MATLAB.png

36.8 KB
Loading

images/Logo_Python.png

80.6 KB
Loading

0 commit comments

Comments
 (0)