mirror of
https://github.com/eddyem/STM8_samples.git
synced 2025-12-06 18:55:15 +03:00
13 lines
400 B
Matlab
13 lines
400 B
Matlab
function waveforms(FN, nm)
|
|
% Prints on stdout 16 values for waveform bank
|
|
% FN - array with 16 values of Vout (Vmin..Vmax), will be normalized
|
|
% nm - name of array
|
|
MIN = min(FN); MAX = max(FN);
|
|
FN = (FN - MIN) / (MAX - MIN);
|
|
VAL = round(FN * 16);
|
|
printf("static const U8 %s[16] = {", nm)
|
|
for i = 1:15; printf("%d, ", VAL(i)); endfor;
|
|
printf("%d};\n", VAL(16));
|
|
plot(VAL, 'o');
|
|
endfunction
|