-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathODrive.m
615 lines (524 loc) · 27.8 KB
/
ODrive.m
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
classdef ODrive < matlab.System ...
& coder.ExternalDependency ...
& matlab.system.mixin.Propagates ...
& matlab.system.mixin.CustomIcon
% Leave Port name empty, if you want to use shared port between multiple blocks
%
% This template includes most, but not all, possible properties,
% attributes, and methods that you can implement for a System object in
% Simulink.
%
%#codegen
properties
% Public, tunable properties.
end
properties (Nontunable)
Port = '/dev/ttyS0'
Autocalibration = 'Disabled (fail if not calibrated)'
end
properties(Nontunable, PositiveInteger)
Baudrate = 115200
end
properties (Nontunable, Logical)
EnableAxis0 = true; % Enable
EnableAxis1 = true; % Enable
EnableVbusOutput = false; % Bus voltage output
EnableTiming = false; % Enable block timing
EnablePosition0Output = false; % Enable estimated position output
EnableVelocity0Output = false; % Enable estimated velocity output
EnableCurrent0Output = false; % Enable estimated current output
EnablePosition1Output = false; % Enable estimated position output
EnableVelocity1Output = false; % Enable estimated velocity output
EnableCurrent1Output = false; % Enable estimated current output
UseIndex0 = true % Use index input of encoder
UseIndex1 = true % Use index input of encoder
ResetErrors0 = true; % Reset all error codes
ResetErrors1 = true; % Reset all error codes
EnableError0Output = false; % Enable error output
EnableError1Output = false; % Enable error output
end
properties(Nontunable)
ControlMode0 = 'Position' % Control Mode
ControlMode1 = 'Position' % Control Mode
MaxInputParameters = 20; % Maximum number of inputs
MaxOutputParameters = 20; % Maximum number of outputs
end
properties(Constant, Hidden)
ControlMode0Set = matlab.system.StringSet({'Position','Velocity','Current'})
ControlMode1Set = matlab.system.StringSet({'Position','Velocity','Current'})
AutocalibrationSet = matlab.system.StringSet({'Disabled (fail if not calibrated)','Autocalibrate','Autocalibrate and store'})
end
properties(Nontunable)
VelocityLimit0 = 20*pi; % Velocity limit [rad/s]
VelocityLimit1 = 20*pi; % Velocity limit [rad/s]
CurrentLimit0 = 65; % Current limit [A]
CurrentLimit1 = 65; % Current limit [A]
CountsPerRotate0 = 8192; % Counts per rotate of encoder
CountsPerRotate1 = 8192; % Counts per rotate of encoder
Inputs = {}; % Aditional inputs
Outputs = {}; % Aditional outputs
end
properties(Nontunable, Logical)
enableVBusRead = false
end
properties (Access = private)
inputParameters = {}
outputParameters = {}
inputNames = {}
outputNames = {}
inputMultiplier = ones(1, 0);
outputMultiplier = ones(1, 0);
portFilePointer = 0;
end
methods
% Constructor
function obj = Coils(varargin)
% Support name-value pair arguments when constructing the object.
setProperties(obj,nargin,varargin{:});
disp('constructor')
end
end
methods (Access=protected)
function setupImpl(obj)
obj.portFilePointer = int32(0);
if isempty(coder.target)
% Place simulation setup code here
else
[~, obj.inputParameters, obj.inputMultiplier, ~] = obj.generateInputs();
[~, obj.outputParameters, obj.outputMultiplier, ~] = obj.generateOutputs();
coder.cinclude('odrive.h');
% Call C-function implementing device initialization
obj.portFilePointer = coder.ceval('odrive_open_port', cstring(obj.Port), int32(obj.Baudrate));
motor0_calibrated = false;
motor1_calibrated = false;
encoder0_ready = false;
encoder1_ready = false;
should_store_calibration = false;
if obj.EnableAxis0
if obj.ResetErrors0
% Reset all error codes
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.motor.error'), int32(0));
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.encoder.error'), int32(0));
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.controller.error'), int32(0));
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.error'), int32(0));
end
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.encoder.config.use_index'), int32(obj.UseIndex0));
coder.ceval('odrive_write_float', obj.portFilePointer, cstring('axis0.motor.config.current_lim'), obj.CurrentLimit0);
vel_limit = (obj.VelocityLimit0*obj.CountsPerRotate0)/(2*pi);
coder.ceval('odrive_write_float', obj.portFilePointer, cstring('axis0.controller.config.vel_limit'), vel_limit);
motor0_calibrated = coder.ceval('odrive_read_int', obj.portFilePointer, cstring('axis0.motor.is_calibrated'));
encoder0_ready = coder.ceval('odrive_read_int', obj.portFilePointer, cstring('axis0.encoder.is_ready'));
end
if obj.EnableAxis1
if obj.ResetErrors1
% Reset all error codes
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.motor.error'), int32(0));
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.encoder.error'), int32(0));
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.controller.error'), int32(0));
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.error'), int32(0));
end
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.encoder.config.use_index'), int32(obj.UseIndex1));
coder.ceval('odrive_write_float', obj.portFilePointer, cstring('axis1.motor.config.current_lim'), obj.CurrentLimit1);
vel_limit = (obj.VelocityLimit1*obj.CountsPerRotate1)/(2*pi);
coder.ceval('odrive_write_float', obj.portFilePointer, cstring('axis1.controller.config.vel_limit'), vel_limit);
motor1_calibrated = coder.ceval('odrive_read_int', obj.portFilePointer, cstring('axis1.motor.is_calibrated'));
encoder1_ready = coder.ceval('odrive_read_int', obj.portFilePointer, cstring('axis1.encoder.is_ready'));
end
if(strcmp(obj.Autocalibration,'Disabled (fail if not calibrated)'))
if obj.EnableAxis0 && (~motor0_calibrated || ~encoder0_ready)
coder.ceval('odrive_error', cstring('Axis 0 not ready, need calibration'));
end
if obj.EnableAxis1 && (~motor1_calibrated || ~encoder1_ready)
coder.ceval('odrive_error', cstring('Axis 1 not ready, need calibration'));
end
end
if startsWith(obj.Autocalibration,'Autocalibrate')
if obj.EnableAxis0
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.config.startup_motor_calibration'), ~motor0_calibrated);
if ~motor0_calibrated
should_store_calibration = true;
end
if ~encoder0_ready
if obj.UseIndex0
encoder0_precalibrated = false;
encoder0_precalibrated = coder.ceval('odrive_read_int', obj.portFilePointer, cstring('axis0.encoder.config.pre_calibrated'));
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.config.startup_encoder_index_search'), true);
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.config.startup_encoder_offset_calibration'), ~encoder0_precalibrated);
if ~encoder0_precalibrated
should_store_calibration = true;
end
else
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.config.startup_encoder_index_search'), false);
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.config.startup_encoder_offset_calibration'), true);
should_store_calibration = true;
end
else
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.config.startup_encoder_index_search'), false);
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.config.startup_encoder_offset_calibration'), false);
end
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.requested_state'), int32(2));
end
if obj.EnableAxis1
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.config.startup_motor_calibration'), ~motor1_calibrated);
if ~motor1_calibrated
should_store_calibration = true;
end
if ~encoder1_ready
if obj.UseIndex1
encoder1_precalibrated = false;
encoder1_precalibrated = coder.ceval('odrive_read_int', obj.portFilePointer, cstring('axis1.encoder.config.pre_calibrated'));
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.config.startup_encoder_index_search'), true);
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.config.startup_encoder_offset_calibration'), ~encoder1_precalibrated);
if ~encoder1_precalibrated
should_store_calibration = true;
end
else
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.config.startup_encoder_index_search'), false);
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.config.startup_encoder_offset_calibration'), true);
should_store_calibration = true;
end
else
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.config.startup_encoder_index_search'), false);
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.config.startup_encoder_offset_calibration'), false);
end
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.requested_state'), int32(2));
end
if obj.EnableAxis0
coder.ceval('odrive_wait_for_state', obj.portFilePointer, int32(0), int32(1), int32(100000), int32(0));
end
if obj.EnableAxis1
coder.ceval('odrive_wait_for_state', obj.portFilePointer, int32(1), int32(1), int32(100000), int32(0));
end
end
if strcmp(obj.Autocalibration, 'Autocalibrate and store') && should_store_calibration
if obj.EnableAxis0
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.motor.config.pre_calibrated'), true);
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.encoder.config.pre_calibrated'), true);
end
if obj.EnableAxis1
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.motor.config.pre_calibrated'), true);
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.encoder.config.pre_calibrated'), true);
end
% TODO Find ASCII command to save configuration
end
if obj.EnableAxis0
switch(obj.ControlMode0)
case 'Position'
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.controller.config.control_mode'), int32(3));
case 'Velocity'
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.controller.config.control_mode'), int32(2));
case 'Current'
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.controller.config.control_mode'), int32(1));
end
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.requested_state'), int32(8));
end
if obj.EnableAxis1
switch(obj.ControlMode1)
case 'Position'
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.controller.config.control_mode'), int32(3));
case 'Velocity'
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.controller.config.control_mode'), int32(2));
case 'Current'
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.controller.config.control_mode'), int32(1));
end
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.requested_state'), int32(8));
end
end
end
function varargout = stepImpl(obj, varargin)
if isempty(coder.target)
% Place simulation output code here
for ind = 1:nargout
varargout{ind} = 625+ind;
end
else
startTime = 0;
endTime = 0;
if obj.EnableTiming
startTime = coder.ceval('odrive_time');
end
for ind = 1:(nargin-1)
value = varargin{ind}*obj.inputMultiplier(ind);
if length(obj.inputParameters{ind}) == 1
coder.ceval('odrive_quick_write', obj.portFilePointer, int8(obj.inputParameters{ind}(1)), int32(0), value);
else
coder.ceval('odrive_write_float', obj.portFilePointer, cstring(obj.inputParameters{ind}), value);
end
end
for ind = 1:nargout
value = 0;
value = coder.ceval('odrive_read_float', obj.portFilePointer, cstring(obj.outputParameters{ind}));
value = value * obj.outputMultiplier(ind);
varargout{ind} = value;
end
if obj.EnableTiming
endTime = coder.ceval('odrive_time');
coder.ceval('odrive_print_time', endTime-startTime);
end
end
end
function releaseImpl(obj)
if isempty(coder.target)
% Place simulation termination code here
else
% Call C-function implementing device termination
if obj.EnableAxis0
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis0.requested_state'), int32(1));
end
if obj.EnableAxis1
coder.ceval('odrive_write_int', obj.portFilePointer, cstring('axis1.requested_state'), int32(1));
end
end
end
function [names, parameters, multipliers, count] = generateInputs(obj)
count = 1;
parameters = cell(1, obj.MaxInputParameters);
names = cell(1, obj.MaxInputParameters);
multipliers = ones(1, obj.MaxInputParameters);
if obj.EnableAxis0
names{count} = ['Axis 0 Reference ', lower(obj.ControlMode0)];
parameters{count} = lower(obj.ControlMode0(1));
if parameters{count} == 'v' || parameters{count} == 'p'
multipliers(count) = obj.CountsPerRotate0/(2*pi);
end
count=count+1;
end
if obj.EnableAxis1
names{count} = ['Axis 1 Reference ', lower(obj.ControlMode1)];
parameters{count} = lower(obj.ControlMode1(1));
if parameters{count} == 'v' || parameters{count} == 'p'
multipliers(count) = obj.CountsPerRotate0/(2*pi);
end
count=count+1;
end
if ~isempty(obj.Inputs)
for ind = 1:length(obj.Inputs)
parameters{count} = obj.Inputs{ind};
names{count} = obj.Inputs{ind};
count=count+1;
end
end
if (count-1) > obj.MaxInputParameters
error("Too many inputs, disable some or increase maximum inputs constant in ODrive module");
end
assert(length(names) == length(parameters));
for ind = count:obj.MaxInputParameters
names{ind} = '';
parameters{ind} = '';
end
count = count - 1;
end
function [names, parameters, multipliers, count] = generateOutputs(obj)
count = 1;
parameters = cell(1,obj.MaxOutputParameters);
names = cell(1,obj.MaxOutputParameters);
multipliers = ones(1, obj.MaxOutputParameters);
if obj.EnableAxis0
if obj.EnablePosition0Output
parameters{count} = 'axis0.encoder.pos_estimate';
names{count} = 'Axis 0 Estimated position [rad]';
multipliers(count) = (2*pi)/obj.CountsPerRotate0;
count=count+1;
end
if obj.EnableVelocity0Output
parameters{count} = 'axis0.encoder.vel_estimate';
names{count} = 'Axis 0 Estimated velocity [rad/s]';
multipliers(count) = (2*pi)/obj.CountsPerRotate0;
count=count+1;
end
if obj.EnableCurrent0Output
parameters{count} = 'axis0.motor.current_control.Iq_measured';
names{count} = 'Axis 0 Measured current [A]';
count=count+1;
end
if obj.EnableError0Output
parameters{count} = 'axis0.error';
names{count} = 'Axis 0 Error state';
count=count+1;
end
end
if obj.EnableAxis1
if obj.EnablePosition1Output
parameters{count} = 'axis1.encoder.pos_estimate';
names{count} = 'Axis 1 Estimated position [rad]';
multipliers(count) = (2*pi)/obj.CountsPerRotate1;
count=count+1;
end
if obj.EnableVelocity1Output
parameters{count} = 'axis1.encoder.vel_estimate';
names{count} = 'Axis 1 Estimated position [rad/s]';
multipliers(count) = (2*pi)/obj.CountsPerRotate1;
count=count+1;
end
if obj.EnableCurrent1Output
parameters{count} = 'axis1.motor.current_control.Iq_measured';
names{count} = 'Axis 1 Measured current [A]';
count=count+1;
end
if obj.EnableError1Output
parameters{count} = 'axis1.error';
names{count} = 'Axis 1 Error state';
count=count+1;
end
end
if obj.EnableVbusOutput
parameters{count} = 'vbus_voltage';
names{count} = 'Bus voltage [V]';
count=count+1;
end
if ~isempty(obj.Outputs)
for out = obj.Outputs
parameters{count} = out{1};
names{count} = out{1};
count=count+1;
end
end
if (count-1) > obj.MaxOutputParameters
error("Too many outputs, disable some or increase maximum outputs constant in ODrive module");
end
for ind = count:obj.MaxOutputParameters
names{ind} = '';
parameters{ind} = '';
end
count = count - 1;
end
end
methods (Access=protected)
%% Define input properties
function num = getNumInputsImpl(obj)
[~, ~, ~, num] = obj.generateInputs();
end
function num = getNumOutputsImpl(obj)
[~, ~, ~, num] = obj.generateOutputs();
end
function flag = isInputSizeLockedImpl(~,~)
flag = true;
end
function varargout = isInputFixedSizeImpl(~,~)
varargout{1} = true;
end
function flag = isInputComplexityLockedImpl(~,~)
flag = true;
end
function validateInputsImpl(obj, varargin)
if isempty(coder.target)
% Run input validation only in Simulation
end
end
function validatePropertiesImpl(obj)
end
function icon = getIconImpl(obj)
% Define a string as the icon for the System block in Simulink.
if isempty(obj.Port)
icon = sprintf('ODrive\n');
elseif any(startsWith(obj.Port, ["/dev/ttyACM", "/dev/ttyUSB"]))
icon = sprintf('ODrive USB\nPort: %s', obj.Port);
else
icon = sprintf('ODrive\nPort: %s\n Baudrate: %d', obj.Port, obj.Baudrate);
end
end
function varargout = getInputNamesImpl(obj)
% Return input port names for System block
[varargout, ~, ~, ~] = obj.generateInputs();
end
function varargout = getOutputNamesImpl(obj)
% Return output port names for System block
[varargout, ~, ~, ~] = obj.generateOutputs();
end
function varargout = getOutputSizeImpl(obj)
% Return size for each output port
varargout = cell(1,nargout);
for k = 1:nargout
varargout{k} = [1 1];
% Example: inherit size from first input port
% varargout{k} = propagatedInputSize(obj,1);
end
end
function varargout = getOutputDataTypeImpl(obj)
% Return data type for each output port
varargout = cell(1,nargout);
for k = 1:nargout
varargout{k} = "double";
% Example: inherit data type from first input port
% varargout{k} = propagatedInputDataType(obj,1);
end
end
function varargout = isOutputComplexImpl(obj)
% Return true for each output port with complex data
varargout = cell(1,nargout);
for k = 1:nargout
varargout{k} = false;
% Example: inherit complexity from first input port
% varargout{k} = propagatedInputComplexity(obj,1);
end
end
function varargout = isOutputFixedSizeImpl(obj)
% Return true for each output port with fixed size
varargout = cell(1,nargout);
for k = 1:nargout
varargout{k} = true;
% Example: inherit fixed-size status from first input port
% varargout{k} = propagatedInputFixedSize(obj,1);
end
end
end
methods (Static, Access=protected)
function header = getHeaderImpl
% Define header panel for System block dialog
header = matlab.system.display.Header(mfilename('class'), 'Title', ODrive.getDescriptiveName());
end
function groups = getPropertyGroupsImpl
% Define property section(s) for System block dialog
% group = matlab.system.display.Section(mfilename("class"));
configGroup = matlab.system.display.Section(...
'Title','ODrive configuration',...
'PropertyList',{'Port','Baudrate', 'Autocalibration', 'EnableTiming'});
axis0Group = matlab.system.display.SectionGroup(...
'Title','Axis 0', ...
'PropertyList',{'EnableAxis0','UseIndex0','ResetErrors0','ControlMode0','VelocityLimit0', 'CurrentLimit0', 'CountsPerRotate0', 'EnablePosition0Output', 'EnableVelocity0Output', 'EnableCurrent0Output', 'EnableError0Output'});
axis1Group = matlab.system.display.SectionGroup(...
'Title','Axis 1', ...
'PropertyList',{'EnableAxis1','UseIndex1','ResetErrors1','ControlMode1','VelocityLimit1', 'CurrentLimit1', 'CountsPerRotate1', 'EnablePosition1Output', 'EnableVelocity1Output', 'EnableCurrent1Output', 'EnableError1Output'});
inputsGroup = matlab.system.display.SectionGroup(...
'Title','Inputs', ...
'PropertyList',{'MaxInputParameters','Inputs'});
outputsGroup = matlab.system.display.SectionGroup(...
'Title','Outputs', ...
'PropertyList',{'MaxOutputParameters','EnableVbusOutput','Outputs'});
groups = [configGroup, axis0Group, axis1Group, inputsGroup, outputsGroup];
end
function simMode = getSimulateUsingImpl(~)
simMode = 'Interpreted execution';
end
function flag = showSimulateUsingImpl
% Return false if simulation mode hidden in System block dialog
flag = false;
end
end
methods (Static)
function name = getDescriptiveName()
name = 'ODrive';
end
function b = isSupportedContext(context)
b = context.isCodeGenTarget('rtw');
end
function updateBuildInfo(buildInfo, context)
if context.isCodeGenTarget('rtw')
% Update buildInfo
srcDir = fullfile(fileparts(mfilename('fullpath')),'src');
includeDir = fullfile(fileparts(mfilename('fullpath')),'include');
addIncludePaths(buildInfo,includeDir);
% Use the following API's to add include files, sources and
% linker flags
addIncludeFiles(buildInfo,'odrive.h',includeDir);
addSourceFiles(buildInfo,'odrive.c',srcDir);
%addLinkObjects(buildInfo,'sourcelib.a',srcDir);
addCompileFlags(buildInfo,{'-DDEBUG_COUMNICATION'});
%addDefines(buildInfo,'MY_DEFINE_1')
end
end
end
end
function output = cstring(input)
output = [input 0];
end