This commit is contained in:
Loic Delattre 2023-04-28 14:40:09 +02:00
parent 4a1951fea2
commit 368bc18eef
1 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,33 @@
## Copyright (C) 2023 Loic
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <https://www.gnu.org/licenses/>.
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} determineArduinoUnoInterruptSettings (@var{input1}, @var{input2})
##
## @seealso{}
## @end deftypefn
## Author: Loic <Loic@LAPTOP-1F7SF0F7>
## Created: 2023-04-28
function retval = determineArduinoUnoInterruptSettings (Fs)
freqClock = 16*10^6;
preDiv = [1, 8, 32, 64, 128, 256, 1024];
CMR = [];
for i = 1:length(preDiv)
CMR(i) = freqClock/(preDiv(i)*Fs)-1;
endfunction