]*>.*')
tag_match5 = re.compile(r'.*
]*>.*')
index_match = re.compile(r'.*
]*>[\d\.\s]*(?P[^<]+)
.*')
index_match2 = re.compile(r'.*
]*>[\d\.\s]*(?P[^<]+)<.*')
tag = "top"
has_h2 = False
has_h3 = False
has_h4 = False
#pat_match = re.compile(r'.*(?P[.]+)$')
with open(name + ".html", 'rt') as fin:
with open(name + ".qhp", 'wt') as f:
f.write('\n')
f.write('\n')
f.write(' octave.community.{}\n'.format(name))
f.write(' doc\n')
f.write(' \n')
f.write(' \n')
f.write(' \n'.format(title, name))
# chapters here
for line in fin:
line = line.strip()
e = tag_match1.match(line)
if not e:
e = tag_match2.match(line)
if not e:
e = tag_match3.match(line)
if not e:
e = tag_match4.match(line)
if not e:
e = tag_match5.match(line)
if e:
tag = e.group("tag")
e = h2_match.match(line)
if not e:
e = h2a_match.match(line)
if not e:
e = h2i_match.match(line)
if e:
if has_h4:
f.write(' \n')
has_h4 = False
if has_h3:
f.write(' \n')
has_h3 = False
if has_h2:
f.write(' \n')
has_h2 = True
f.write(' \n'.format(e.group("title"), name, tag))
e = h3_match.match(line)
if e:
if has_h4:
f.write(' \n')
has_h4 = False
if has_h3:
f.write(' \n')
has_h3 = True
f.write(' \n'.format(e.group("title"), name, tag))
e = h4_match.match(line)
if e:
if has_h4:
f.write(' \n')
has_h4 = True
#f.write(' \n'.format(e.group("title"), name, tag))
f.write(' \n'.format(e.group("title"), name, tag))
e = h5_match.match(line)
if e:
f.write(' \n'.format(e.group("title"), name, tag))
if has_h4:
f.write(' \n')
if has_h3:
f.write(' \n')
if has_h2:
f.write(' \n')
f.write(' \n')
f.write(' \n')
f.write(' \n')
fin.seek(0)
for line in fin:
line = line.strip()
e = tag_match1.match(line)
if not e:
e = tag_match2.match(line)
if e:
tag = e.group("tag")
e = index_match.match(line)
if not e:
e = index_match2.match(line)
if e:
f.write(' \n'.format(e.group("name"), name, tag))
f.write(' \n')
f.write(' \n')
f.write(' {}.html\n'.format(name))
f.write(' {}.css\n'.format(name))
f.write(' \n')
f.write(' \n')
f.write('\n')
def show_usage():
print (sys.argv[0], "projname")
if __name__ == "__main__":
if len(sys.argv) > 1:
status = process(sys.argv[1])
sys.exit(status)
else:
show_usage()
gnu-octave-octave-arduino-deeeb99/inst/ 0000775 0000000 0000000 00000000000 15125212406 0020243 5 ustar 00root root 0000000 0000000 gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/ 0000775 0000000 0000000 00000000000 15125212406 0022307 5 ustar 00root root 0000000 0000000 gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/ 0000775 0000000 0000000 00000000000 15125212406 0023627 5 ustar 00root root 0000000 0000000 gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_due.m 0000664 0000000 0000000 00000020622 15125212406 0026111 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2021 John Donoghue
##
## 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
## .
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} config_due (@var{initdata})
## Private function for setting allowed modes of due board pins
## @end deftypefn
function retval = config_due (initdata)
retval = {};
# default board info - must be provided
# will be filled in on connection.
retval.board = '';
retval.baudrate = 9600;
retval.mcu = 'cortex-m3';
retval.voltref = 3.3;
retval.libs = {};
retval.port = '';
# info expected to be provided by config.
retval.description = 'Arduino Due Board';
# pin config
retval.pins = {};
retval.pins{end+1} = arduinoio.config.pin_info('D0', 0, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D1', 1, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D2', 2, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D3', 3, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D4', 4, { 'digital', 'pwm', 'interrupt' }); # D87
retval.pins{end+1} = arduinoio.config.pin_info('D5', 5, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D6', 6, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D7', 7, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D8', 8, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D9', 9, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D10', 10, { 'digital', 'pwm', 'interrupt' }); # D77
retval.pins{end+1} = arduinoio.config.pin_info('D11', 11, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D12', 12, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D13', 13, { 'digital', 'pwm' 'led_13', 'led', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D14', 14, { 'digital', 'uart3_tx', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D15', 15, { 'digital', 'uart3_rx', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D16', 16, { 'digital', 'uart2_tx', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D17', 17, { 'digital', 'uart2_rx', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D18', 18, { 'digital', 'uart1_tx', 'interrupt'});
retval.pins{end+1} = arduinoio.config.pin_info('D19', 19, { 'digital', 'uart1_tx', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D20', 20, { 'digital', 'i2c0_sda', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D21', 21, { 'digital', 'i2c0_scl', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D22', 22, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D23', 23, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D24', 24, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D25', 25, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D26', 26, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D27', 27, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D28', 28, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D29', 29, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D30', 30, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D31', 31, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D32', 32, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D33', 33, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D34', 34, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D35', 35, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D36', 36, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D37', 37, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D38', 38, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D39', 39, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D40', 40, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D41', 41, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D42', 42, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D43', 43, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D44', 44, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D45', 45, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D46', 46, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D47', 47, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D48', 48, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D49', 49, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D50', 50, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D51', 51, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D52', 52, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D53', 53, { 'digital', 'interrupt' });
# analogs
retval.pins{end+1} = arduinoio.config.pin_info('A0', 54, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A1', 55, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A2', 56, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A3', 57, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A4', 58, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A5', 59, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A6', 60, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A7', 61, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A8', 62, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A9', 63, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A10', 64, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A11', 65, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('D66', 66, { 'digital' }); # DAC0
retval.pins{end+1} = arduinoio.config.pin_info('D67', 67, { 'digital' }); # DAC1
retval.pins{end+1} = arduinoio.config.pin_info('D68', 68, { 'digital' }); # CANRX
retval.pins{end+1} = arduinoio.config.pin_info('D69', 69, { 'digital' }); # CANTX
retval.pins{end+1} = arduinoio.config.pin_info('D70', 70, { 'digital', 'i2c1_sda' });
retval.pins{end+1} = arduinoio.config.pin_info('D71', 71, { 'digital', 'i2c1_scl' });
retval.pins{end+1} = arduinoio.config.pin_info('D72', 72, { 'digital', 'led_rxl' });
retval.pins{end+1} = arduinoio.config.pin_info('D73', 73, { 'digital', 'led_txl' });
retval.pins{end+1} = arduinoio.config.pin_info('D74', 74, { 'digital', 'spi_miso' });
retval.pins{end+1} = arduinoio.config.pin_info('D75', 75, { 'digital', 'spi_mosi' });
retval.pins{end+1} = arduinoio.config.pin_info('D76', 76, { 'digital', 'spi_sck' });
retval.pins{end+1} = arduinoio.config.pin_info('D77', 77, { 'digital', 'spi_ss' });
#retval.pins{end+1} = arduinoio.config.pin_info('D78', 78, { 'digital', 'spi_ss3' });
#retval.pins{end+1} = arduinoio.config.pin_info('D86', 86, { 'digital', 'spi_ss2' });
#retval.pins{end+1} = arduinoio.config.pin_info('D87', 87, { 'digital', 'spi_ss1' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_esp32_dev.m 0000664 0000000 0000000 00000015360 15125212406 0027131 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2021 John Donoghue
##
## 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
## .
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} config_esp32_dev (@var{initdata})
## Private function for setting allowed modes of esp board pins
## @end deftypefn
# configuration generated from esp32/2.0.2/variants/esp32/pins_arduino.h
function retval = config_esp32_dev (initdata)
retval = {};
# default board info - must be provided
# will be filled in on connection.
retval.board = '';
retval.baudrate = 9600;
retval.mcu = 'eps32';
retval.voltref = 0;
retval.libs = {};
retval.port = '';
# info expected to be provided by config.
retval.description = 'ESP32 Dev Module';
# pin config
retval.pins = {};
retval.pins{end+1} = arduinoio.config.pin_info('D0', 0, { 'digital', 'pwm', 'interrupt', 'analog' }, {'a11'});
retval.pins{end+1} = arduinoio.config.pin_info('D1', 1, { 'digital', 'pwm', 'uart0_tx', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D2', 2, { 'digital', 'pwm', 'interrupt', 'led', 'analog' }, {'a12'});
retval.pins{end+1} = arduinoio.config.pin_info('D3', 3, { 'digital', 'pwm', 'uart0_rx', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D4', 4, { 'digital', 'pwm', 'interrupt', 'analog' }, {'a4'});
retval.pins{end+1} = arduinoio.config.pin_info('D5', 5, { 'digital', 'pwm', 'interrupt', 'spi_ss' });
# dont use
#retval.pins{end+1} = arduinoio.config.pin_info('D6', 6, { 'digital', 'pwm', 'interrupt' });
#retval.pins{end+1} = arduinoio.config.pin_info('D7', 7, { 'digital', 'pwm', 'interrupt' });
#retval.pins{end+1} = arduinoio.config.pin_info('D8', 8, { 'digital', 'pwm', 'interrupt' });
#retval.pins{end+1} = arduinoio.config.pin_info('D9', 9, { 'digital', 'pwm', 'interrupt' });
#retval.pins{end+1} = arduinoio.config.pin_info('D10', 10, { 'digital', 'pwm', 'interrupt' });
#retval.pins{end+1} = arduinoio.config.pin_info('D11', 11, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D12', 12, { 'digital', 'pwm', 'interrupt', 'analog' }, {'a15'});
retval.pins{end+1} = arduinoio.config.pin_info('D13', 13, { 'digital', 'pwm', 'interrupt', 'analog' }, {'a14'});
retval.pins{end+1} = arduinoio.config.pin_info('D14', 14, { 'digital', 'pwm', 'interrupt', 'analog' }, {'a16'});
retval.pins{end+1} = arduinoio.config.pin_info('D15', 15, { 'digital', 'pwm', 'interrupt', 'analog' }, {'a13'});
retval.pins{end+1} = arduinoio.config.pin_info('D16', 16, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D17', 17, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D18', 18, { 'digital', 'pwm', 'interrupt', 'spi_sck' });
retval.pins{end+1} = arduinoio.config.pin_info('D19', 19, { 'digital', 'pwm', 'interrupt', 'spi_miso' });
#retval.pins{end+1} = arduinoio.config.pin_info('D20', 20, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D21', 21, { 'digital', 'pwm', 'interrupt', 'i2c_sda' });
retval.pins{end+1} = arduinoio.config.pin_info('D22', 22, { 'digital', 'pwm', 'interrupt', 'i2c_scl' });
retval.pins{end+1} = arduinoio.config.pin_info('D23', 23, { 'digital', 'pwm', 'interrupt', 'spi_mosi' });
#retval.pins{end+1} = arduinoio.config.pin_info('D24', 24, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D25', 25, { 'digital', 'pwm', 'interrupt', 'analog' }, {'a18'});
retval.pins{end+1} = arduinoio.config.pin_info('D26', 26, { 'digital', 'pwm', 'interrupt', 'analog' }, {'a19'});
retval.pins{end+1} = arduinoio.config.pin_info('D27', 27, { 'digital', 'pwm', 'interrupt', 'analog' }, {'a17'});
#retval.pins{end+1} = arduinoio.config.pin_info('D28', 28, { 'digital', 'pwm', 'interrupt' });
#retval.pins{end+1} = arduinoio.config.pin_info('D29', 29, { 'digital', 'pwm', 'interrupt' });
#retval.pins{end+1} = arduinoio.config.pin_info('D30', 30, { 'digital', 'pwm', 'interrupt' });
#retval.pins{end+1} = arduinoio.config.pin_info('D31', 31, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D32', 32, { 'digital', 'pwm', 'interrupt', 'analog' }, {'a4'});
retval.pins{end+1} = arduinoio.config.pin_info('D33', 33, { 'digital', 'pwm', 'interrupt', 'anolog' }, {'a5'});
retval.pins{end+1} = arduinoio.config.pin_info('D34', 34, { 'digital', 'analog' }, {'a6'});
retval.pins{end+1} = arduinoio.config.pin_info('D35', 35, { 'digital', 'analog' }, {'a7'});
retval.pins{end+1} = arduinoio.config.pin_info('D36', 36, { 'digital', 'analog' }, {'a0'});
retval.pins{end+1} = arduinoio.config.pin_info('D37', 37, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D38', 38, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D39', 39, { 'digital', 'analog' }, {'a3'});
%{
analog are in the digital pins
retval.pins{end+1} = arduinoio.config.pin_info('A0', 40, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A1', 41, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A2', 42, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A3', 43, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A4', 44, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A5', 45, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A6', 46, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A7', 47, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A8', 48, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A9', 49, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A10', 50, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A11', 51, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A12', 52, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A13', 53, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A14', 54, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A15', 55, { 'digital', 'analog' });
%}
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_leonardo.m 0000664 0000000 0000000 00000006745 15125212406 0027151 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2019 John Donoghue
##
## 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
## .
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} config_leonardo (@var{initdata})
## Private function for setting allowed modes of leonardo board pins
## @end deftypefn
function retval = config_leonardo (initdata)
retval = {};
# default board info - must be provided
# will be filled in on connection.
retval.board = 'leonardo';
retval.baudrate = 9600;
retval.mcu = '';
retval.voltref = 0;
retval.libs = {};
retval.port = '';
# info expected to be provided by config.
retval.description = 'Arduino Leonardo Board';
# pin config
retval.pins = {};
retval.pins{end+1} = arduinoio.config.pin_info('D0', 0, { 'digital', 'uart1_rx' });
retval.pins{end+1} = arduinoio.config.pin_info('D1', 1, { 'digital', 'uart1_tx' });
retval.pins{end+1} = arduinoio.config.pin_info('D2', 2, { 'digital', 'i2c_sda', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D3', 3, { 'digital', 'i2c_scl', 'interrupt', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D4', 4, { 'digital' }, {"A6"}); # share A6
retval.pins{end+1} = arduinoio.config.pin_info('D5', 5, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D6', 6, { 'digital', 'pwm' }, {"A7"}); # share A7
retval.pins{end+1} = arduinoio.config.pin_info('D7', 7, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D8', 8, { 'digital' }, {"A8"}); # share A8
retval.pins{end+1} = arduinoio.config.pin_info('D9', 9, { 'digital', 'pwm' }, {"A9"}); # share A9
retval.pins{end+1} = arduinoio.config.pin_info('D10', 10, { 'digital', 'pwm' }, {"A10"}); # share A10
retval.pins{end+1} = arduinoio.config.pin_info('D11', 11, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D12', 12, { 'digital' }, {"A11"});
retval.pins{end+1} = arduinoio.config.pin_info('D13', 13, { 'digital', 'led', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D14', 14, { 'digital', 'spi_miso' });
retval.pins{end+1} = arduinoio.config.pin_info('D15', 15, { 'digital', 'spi_sck' });
retval.pins{end+1} = arduinoio.config.pin_info('D16', 16, { 'digital', 'spi_mosi' });
retval.pins{end+1} = arduinoio.config.pin_info('D17', 17, { 'digital', 'spi_ss', 'led' });
retval.pins{end+1} = arduinoio.config.pin_info('A0', 18, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A1', 19, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A2', 20, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A3', 21, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A4', 22, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A5', 23, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('D30', 30, { 'digital', 'led' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_lilypad.m 0000664 0000000 0000000 00000004160 15125212406 0026771 0 ustar 00root root 0000000 0000000 # configuration generated from /usr/share/arduino/hardware/arduino/avr/variants/standard/pins_arduino.h
function retval = config_lilypad (initdata)
retval = {};
# default board info - must be provided
# will be filled in on connection.
retval.board = '';
retval.baudrate = 9600;
retval.mcu = '';
retval.voltref = 0;
retval.libs = {};
retval.port = '';
# info expected to be provided by config.
retval.description = 'lilypad arduino';
# pin config
retval.pins = {};
retval.pins{end+1} = arduinoio.config.pin_info('D0', 0, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D1', 1, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D2', 2, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D3', 3, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D4', 4, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D5', 5, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D6', 6, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D7', 7, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D8', 8, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D9', 9, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D10', 10, { 'digital', 'spi_ss' });
retval.pins{end+1} = arduinoio.config.pin_info('D11', 11, { 'digital', 'spi_mosi' });
retval.pins{end+1} = arduinoio.config.pin_info('D12', 12, { 'digital', 'spi_miso' });
retval.pins{end+1} = arduinoio.config.pin_info('D13', 13, { 'digital', 'spi_sck', 'led' });
retval.pins{end+1} = arduinoio.config.pin_info('A0', 14, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A1', 15, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A2', 16, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A3', 17, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A4', 18, { 'digital', 'i2c_sda', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A5', 19, { 'digital', 'i2c_scl', 'analog' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_mega2560.m 0000664 0000000 0000000 00000015667 15125212406 0026577 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2018 John Donoghue
##
## 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
## .
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} config_mega (@var{initdata})
## Private function for setting allowed modes of mega board pins
## @end deftypefn
function retval = config_mega2560 (initdata)
retval = [];
# default board info - must be provided
# will be filled in on connection.
retval.board = '';
retval.baudrate = 9600;
retval.mcu = '';
retval.voltref = 0;
retval.libs = {};
retval.port = '';
# info expected to be provided by config.
retval.description = 'Arduino Mega2560/1260 Board';
# pin config
retval.pins = {};
retval.pins{end+1} = arduinoio.config.pin_info('D0', 0, { 'digital', 'uart' });
retval.pins{end+1} = arduinoio.config.pin_info('D1', 1, { 'digital', 'uart' });
retval.pins{end+1} = arduinoio.config.pin_info('D2', 2, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D3', 3, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D4', 4, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D5', 5, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D6', 6, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D7', 7, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D8', 8, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D9', 9, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D10', 10, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D11', 11, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D12', 12, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D13', 13, { 'digital', 'led', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D14', 14, { 'digital', 'uart3_tx' });
retval.pins{end+1} = arduinoio.config.pin_info('D15', 15, { 'digital', 'uart3_rx' });
retval.pins{end+1} = arduinoio.config.pin_info('D16', 16, { 'digital', 'uart2_tx' });
retval.pins{end+1} = arduinoio.config.pin_info('D17', 17, { 'digital', 'uart2_rx' });
retval.pins{end+1} = arduinoio.config.pin_info('D18', 18, { 'digital', 'uart1_tx', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D19', 19, { 'digital', 'uart1_rx', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D20', 20, { 'digital', 'i2c_sda', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D21', 21, { 'digital', 'i2c_scl', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D22', 22, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D23', 23, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D24', 24, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D25', 25, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D26', 26, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D27', 27, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D28', 28, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D29', 29, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D30', 30, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D31', 31, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D32', 32, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D33', 33, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D34', 34, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D35', 35, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D36', 36, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D37', 37, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D38', 38, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D39', 39, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D40', 40, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D41', 41, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D42', 42, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D43', 43, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D44', 44, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D45', 45, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D46', 46, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D47', 47, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D48', 48, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D49', 49, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D50', 50, { 'digital', 'spi_miso' });
retval.pins{end+1} = arduinoio.config.pin_info('D51', 51, { 'digital', 'spi_mosi' });
retval.pins{end+1} = arduinoio.config.pin_info('D52', 52, { 'digital', 'spi_sck' });
retval.pins{end+1} = arduinoio.config.pin_info('D53', 53, { 'digital', 'spi_ss' });
retval.pins{end+1} = arduinoio.config.pin_info('A0', 54, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A1', 55, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A2', 56, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A3', 57, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A4', 58, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A5', 59, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A6', 60, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A7', 61, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A8', 62, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A9', 63, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A10', 64, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A11', 65, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A12', 66, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A13', 67, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A14', 68, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A15', 69, { 'digital', 'analog' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_micro.m 0000664 0000000 0000000 00000006571 15125212406 0026454 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2019 John Donoghue
##
## 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
## .
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} config_micro (@var{initdata})
## Private function for setting allowed modes of micro board pins
## @end deftypefn
function retval = config_micro (initdata)
retval = {};
# default board info - must be provided
# will be filled in on connection.
retval.board = 'micro';
retval.baudrate = 9600;
retval.mcu = '';
retval.voltref = 0;
retval.libs = {};
retval.port = '';
# info expected to be provided by config.
retval.description = 'Arduino Micro Board';
# pin config
retval.pins = {};
retval.pins{end+1} = arduinoio.config.pin_info('D0', 0, { 'digital', 'uart1_rx' });
retval.pins{end+1} = arduinoio.config.pin_info('D1', 1, { 'digital', 'uart1_tx' });
retval.pins{end+1} = arduinoio.config.pin_info('D2', 2, { 'digital', 'i2c_sda', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D3', 3, { 'digital', 'i2c_scl', 'interrupt', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D4', 4, { 'digital' }, {"A6"}); # share A6
retval.pins{end+1} = arduinoio.config.pin_info('D5', 5, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D6', 6, { 'digital', 'pwm' }, {"A7"}); # share A7
retval.pins{end+1} = arduinoio.config.pin_info('D7', 7, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D8', 8, { 'digital' }, {"A8"}); # share A8
retval.pins{end+1} = arduinoio.config.pin_info('D9', 9, { 'digital', 'pwm' }, {"A9"}); # share A9
retval.pins{end+1} = arduinoio.config.pin_info('D10', 10, { 'digital', 'pwm' }, {"A10"}); # share A10
retval.pins{end+1} = arduinoio.config.pin_info('D11', 11, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D12', 12, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D13', 13, { 'digital', 'led', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D14', 14, { 'digital', 'spi_miso' });
retval.pins{end+1} = arduinoio.config.pin_info('D15', 15, { 'digital', 'spi_sck' });
retval.pins{end+1} = arduinoio.config.pin_info('D16', 16, { 'digital', 'spi_mosi' });
retval.pins{end+1} = arduinoio.config.pin_info('D17', 17, { 'digital', 'spi_ss', 'led' });
retval.pins{end+1} = arduinoio.config.pin_info('A0', 18, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A1', 19, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A2', 20, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A3', 21, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A4', 22, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A5', 23, { 'digital', 'analog' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_mkr1000.m 0000664 0000000 0000000 00000005777 15125212406 0026444 0 ustar 00root root 0000000 0000000 # configuration generated from arduino/hardware/samd/1.8.11/variants/mkr1000/variant.h
function retval = config_mkr1000 (initdata)
retval = {};
# default board info - must be provided
# will be filled in on connection.
retval.board = '';
retval.baudrate = 9600;
retval.mcu = 'cortex-m0plus';
retval.voltref = 3.3;
retval.libs = {};
retval.port = '';
# info expected to be provided by config.
retval.description = 'MKR 1000 Board';
# pin config
retval.pins = {};
retval.pins{end+1} = arduinoio.config.pin_info('D0', 0, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D1', 1, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D2', 2, { 'digital', 'i2s_sck', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D3', 3, { 'digital', 'i2s_fs', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D4', 4, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D5', 5, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D6', 6, { 'digital', 'led', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D7', 7, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D8', 8, { 'digital', 'spi_mosi', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D9', 9, { 'digital', 'spi_sck' });
retval.pins{end+1} = arduinoio.config.pin_info('D10', 10, { 'digital', 'spi_miso', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D11', 11, { 'digital', 'i2c_sda' });
retval.pins{end+1} = arduinoio.config.pin_info('D12', 12, { 'digital', 'i2c_scl' });
retval.pins{end+1} = arduinoio.config.pin_info('D13', 13, { 'digital', 'uart1_rx' });
retval.pins{end+1} = arduinoio.config.pin_info('D14', 14, { 'digital', 'uart1_tx' });
retval.pins{end+1} = arduinoio.config.pin_info('A0', 15, { 'digital', 'analog', 'dac0' }, {"D15"});
retval.pins{end+1} = arduinoio.config.pin_info('A1', 16, { 'digital', 'analog', 'interrupt' }, {"D16"});
retval.pins{end+1} = arduinoio.config.pin_info('A2', 17, { 'digital', 'analog', 'interrupt' }, {"D17"});
retval.pins{end+1} = arduinoio.config.pin_info('A3', 18, { 'digital', 'analog', 'pwm' }, {"D18"});
retval.pins{end+1} = arduinoio.config.pin_info('A4', 19, { 'digital', 'analog', 'pwm' }, {"D19"});
retval.pins{end+1} = arduinoio.config.pin_info('A5', 20, { 'digital', 'analog' }, {"D20"});
retval.pins{end+1} = arduinoio.config.pin_info('A6', 21, { 'digital', 'analog' }, {"D21"});
retval.pins{end+1} = arduinoio.config.pin_info('D24', 24, { 'digital', 'spi_ss' });
# SPI connected to WINC1501B
retval.pins{end+1} = arduinoio.config.pin_info('D26', 26, { 'digital', 'spi1_mosi' });
retval.pins{end+1} = arduinoio.config.pin_info('D27', 27, { 'digital', 'spi1_sck' });
retval.pins{end+1} = arduinoio.config.pin_info('D28', 28, { 'digital', 'spi1_ss' });
retval.pins{end+1} = arduinoio.config.pin_info('D29', 29, { 'digital', 'spi1_miso' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_mkrzero.m 0000664 0000000 0000000 00000007236 15125212406 0027033 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2020 John Donoghue
##
## 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
## .
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} config_mkrzero (@var{initdata})
## Private function for setting allowed modes of mkrzero board pins
## @end deftypefn
# configuration generated from mkrzero/variant.h
function retval = config_mkrzero (initdata)
retval = {};
# default board info - must be provided
# will be filled in on connection.
retval.board = '';
retval.baudrate = 9600;
retval.mcu = 'cortex-m0plus';
retval.voltref = 3.3;
retval.libs = {};
retval.port = '';
# info expected to be provided by config.
retval.description = 'MKR Zero Board';
# pin config
retval.pins = {};
retval.pins{end+1} = arduinoio.config.pin_info('D0', 0, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D1', 1, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D2', 2, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D3', 3, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D4', 4, { 'digital', 'pwm', 'spi0_ss' });
retval.pins{end+1} = arduinoio.config.pin_info('D5', 5, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D6', 6, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D7', 7, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D8', 8, { 'digital', 'pwm', 'spi0_mosi' });
retval.pins{end+1} = arduinoio.config.pin_info('D9', 9, { 'digital', 'spi0_sck' });
retval.pins{end+1} = arduinoio.config.pin_info('D10', 10, { 'digital', 'pwm', 'spi0_miso' });
retval.pins{end+1} = arduinoio.config.pin_info('D11', 11, { 'digital', 'i2c_sda' });
retval.pins{end+1} = arduinoio.config.pin_info('D12', 12, { 'digital', 'pwm', 'i2c_scl' });
retval.pins{end+1} = arduinoio.config.pin_info('D13', 13, { 'digital', 'uart1_rx' });
retval.pins{end+1} = arduinoio.config.pin_info('D14', 14, { 'digital', 'uart1_tx' });
retval.pins{end+1} = arduinoio.config.pin_info('A0', 15, { 'digital', 'analog' }, {"D15"});
retval.pins{end+1} = arduinoio.config.pin_info('A1', 16, { 'digital', 'analog' }, {"D16"});
retval.pins{end+1} = arduinoio.config.pin_info('A2', 17, { 'digital', 'analog' }, {"D17"});
retval.pins{end+1} = arduinoio.config.pin_info('A3', 18, { 'digital', 'analog' }, {"D18"});
retval.pins{end+1} = arduinoio.config.pin_info('A4', 19, { 'digital', 'analog' }, {"D19"});
retval.pins{end+1} = arduinoio.config.pin_info('A5', 20, { 'digital', 'analog' }, {"D20"});
retval.pins{end+1} = arduinoio.config.pin_info('A6', 21, { 'digital', 'analog' }, {"D21"});
retval.pins{end+1} = arduinoio.config.pin_info('D26', 26, { 'digital', 'spi1_mosi' });
retval.pins{end+1} = arduinoio.config.pin_info('D27', 27, { 'digital', 'spi1_sck' });
retval.pins{end+1} = arduinoio.config.pin_info('D28', 28, { 'digital', 'spi1_ss' });
retval.pins{end+1} = arduinoio.config.pin_info('D29', 29, { 'digital', 'spi1_miso' });
retval.pins{end+1} = arduinoio.config.pin_info('D32', 32, { 'digital', 'led' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_nano.m 0000664 0000000 0000000 00000006310 15125212406 0026265 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2018 John Donoghue
##
## 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
## .
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} config_uno (@var{initdata})
## Private function for setting allowed modes of uno board pins
## @end deftypefn
# configuration generated from /usr/share/arduino/hardware/arduino/avr/variants/standard/pins_arduino.h
function retval = config_nano (initdata)
retval = [];
# default board info - must be provided
# will be filled in on connection
retval.board = "nano";
retval.baudrate = 9600;
retval.mcu = '';
retval.voltref = 50;
retval.libs = {};
retval.port = "";
# info expected to be provided by config.
retval.description = 'Arduino Nano Board';
# pin config
retval.pins = {};
retval.pins{end+1} = arduinoio.config.pin_info("D0", 0, { 'digital' , 'uart'});
retval.pins{end+1} = arduinoio.config.pin_info("D1", 1, { 'digital' , 'uart'});
retval.pins{end+1} = arduinoio.config.pin_info("D2", 2, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info("D3", 3, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info("D4", 4, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info("D5", 5, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info("D6", 6, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info("D7", 7, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info("D8", 8, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info("D9", 9, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info("D10", 10, { 'digital', 'pwm', 'spi0_ss' });
retval.pins{end+1} = arduinoio.config.pin_info("D11", 11, { 'digital', 'pwm', 'spi0_mosi' });
retval.pins{end+1} = arduinoio.config.pin_info("D12", 12, { 'digital', 'pwm', 'spi0_miso' });
retval.pins{end+1} = arduinoio.config.pin_info("D13", 13, { 'digital', 'pwm', 'spi0_sck', 'led' });
retval.pins{end+1} = arduinoio.config.pin_info("A0", 14, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info("A1", 15, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info("A2", 16, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info("A3", 17, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info("A4", 18, { 'digital', 'analog', 'i2c_sda' });
retval.pins{end+1} = arduinoio.config.pin_info("A5", 19, { 'digital', 'analog', 'i2c_scl' });
retval.pins{end+1} = arduinoio.config.pin_info("A6", 20, { 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info("A7", 21, { 'analog' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_nano_33_ble.m 0000664 0000000 0000000 00000006047 15125212406 0027423 0 ustar 00root root 0000000 0000000 # configuration generated from ARDUINO_NANO33BLE/pins_arduino.h
function retval = config_nano_33_ble (initdata)
retval = {};
# default board info - must be provided
# will be filled in on connection.
retval.board = 'nano_33_ble';
retval.baudrate = 9600;
retval.mcu = 'nRF52840';
retval.voltref = 0;
retval.libs = {};
retval.port = '';
# info expected to be provided by config.
retval.description = 'Arduino Nano 33 BLE';
# pin config
retval.pins = {};
retval.pins{end+1} = arduinoio.config.pin_info('D0', 0, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D1', 1, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D2', 2, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D3', 3, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D4', 4, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D5', 5, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D6', 6, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D7', 7, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D8', 8, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D9', 9, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D10', 10, { 'digital', 'spi_ss', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D11', 11, { 'digital', 'spi_mosi', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D12', 12, { 'digital', 'spi_miso', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D13', 13, { 'digital', 'led', 'spi_sck', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('A0', 14, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A1', 15, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A2', 16, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A3', 17, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A4', 18, { 'digital', 'analog', 'i2c0_sda' });
retval.pins{end+1} = arduinoio.config.pin_info('A5', 19, { 'digital', 'analog', 'i2c0_scl' });
retval.pins{end+1} = arduinoio.config.pin_info('A6', 20, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A7', 21, { 'digital', 'analog' });
# I/O tp on board chips
retval.pins{end+1} = arduinoio.config.pin_info('D26', 26, { 'interrupt' }); # APDS int
retval.pins{end+1} = arduinoio.config.pin_info('D27', 27, { 'digital' }); # PDM pwr
retval.pins{end+1} = arduinoio.config.pin_info('D28', 28, { 'digital' }); # PDM clk
retval.pins{end+1} = arduinoio.config.pin_info('D29', 29, { 'digital' }); # PDM din
retval.pins{end+1} = arduinoio.config.pin_info('D30', 30, { 'i2c1_sda' });
retval.pins{end+1} = arduinoio.config.pin_info('D31', 31, { 'i2c1_scl' });
retval.pins{end+1} = arduinoio.config.pin_info('D32', 32, { 'digital' }); # enable i2c pullup
retval.pins{end+1} = arduinoio.config.pin_info('D33', 33, { 'digital' }); # enable i2c 3.3v
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_nano_esp32.m 0000664 0000000 0000000 00000007033 15125212406 0027304 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2023 John Donoghue
##
## 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
## .
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} config_nano_esp32 (@var{initdata})
## Private function for setting allowed modes of nano esp32 board pins
## @end deftypefn
function retval = config_nano_esp32 (initdata)
retval = [];
# default board info - must be provided
# will be filled in on connection
retval.board = "nano_esp32";
retval.baudrate = 9600;
retval.mcu = '';
retval.voltref = 33;
retval.libs = {};
retval.port = "";
# info expected to be provided by config.
retval.description = 'Arduino Nano ESP32 Board';
# pin config
retval.pins = {};
retval.pins{end+1} = arduinoio.config.pin_info("D0", 0, { 'digital' , 'uart_rx'});
retval.pins{end+1} = arduinoio.config.pin_info("D1", 1, { 'digital' , 'uart_tx'});
retval.pins{end+1} = arduinoio.config.pin_info("D2", 2, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info("D3", 3, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info("D4", 4, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info("D5", 5, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info("D6", 6, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info("D7", 7, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info("D8", 8, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info("D9", 9, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info("D10", 10, { 'digital', 'pwm', 'spi0_ss', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info("D11", 11, { 'digital', 'pwm', 'spi0_mosi', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info("D12", 12, { 'digital', 'pwm', 'spi0_miso', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info("D13", 13, { 'digital', 'pwm', 'spi0_sck', 'led', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info("D14", 14, { 'digital', 'pwm', 'led_r', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info("D15", 15, { 'digital', 'pwm', 'led_g', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info("D16", 16, { 'digital', 'pwm', 'led_b', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info("A0", 17, { 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info("A1", 18, { 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info("A2", 19, { 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info("A3", 20, { 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info("A4", 21, { 'digital', 'analog', 'i2c_sda' });
retval.pins{end+1} = arduinoio.config.pin_info("A5", 22, { 'digital', 'analog', 'i2c_scl' });
retval.pins{end+1} = arduinoio.config.pin_info("A6", 23, { 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info("A7", 24, { 'analog' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_nano_every.m 0000664 0000000 0000000 00000006204 15125212406 0027501 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2019 John Donoghue
##
## 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
## .
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} config_every (@var{initdata})
## Private function for setting allowed modes of nano_every board pins
## @end deftypefn
function retval = config_nano_every (initdata)
retval = [];
# default board info - must be provided
# will be filled in on connection
retval.board = "nano_every";
retval.baudrate = 9600;
retval.mcu = '';
retval.voltref = 50;
retval.libs = {};
retval.port = "";
# info expected to be provided by config.
retval.description = 'Arduino Nano Every Board';
# pin config
retval.pins = {};
retval.pins{end+1} = arduinoio.config.pin_info("D0", 0, { 'digital' , 'uart1_tx'});
retval.pins{end+1} = arduinoio.config.pin_info("D1", 1, { 'digital' , 'uart1_rx'});
retval.pins{end+1} = arduinoio.config.pin_info("D2", 2, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info("D3", 3, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info("D4", 4, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info("D5", 5, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info("D6", 6, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info("D7", 7, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info("D8", 8, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info("D9", 9, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info("D10", 10, { 'digital', 'pwm', 'spi0_ss' });
retval.pins{end+1} = arduinoio.config.pin_info("D11", 11, { 'digital', 'spi0_mosi' });
retval.pins{end+1} = arduinoio.config.pin_info("D12", 12, { 'digital', 'spi0_miso' });
retval.pins{end+1} = arduinoio.config.pin_info("D13", 13, { 'digital', 'spi0_sck', 'led' });
retval.pins{end+1} = arduinoio.config.pin_info("A0", 14, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info("A1", 15, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info("A2", 16, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info("A3", 17, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info("A4", 18, { 'digital', 'analog', 'i2c_sda' });
retval.pins{end+1} = arduinoio.config.pin_info("A5", 19, { 'digital', 'analog', 'i2c_scl' });
retval.pins{end+1} = arduinoio.config.pin_info("A6", 20, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info("A7", 21, { 'digital', 'analog' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_nano_matter.m 0000664 0000000 0000000 00000006726 15125212406 0027654 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2025 John Donoghue
##
## 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
## .
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} config_nano_matter (@var{initdata})
## Private function for setting allowed modes of mano matter board pins
## @end deftypefn
function retval = config_nano_matter (initdata)
retval = {};
retval.board = 'nano_matter';
retval.baudrate = 9600;
retval.mcu = 'MGM240S';
retval.voltref = 3.3;
retval.libs = {};
retval.port = '';
# info expected to be provided by config.
retval.description = 'Arduino Nano Matter';
# pin config
retval.pins = {};
retval.pins{end+1} = arduinoio.config.pin_info('D0', 0, { 'digital', 'pwm', 'uart1_tx', 'spi1_mosi' });
retval.pins{end+1} = arduinoio.config.pin_info('D1', 1, { 'digital', 'pwm', 'uart1_rx', 'spi1_miso' });
retval.pins{end+1} = arduinoio.config.pin_info('D2', 2, { 'digital', 'pwm', 'spi_sck' });
retval.pins{end+1} = arduinoio.config.pin_info('D3', 3, { 'digital', 'pwm', 'spi1_ss' });
retval.pins{end+1} = arduinoio.config.pin_info('D4', 4, { 'digital', 'pwm', 'i2c1_sda' });
retval.pins{end+1} = arduinoio.config.pin_info('D5', 5, { 'digital', 'pwm', 'i2c1_scl' });
retval.pins{end+1} = arduinoio.config.pin_info('D6', 6, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D7', 7, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D8', 8, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D9', 9, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D10', 10, { 'digital', 'pwm', 'spi_ss' });
retval.pins{end+1} = arduinoio.config.pin_info('D11', 11, { 'digital', 'pwm', 'spi_mosi' });
retval.pins{end+1} = arduinoio.config.pin_info('D12', 12, { 'digital', 'pwm', 'spi_miso' });
retval.pins{end+1} = arduinoio.config.pin_info('D13', 13, { 'digital', 'pwm', 'spi_sck' });
retval.pins{end+1} = arduinoio.config.pin_info('A0', 14, { 'digital', 'analog', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('A1', 15, { 'digital', 'analog', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('A2', 16, { 'digital', 'analog', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('A3', 17, { 'digital', 'analog', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('A4', 18, { 'digital', 'analog', 'pwm', 'i2c_sda' });
retval.pins{end+1} = arduinoio.config.pin_info('A5', 19, { 'digital', 'analog', 'pwm', 'i2c_scl' });
retval.pins{end+1} = arduinoio.config.pin_info('A6', 20, { 'digital', 'analog', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('A7', 21, { 'digital', 'analog', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D22', 22, { 'digital', 'led' });
retval.pins{end+1} = arduinoio.config.pin_info('D23', 23, { 'digital', 'led1' });
retval.pins{end+1} = arduinoio.config.pin_info('D24', 24, { 'digital', 'led2' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_nano_r4.m 0000664 0000000 0000000 00000005357 15125212406 0026704 0 ustar 00root root 0000000 0000000 # configuration generated from NANOR4/pins_arduino.h
function retval = config_nano_r4 (initdata)
retval = {};
# default board info - must be provided
# will be filled in on connection.
retval.board = 'nano_r4';
retval.baudrate = 9600;
retval.mcu = 'RA4M1';
retval.voltref = 50;
retval.libs = {};
retval.port = '';
# info expected to be provided by config.
retval.description = 'Arduino Nano R4';
# pin config
retval.pins = {};
#retval.pins{end+1} = arduinoio.config.pin_info('D-1', -1, { 'digital', 'can0_stby' });
retval.pins{end+1} = arduinoio.config.pin_info('D0', 0, { 'digital', 'uart1_rx' });
retval.pins{end+1} = arduinoio.config.pin_info('D1', 1, { 'digital', 'uart1_tx' });
retval.pins{end+1} = arduinoio.config.pin_info('D2', 2, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D3', 3, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D4', 4, { 'digital', 'can0_tx' });
retval.pins{end+1} = arduinoio.config.pin_info('D5', 5, { 'digital', 'can0_rx', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D6', 6, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D7', 7, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D8', 8, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D9', 9, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D10', 10, { 'digital', 'spi_cs', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D11', 11, { 'digital', 'spi_mosi', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D12', 12, { 'digital', 'spi_miso' });
retval.pins{end+1} = arduinoio.config.pin_info('D13', 13, { 'digital', 'spi_sck' });
retval.pins{end+1} = arduinoio.config.pin_info('A0', 14, { 'digital', 'analog' }, 'd14');
retval.pins{end+1} = arduinoio.config.pin_info('A1', 15, { 'digital', 'analog' }, 'd15');
retval.pins{end+1} = arduinoio.config.pin_info('A2', 16, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A3', 17, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A4', 18, { 'digital', 'analog', 'i2c_sda' });
retval.pins{end+1} = arduinoio.config.pin_info('A5', 19, { 'digital', 'analog', 'i2c_scl' });
retval.pins{end+1} = arduinoio.config.pin_info('A6', 20, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A7', 21, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('D22', 22, { 'digital', 'led' });
retval.pins{end+1} = arduinoio.config.pin_info('D23', 23, { 'digital', 'led_red' });
retval.pins{end+1} = arduinoio.config.pin_info('D24', 24, { 'digital', 'led_green' });
retval.pins{end+1} = arduinoio.config.pin_info('D25', 25, { 'digital', 'led_blue' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_nano_rp2040_connect.m 0000664 0000000 0000000 00000006506 15125212406 0031014 0 ustar 00root root 0000000 0000000 # configuration generated from mbed_nano/2.4.1/variants/NANO_RP2040_CONNECT/pins_arduino.h
function retval = config_nano_rp2040_connect (initdata)
retval = {};
# default board info - must be provided
# will be filled in on connection.
retval.board = '';
retval.baudrate = 9600;
retval.mcu = 'cortex-m0plus';
retval.voltref = 0;
retval.libs = {};
retval.port = '';
# info expected to be provided by config.
retval.description = 'Arduino Nano RP2040 Connect';
# pin config
retval.pins = {};
retval.pins{end+1} = arduinoio.config.pin_info('D0', 0, { 'digital', 'uart_tx' });
retval.pins{end+1} = arduinoio.config.pin_info('D1', 1, { 'digital', 'uart_rx' });
retval.pins{end+1} = arduinoio.config.pin_info('D2', 2, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D3', 3, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D4', 4, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D5', 5, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D6', 6, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D7', 7, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D8', 8, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D9', 9, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D10', 10, { 'digital', 'spi_ss', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D11', 11, { 'digital', 'spi_mosi', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D12', 12, { 'digital', 'spi_miso', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D13', 13, { 'digital', 'led', 'spi_sck', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('A0', 14, { 'digital', 'analog', 'pwm', 'interrupt' }, {'D14'});
retval.pins{end+1} = arduinoio.config.pin_info('A1', 15, { 'digital', 'analog', 'pwm', 'interrupt' }, {'D15'});
retval.pins{end+1} = arduinoio.config.pin_info('A2', 16, { 'digital', 'analog', 'pwm', 'interrupt' }, {'D16'});
retval.pins{end+1} = arduinoio.config.pin_info('A3', 17, { 'digital', 'analog', 'pwm', 'interrupt' }, {'D17'});
retval.pins{end+1} = arduinoio.config.pin_info('D18', 18, { 'digital', 'i2c_sda', 'analog' }, {'A4'});
retval.pins{end+1} = arduinoio.config.pin_info('D19', 19, { 'digital', 'i2c_scl', 'analog' }, {'A5'});
retval.pins{end+1} = arduinoio.config.pin_info('A6', 20, { 'analog' }, {'D20'});
retval.pins{end+1} = arduinoio.config.pin_info('A7', 21, { 'analog' }, {'D21'});
#retval.pins{end+1} = arduinoio.config.pin_info('D22', 22, { 'digital', 'pdm_din', 'pwm', 'interrupt' });
#retval.pins{end+1} = arduinoio.config.pin_info('D23', 23, { 'digital', 'pdm_clk', 'pwm', 'interrupt' });
#retval.pins{end+1} = arduinoio.config.pin_info('D24', 24, { 'digital' });
#retval.pins{end+1} = arduinoio.config.pin_info('D25', 25, { 'digital' });
#retval.pins{end+1} = arduinoio.config.pin_info('D26', 26, { 'digital' });
#retval.pins{end+1} = arduinoio.config.pin_info('D27', 27, { 'digital' });
#retval.pins{end+1} = arduinoio.config.pin_info('D28', 28, { 'digital' });
#retval.pins{end+1} = arduinoio.config.pin_info('D29', 29, { 'digital' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_promicro.m 0000664 0000000 0000000 00000007070 15125212406 0027170 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2019-2021 John Donoghue
##
## 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
## .
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} config_promicro (@var{initdata})
## Private function for setting allowed modes of promicro board pins
## @end deftypefn
function retval = config_promicro (initdata)
retval = {};
# default board info - must be provided
# will be filled in on connection.
retval.board = 'promicro';
retval.baudrate = 9600;
retval.mcu = '';
retval.voltref = 0;
retval.libs = {};
retval.port = '';
# info expected to be provided by config.
retval.description = 'Arduino Pro Micro Board';
# pin config
retval.pins = {};
retval.pins{end+1} = arduinoio.config.pin_info('D0', 0, { 'digital', 'uart1_rx' });
retval.pins{end+1} = arduinoio.config.pin_info('D1', 1, { 'digital', 'uart1_tx' });
retval.pins{end+1} = arduinoio.config.pin_info('D2', 2, { 'digital', 'i2c_sda', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D3', 3, { 'digital', 'i2c_scl', 'interrupt', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D4', 4, { 'digital' }, {"A6"}); # share A6
retval.pins{end+1} = arduinoio.config.pin_info('D5', 5, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D6', 6, { 'digital', 'pwm' }, {"A7"}); # share A7
retval.pins{end+1} = arduinoio.config.pin_info('D7', 7, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D8', 8, { 'digital' }, {"A8"}); # share A8
retval.pins{end+1} = arduinoio.config.pin_info('D9', 9, { 'digital', 'pwm' }, {"A9"}); # share A9
retval.pins{end+1} = arduinoio.config.pin_info('D10', 10, { 'digital', 'pwm' }, {"A10"}); # share A10
# retval.pins{end+1} = arduinoio.config.pin_info('D11', 11, { 'digital', 'pwm' });
# retval.pins{end+1} = arduinoio.config.pin_info('D12', 12, { 'digital' });
# retval.pins{end+1} = arduinoio.config.pin_info('D13', 13, { 'digital', 'led', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D14', 14, { 'digital', 'spi_miso' });
retval.pins{end+1} = arduinoio.config.pin_info('D15', 15, { 'digital', 'spi_sck' });
retval.pins{end+1} = arduinoio.config.pin_info('D16', 16, { 'digital', 'spi_mosi' });
retval.pins{end+1} = arduinoio.config.pin_info('D17', 17, { 'digital', 'spi_ss', 'led' });
retval.pins{end+1} = arduinoio.config.pin_info('A0', 18, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A1', 19, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A2', 20, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A3', 21, { 'digital', 'analog' });
# retval.pins{end+1} = arduinoio.config.pin_info('A4', 22, { 'digital', 'analog' });
# retval.pins{end+1} = arduinoio.config.pin_info('A5', 23, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('D24', 24, { 'digital' }); # A6
retval.pins{end+1} = arduinoio.config.pin_info('D30', 30, { 'digital', 'led' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_promini.m 0000664 0000000 0000000 00000006656 15125212406 0027024 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2018 John Donoghue
##
## 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
## .
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} config_promini (@var{initdata})
## Private function for setting allowed modes of promini board pins
## @end deftypefn
function retval = config_promini (initdata)
retval = [];
# default board info - must be provided
# will be filled in on connection
retval.board = "promini";
retval.baudrate = 9600;
retval.mcu = '';
retval.voltref = 0;
retval.libs = {};
retval.port = "";
# info expected to be provided by config.
retval.description = 'Arduino Pro/Pro Mini Board';
# pin config
retval.pins = {};
#0=D0 RX
retval.pins{end+1} = arduinoio.config.pin_info("D0", 0, { 'digital' , 'uart'});
#1=D1 TX
retval.pins{end+1} = arduinoio.config.pin_info("D1", 1, { 'digital' , 'uart'});
#2=D2
retval.pins{end+1} = arduinoio.config.pin_info("D2", 2, { 'digital', 'interrupt' });
#3=D3 PWM
retval.pins{end+1} = arduinoio.config.pin_info("D3", 3, { 'digital', 'pwm', 'interrupt' });
#4=D4
retval.pins{end+1} = arduinoio.config.pin_info("D4", 4, { 'digital' });
#5=D5 PWM
retval.pins{end+1} = arduinoio.config.pin_info("D5", 5, { 'digital', 'pwm' });
#6=D6 PWM
retval.pins{end+1} = arduinoio.config.pin_info("D6", 6, { 'digital', 'pwm' });
#7=D7
retval.pins{end+1} = arduinoio.config.pin_info("D7", 7, { 'digital' });
#8=D8
retval.pins{end+1} = arduinoio.config.pin_info("D8", 8, { 'digital' });
#9=D9 PWM
retval.pins{end+1} = arduinoio.config.pin_info("D9", 9, { 'digital', 'pwm' });
#10=D10 PWM SS
retval.pins{end+1} = arduinoio.config.pin_info("D10", 10, { 'digital', 'pwm', 'spi0_ss' });
#11=D11 PWM MOSI
retval.pins{end+1} = arduinoio.config.pin_info("D11", 11, { 'digital', 'pwm', 'spi0_mosi' });
#12=D12 MISO
retval.pins{end+1} = arduinoio.config.pin_info("D12", 12, { 'digital', 'pwm', 'spi0_miso' });
#13=D13 SCK LED
retval.pins{end+1} = arduinoio.config.pin_info("D13", 13, { 'digital', 'pwm', 'spi0_sck', 'led' });
#14=D14 A0
retval.pins{end+1} = arduinoio.config.pin_info("A0", 14, { 'digital', 'analog' });
#15=D15 A1
retval.pins{end+1} = arduinoio.config.pin_info("A1", 15, { 'digital', 'analog' });
#16=D16 A2
retval.pins{end+1} = arduinoio.config.pin_info("A2", 16, { 'digital', 'analog' });
#17=D17 A3
retval.pins{end+1} = arduinoio.config.pin_info("A3", 17, { 'digital', 'analog' });
#18=D18 A4 I2C_SDA
retval.pins{end+1} = arduinoio.config.pin_info("A4", 18, { 'digital', 'analog', 'i2c_sda' });
#19=D19 A5 I2C_SCL
retval.pins{end+1} = arduinoio.config.pin_info("A5", 19, { 'digital', 'analog', 'i2c_scl' });
#20=D20 A6
retval.pins{end+1} = arduinoio.config.pin_info("A6", 20, { 'digital', 'analog' });
#21=D21 A7
retval.pins{end+1} = arduinoio.config.pin_info("A7", 21, { 'digital', 'analog' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_raspi_pico.m 0000664 0000000 0000000 00000005522 15125212406 0027466 0 ustar 00root root 0000000 0000000 # raspi pico 2040
# configuration generated from mbed_rp2040/2.2.0/variants/RASPBERRY_PI_PICO/pins_arduino.h
function retval = config_raspi_pico (initdata)
retval = {};
# default board info - must be provided
# will be filled in on connection.
retval.board = '';
retval.baudrate = 9600;
retval.mcu = 'cortex-m0plus';
retval.voltref = 0;
retval.libs = {};
retval.port = '';
# info expected to be provided by config.
retval.description = 'Raspberry Pi Pico';
# pin config
retval.pins = {};
retval.pins{end+1} = arduinoio.config.pin_info('D0', 0, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D1', 1, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D2', 2, { 'digital', 'spi_sck' });
retval.pins{end+1} = arduinoio.config.pin_info('D3', 3, { 'digital', 'spi_mosi' });
retval.pins{end+1} = arduinoio.config.pin_info('D4', 4, { 'digital', 'spi_miso' });
retval.pins{end+1} = arduinoio.config.pin_info('D5', 5, { 'digital', 'spi_ss' });
retval.pins{end+1} = arduinoio.config.pin_info('D6', 6, { 'digital', 'i2c_sda' });
retval.pins{end+1} = arduinoio.config.pin_info('D7', 7, { 'digital', 'i2c_scl' });
retval.pins{end+1} = arduinoio.config.pin_info('D8', 8, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D9', 9, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D10', 10, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D11', 11, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D12', 12, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D13', 13, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D14', 14, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D15', 15, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D16', 16, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D17', 17, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D18', 18, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D19', 19, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D20', 20, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D21', 21, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D22', 22, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D23', 23, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D24', 24, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D25', 25, { 'digital','led' });
retval.pins{end+1} = arduinoio.config.pin_info('A0', 26, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A1', 27, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A2', 28, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A3', 29, { 'digital', 'analog' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_sparkfunsamd21.m 0000664 0000000 0000000 00000007247 15125212406 0030205 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2018 John Donoghue
##
## 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
## .
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} config_sparkfunsamd21 (@var{initdata})
## Private function for setting allowed modes of sparkfun samd21 mini/dev board pins
## @end deftypefn
function retval = config_sparkfunsamd21 (initdata)
retval = {};
# default board info - must be provided
# will be filled in on connection.
retval.board = '';
retval.baudrate = 9600;
retval.mcu = 'samd21';
retval.voltref = 3.3;
retval.libs = {};
retval.port = '';
# info expected to be provided by config.
retval.description = 'Sparkfun SAMD21 Dev/Mini Board';
# pin config
retval.pins = {};
retval.pins{end+1} = arduinoio.config.pin_info('D0', 0, { 'digital', 'i2s_fs', 'uart', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D1', 1, { 'digital', 'i2s_sck', 'uart', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D2', 2, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D3', 3, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D4', 4, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D5', 5, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D6', 6, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D7', 7, { 'digital', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D8', 8, { 'digital', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D9', 9, { 'digital', 'i2s_sd', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D10', 10, { 'digital', 'spi_ss', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D11', 11, { 'digital', 'spi_mosi', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D12', 12, { 'digital', 'spi_miso', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D13', 13, { 'digital', 'led_13', 'spi_sck', 'pwm', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('A0', 14, { 'digital', 'analog', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('A1', 15, { 'digital', 'analog', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('A2', 16, { 'digital', 'analog', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('A3', 17, { 'digital', 'analog', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('A4', 18, { 'digital', 'analog', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('A5', 19, { 'digital', 'analog', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D20', 20, { 'digital', 'i2c_sda', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D21', 21, { 'digital', 'i2c_scl', 'interrupt' });
# pins 22-24 ??
retval.pins{end+1} = arduinoio.config.pin_info('D25', 25, { 'digital', 'led_rxl', 'interrupt' });
retval.pins{end+1} = arduinoio.config.pin_info('D26', 26, { 'digital', 'led_txl', 'interrupt' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_uno.m 0000664 0000000 0000000 00000006400 15125212406 0026133 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2018 John Donoghue
##
## 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
## .
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} config_uno (@var{initdata})
## Private function for setting allowed modes of uno board pins
## @end deftypefn
function retval = config_uno (initdata)
retval = [];
# default board info - must be provided
# will be filled in on connection
retval.board = "uno";
retval.baudrate = 9600;
retval.mcu = '';
retval.voltref = 0;
retval.libs = {};
retval.port = "";
# info expected to be provided by config.
retval.description = 'Arduino Uno R3 Board';
# pin config
retval.pins = {};
#0=D0 RX
retval.pins{end+1} = arduinoio.config.pin_info("D0", 0, { 'digital' , 'uart'});
#1=D1 TX
retval.pins{end+1} = arduinoio.config.pin_info("D1", 1, { 'digital' , 'uart'});
#2=D2
retval.pins{end+1} = arduinoio.config.pin_info("D2", 2, { 'digital', 'interrupt' });
#3=D3 PWM
retval.pins{end+1} = arduinoio.config.pin_info("D3", 3, { 'digital', 'pwm', 'interrupt' });
#4=D4
retval.pins{end+1} = arduinoio.config.pin_info("D4", 4, { 'digital' });
#5=D5 PWM
retval.pins{end+1} = arduinoio.config.pin_info("D5", 5, { 'digital', 'pwm' });
#6=D6 PWM
retval.pins{end+1} = arduinoio.config.pin_info("D6", 6, { 'digital', 'pwm' });
#7=D7
retval.pins{end+1} = arduinoio.config.pin_info("D7", 7, { 'digital' });
#8=D8
retval.pins{end+1} = arduinoio.config.pin_info("D8", 8, { 'digital' });
#9=D9 PWM
retval.pins{end+1} = arduinoio.config.pin_info("D9", 9, { 'digital', 'pwm' });
#10=D10 PWM SS
retval.pins{end+1} = arduinoio.config.pin_info("D10", 10, { 'digital', 'pwm', 'spi0_ss' });
#11=D11 PWM MOSI
retval.pins{end+1} = arduinoio.config.pin_info("D11", 11, { 'digital', 'pwm', 'spi0_mosi' });
#12=D12 MISO
retval.pins{end+1} = arduinoio.config.pin_info("D12", 12, { 'digital', 'pwm', 'spi0_miso' });
#13=D13 SCK LED
retval.pins{end+1} = arduinoio.config.pin_info("D13", 13, { 'digital', 'pwm', 'spi0_sck', 'led' });
#14=D14 A0
retval.pins{end+1} = arduinoio.config.pin_info("A0", 14, { 'digital', 'analog' });
#15=D15 A1
retval.pins{end+1} = arduinoio.config.pin_info("A1", 15, { 'digital', 'analog' });
#16=D16 A2
retval.pins{end+1} = arduinoio.config.pin_info("A2", 16, { 'digital', 'analog' });
#17=D17 A3
retval.pins{end+1} = arduinoio.config.pin_info("A3", 17, { 'digital', 'analog' });
#18=D18 A4 I2C_SDA
retval.pins{end+1} = arduinoio.config.pin_info("A4", 18, { 'digital', 'analog', 'i2c_sda' });
#19=D19 A5 I2C_SCL
retval.pins{end+1} = arduinoio.config.pin_info("A5", 19, { 'digital', 'analog', 'i2c_scl' });
# additionals ?
#20=D20 A6
#21=D21 A7
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_uno_minima_r4.m 0000664 0000000 0000000 00000004254 15125212406 0030077 0 ustar 00root root 0000000 0000000
function retval = config_uno_minima_r4 (initdata)
retval = {};
retval.board = 'uno_minima_r4';
retval.baudrate = 9600;
retval.mcu = '';
retval.voltref = 0;
retval.libs = {};
retval.port = '';
# info expected to be provided by config.
retval.description = 'Arduino Uno Minima R4 Board';
# pin config
retval.pins = {};
retval.pins{end+1} = arduinoio.config.pin_info('D0', 0, { 'digital', 'uart_rx' });
retval.pins{end+1} = arduinoio.config.pin_info('D1', 1, { 'digital', 'uart_tx' });
retval.pins{end+1} = arduinoio.config.pin_info('D2', 2, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D3', 3, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D4', 4, { 'digital', 'can0_tx' });
retval.pins{end+1} = arduinoio.config.pin_info('D5', 5, { 'digital', 'can0_rx', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D6', 6, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D7', 7, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D8', 8, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D9', 9, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D10', 10, { 'digital', 'spi_ss', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D11', 11, { 'digital', 'spi_mosi', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D12', 12, { 'digital', 'spi_miso' });
retval.pins{end+1} = arduinoio.config.pin_info('D13', 13, { 'digital', 'led', 'spi_sck' });
retval.pins{end+1} = arduinoio.config.pin_info('A0', 14, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A1', 15, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A2', 16, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A3', 17, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A4', 18, { 'digital', 'analog', 'i2c_sda' });
retval.pins{end+1} = arduinoio.config.pin_info('A5', 19, { 'digital', 'analog' 'i2c_scl' });
retval.pins{end+1} = arduinoio.config.pin_info('D20', 20, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D21', 21, { 'digital' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_uno_wifi_r2.m 0000664 0000000 0000000 00000010612 15125212406 0027554 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2018 John Donoghue
##
## 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
## .
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} config_uno_wifi_r2 (@var{initdata})
## Private function for setting allowed modes of uno board pins
## @end deftypefn
function retval = config_uno_wifi_r2 (initdata)
retval = [];
# default board info - must be provided
# will be filled in on connection
retval.board = "uno_wifi_r2";
retval.baudrate = 9600;
retval.mcu = '';
retval.voltref = 0;
retval.libs = {};
retval.port = "";
# info expected to be provided by config.
retval.description = 'Arduino Uno WIFI R2 Board';
# pin config
retval.pins = {};
#0=D0 RX
retval.pins{end+1} = arduinoio.config.pin_info("D0", 0, { 'digital' , 'uart'});
#1=D1 TX
retval.pins{end+1} = arduinoio.config.pin_info("D1", 1, { 'digital' , 'uart'});
#2=D2
retval.pins{end+1} = arduinoio.config.pin_info("D2", 2, { 'digital', 'interrupt' });
#3=D3 PWM
retval.pins{end+1} = arduinoio.config.pin_info("D3", 3, { 'digital', 'pwm', 'interrupt' });
#4=D4
retval.pins{end+1} = arduinoio.config.pin_info("D4", 4, { 'digital', 'interrupt' });
#5=D5 PWM
retval.pins{end+1} = arduinoio.config.pin_info("D5", 5, { 'digital', 'pwm', 'interrupt' });
#6=D6 PWM
retval.pins{end+1} = arduinoio.config.pin_info("D6", 6, { 'digital', 'pwm', 'interrupt' });
#7=D7
retval.pins{end+1} = arduinoio.config.pin_info("D7", 7, { 'digital', 'interrupt' });
#8=D8
retval.pins{end+1} = arduinoio.config.pin_info("D8", 8, { 'digital', 'interrupt' });
#9=D9 PWM
retval.pins{end+1} = arduinoio.config.pin_info("D9", 9, { 'digital', 'pwm', 'interrupt' });
#10=D10 PWM SS
retval.pins{end+1} = arduinoio.config.pin_info("D10", 10, { 'digital', 'pwm', 'interrupt' });
#11=D11
retval.pins{end+1} = arduinoio.config.pin_info("D11", 11, { 'digital', 'interrupt' });
#12=D12
retval.pins{end+1} = arduinoio.config.pin_info("D12", 12, { 'digital', 'interrupt' });
#13=D13
retval.pins{end+1} = arduinoio.config.pin_info("D13", 13, { 'digital', 'interrupt' });
#14=D14 A0
retval.pins{end+1} = arduinoio.config.pin_info("A0", 14, { 'digital', 'analog', 'interrupt' }, {"D14"});
#15=D15 A1
retval.pins{end+1} = arduinoio.config.pin_info("A1", 15, { 'digital', 'analog', 'interrupt' }, {"D15"});
#16=D16 A2
retval.pins{end+1} = arduinoio.config.pin_info("A2", 16, { 'digital', 'analog', 'interrupt' }, {"D16"});
#17=D17 A3
retval.pins{end+1} = arduinoio.config.pin_info("A3", 17, { 'digital', 'analog', 'interrupt' }, {"D17"});
#18=D18 A4 I2C_SDA
retval.pins{end+1} = arduinoio.config.pin_info("A4", 18, { 'digital', 'analog', 'interrupt' }, {"D18"});
#19=D19 A5 I2C_SCL
retval.pins{end+1} = arduinoio.config.pin_info("A5", 19, { 'digital', 'analog', 'interrupt' }, {"D19"});
# additionals ?
#20=D20
retval.pins{end+1} = arduinoio.config.pin_info("D20", 20, { 'i2c_sda' });
#21=D21
retval.pins{end+1} = arduinoio.config.pin_info("D21", 21, { 'i2c_scl' });
retval.pins{end+1} = arduinoio.config.pin_info("D22", 22, { 'digital', 'spi0_ss' });
#25=D25
retval.pins{end+1} = arduinoio.config.pin_info("D25", 25, { 'digital', 'led' });
#26=D26
#retval.pins{end+1} = arduinoio.config.pin_info("D26", 26, { 'digital'});
#30=D30
retval.pins{end+1} = arduinoio.config.pin_info("D30", 30, { 'digital', 'imu_ss'});
#32=D32
retval.pins{end+1} = arduinoio.config.pin_info("D32", 32, { 'digital', 'spi0_mosi' });
#33=D33
retval.pins{end+1} = arduinoio.config.pin_info("D33", 33, { 'digital', 'spi0_miso' });
#34=D34
retval.pins{end+1} = arduinoio.config.pin_info("D34", 34, { 'digital', 'spi0_sck' });
#35=D35
retval.pins{end+1} = arduinoio.config.pin_info("D35", 35, { 'digital', 'wifi_ss' });
#39=D39
retval.pins{end+1} = arduinoio.config.pin_info("D39", 39, { 'digital' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/config_uno_wifi_r4.m 0000664 0000000 0000000 00000007000 15125212406 0027553 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2023 John Donoghue
##
## 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
## .
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} config_uno_wifi_r4 (@var{initdata})
## Private function for setting allowed modes of uno board pins
## @end deftypefn
function retval = config_uno_wifi_r4 (initdata)
retval = {};
retval.board = 'uno_wifi_r4';
retval.mcu = 'Renesis RA4M1';
retval.baudrate = 9600;
retval.voltref = 0;
retval.libs = {};
retval.port = '';
# info expected to be provided by config.
retval.description = 'Arduino Uno WIFI R4 Board';
# pin config
retval.pins = {};
retval.pins{end+1} = arduinoio.config.pin_info('D0', 0, { 'digital', 'uart2_tx' });
retval.pins{end+1} = arduinoio.config.pin_info('D1', 1, { 'digital', 'uart2_rx' });
retval.pins{end+1} = arduinoio.config.pin_info('D2', 2, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D3', 3, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D4', 4, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D5', 5, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D6', 6, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D7', 7, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D8', 8, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D9', 9, { 'digital', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D10', 10, { 'digital', 'spi_ss', 'can0_tx', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D11', 11, { 'digital', 'spi_mosi', 'pwm' });
retval.pins{end+1} = arduinoio.config.pin_info('D12', 12, { 'digital', 'spi_miso' });
retval.pins{end+1} = arduinoio.config.pin_info('D13', 13, { 'digital', 'led', 'spi_sck', 'can0_rx' });
retval.pins{end+1} = arduinoio.config.pin_info('A0', 14, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A1', 15, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A2', 16, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A3', 17, { 'digital', 'analog' });
retval.pins{end+1} = arduinoio.config.pin_info('A4', 18, { 'digital', 'analog', 'i2c_sda' });
retval.pins{end+1} = arduinoio.config.pin_info('A5', 19, { 'digital', 'analog', 'i2c_scl' });
retval.pins{end+1} = arduinoio.config.pin_info('D20', 20, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D21', 21, { 'digital' });
retval.pins{end+1} = arduinoio.config.pin_info('D22', 22, { 'uart1_tx' });
retval.pins{end+1} = arduinoio.config.pin_info('D23', 23, { 'uart1_rx' });
retval.pins{end+1} = arduinoio.config.pin_info('D24', 24, { 'uart3_tx' });
retval.pins{end+1} = arduinoio.config.pin_info('D25', 25, { 'uart3_rx' });
retval.pins{end+1} = arduinoio.config.pin_info('D26', 26, { 'i2c1_scl' });
retval.pins{end+1} = arduinoio.config.pin_info('D27', 27, { 'i2c1_sda' });
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/+config/pin_info.m 0000664 0000000 0000000 00000001744 15125212406 0025614 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2018 John Donoghue
##
## 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. see
## .
## -*- texinfo -*-
## @deftypefn {} {@var{value} =} pin_info (@var{name})
## Private function
## @end deftypefn
function retval = pin_info (name, id, modes, alt)
retval = [];
if (nargin < 4)
alt = {};
endif
retval.name = lower(name);
retval.id = id;
retval.modes = lower(modes);
retval.owner = "";
retval.mode = "unset";
retval.altnames = lower(alt);
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/AddonBase.m 0000664 0000000 0000000 00000003504 15125212406 0024307 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2018 John Donoghue
##
## 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
## .
classdef AddonBase < handle
## -*- texinfo -*-
## @deftypefn {} {} arduinoio.AddonBase
## Base class used for arduino library sensors
##
## @seealso{arduinoio.LibraryBase}
## @end deftypefn
##
## @subheading Properties
## Base properties are expected to be inherited and overwritten in inherited classes.
## and are constant in order to query through the metaobject mechanism.
##
## @var{Parent} - parent librarybase object
##
## @subheading Methods
## @deftypefn {} {@var{ab} =} AddonBase ()
## Constructor of base class
##
## @subsubheading Outputs
## The return value @var{ab} is an object of the arduinio.AddonBase class.
##
## @seealso{arduino, addon}
## @end deftypefn
##
## @deftypefn {} {} disp ()
## Display the addon in a verbose way.
## @end deftypefn
# properties that may be overridden in
# subclasses
properties (GetAccess = public, SetAccess = protected)
Parent = {};
endproperties
methods (Access=public)
# display the base class properties
function disp(this)
printf(" addon %s\n", class(this));
endfunction
endmethods
endclassdef
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/FilePath.m 0000664 0000000 0000000 00000002156 15125212406 0024165 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2018 John Donoghue
##
## 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
## .
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} arduinoio.FilePath (@var{fullpathname})
## Get the directory component of a pathname.
##
## @subsubheading Inputs
## @var{fullpathname} filepath to get directory component of.
##
## @subsubheading Outputs
## @var{retval} the directory part of the filename.
## @end deftypefn
function path = FilePath(fullpathname)
path = fileparts(fullpathname);
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/LibFiles.m 0000664 0000000 0000000 00000002340 15125212406 0024155 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2018 John Donoghue
##
## 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
## .
## -*- texinfo -*-
## @deftypefn {} {@var{filelist} =} arduinoio.LibFiles ()
## Get the list of files used for the building arduino library
## @subsubheading Outputs
## @var{filelist} - string cell array of files for the arduino project
## @end deftypefn
function files = LibFiles()
files = {};
script = mfilename('fullpath');
[path,~] = fileparts(script);
filelist = dir(fullfile(path, "lib", "*.*"));
for i=1:numel(filelist)
files{end+1} = fullfile(fullfile(path, "lib"), filelist(i).name);
endfor
endfunction
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/LibraryBase.m 0000664 0000000 0000000 00000010151 15125212406 0024662 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2018-2019 John Donoghue
##
## 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
## .
classdef LibraryBase < handle
## -*- texinfo -*-
## @deftypefn {} {} arduinoio.LibraryBase
## Base class used for arduino library plugins
##
## @seealso{arduino, listArduinoLibraries, addon}
## @end deftypefn
##
## @subheading Properties
## Base properties are expected to be inherited and overwritten in
## inherited classes and are constant in order to query through the
## metaobject mechanism.
##
## @var{LibraryName} - name of the addon library
##
## @var{DependentLibraries} - array of dependent library names that
## must be included when installing this plugin.
##
## @var{CppHeaderFile} - name (if any) of header file that will be
## included into the arduino project when adding this library.
##
## @var{CppSourceFile} - name (if any) of source file that will be
## included into the arduino project when adding this library.
##
## @var{CppClassName} - name of the cpp class for the addon library.
## project when adding this library.
##
## @var{Pins} - pins allocated to the addon
##
## @var{Parent} - parent arduino object.
##
## @subheading Methods
## @deftypefn {} {@var{lb} =} LibraryBase ()
## Constructor of base class
##
## The constructor is usually not called but called indirectly
## from the addon function.
##
## @subsubheading Outputs
## The return value @var{lb} is an object of the arduinio.LibraryBase class.
##
## @seealso{arduino, listArduinoLibraries, addon}
## @end deftypefn
##
## @deftypefn {} {} disp ()
## Display the addon in a verbose way.
## @end deftypefn
# properties that may be overridden in
# subclasses
properties (Access = protected)
LibraryName = "";
DependentLibraries = {};
ArduinoLibraryHeaderFiles = {};
CppHeaderFile = "";
CppSourceFile = "";
CppClassName = "";
endproperties
properties (GetAccess = public, SetAccess = protected)
Parent = {};
Pins = [];
endproperties
methods (Static)
function info = AddonInfo(fullclassname)
info = {};
info.libraryname = "";
info.dependentlibraries = "";
info.cppheaderfile = "";
info.cppsourcefile = "";
info.cppclassname = "";
info.arduinolibraryheaderfiles = "";
data = meta.class.fromName(fullclassname);
for ic = 1:numel(data.Properties)
p = data.Properties{ic};
if p.Constant
pname = lower(p.Name);
pvalue = p.DefaultValue;
if isfield(info, pname)
info.(pname) = pvalue;
endif
endif
endfor
info.classname = data.Name;
endfunction
endmethods
methods (Access=public)
# display the base class properties
function disp(this)
printf(" %s with properties\n", class(this));
if numel(this.Pins) == 0
printf(" Pins = {}\n");
else
printf(" Pins = {\n");
for i=1:numel(this.Pins)
if isnumeric(this.Pins{i})
printf(" %d\n", this.Pins{i});
else
printf(" %s\n", this.Pins{i});
endif
endfor
printf(" }\n");
endif
endfunction
# overrides of arduino that matlab documentation indirectly
# seems to indicate in the examples
function [dataout, datasize] = sendCommand(this, varargin)
[dataout, datasize] = sendCommand(this.Parent, varargin{:})
endfunction
endmethods
endclassdef
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/boardTypeString.m 0000664 0000000 0000000 00000004301 15125212406 0025603 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2018-2021 John Donoghue
##
## 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. see
## .
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} __boardTypeString__ (@var{type})
## Helper function to set convert board id to a (lowercase) string
## @end deftypefn
function retval = boardTypeString (id)
if nargin != 1
error ('expected id');
endif
if ~isnumeric (id)
error ('expected id as a number');
endif
if ischar (id)
id = int (id);
endif
switch (id)
case 0
retval = "uno";
case 1
retval = "mega2560";
case 2
retval = "nano";
case 5
retval = "uno_wifi_r2";
case 6
retval = "nano_every";
case 10
retval = "lilypad";
case 20
retval = "promini";
case 21
retval = "promicro";
case 22
retval = "leonardo";
case 23
retval = "micro";
#case 40
# retval = "zero";
case 41
retval = "sparkfunsamd21";
case 45
retval = "due";
case 50
retval = "mkrzero";
case 51
retval = "mkr1000";
case 60
retval = "nano_33_ble";
case 65
retval = "nano_matter";
case 100
retval = "raspi_pico";
case 101
retval = "nano_rp2040_connect";
case 102
retval = "nano_esp32";
case 111
retval = "esp32_dev";
case 112
retval = "uno_wifi_r4";
case 113
retval = "nano_r4";
case 114
retval = "uno_minima_r4";
otherwise
retval = "unknown";
endswitch
endfunction
%!test
%! assert(arduinoio.boardTypeString (0), "uno")
%! assert(arduinoio.boardTypeString (1), "mega2560")
%! assert(arduinoio.boardTypeString (10), "lilypad")
%! assert(arduinoio.boardTypeString (-1), "unknown")
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/getBoardConfig.m 0000664 0000000 0000000 00000002720 15125212406 0025343 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2018 John Donoghue
##
## 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
## .
## -*- texinfo -*-
## @deftypefn {} {@var{retval} =} arduinoio.getBoardConfig (@var{boardname})
## Return the configuration for a known arduino board type
##
## Function is used to get the expected pin/board configuration for a named board type
## which is used to verify and identify the functionality of the board.
##
## @subsubheading Inputs
## @var{boardname} - name of board to get configuration of ie: "uno"
##
## @subsubheading Outputs
## @var{retval} configuration struct.
## @end deftypefn
function config = getBoardConfig (board)
if strcmp(board, "unknown")
error ("unknown board found type");
endif
config = eval(sprintf("arduinoio.config.config_%s", board));
endfunction
%!test
%! c = arduinoio.getBoardConfig("uno");
%! assert(c.board, "uno");
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/ 0000775 0000000 0000000 00000000000 15125212406 0023055 5 ustar 00root root 0000000 0000000 gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/LibraryBase.cpp 0000664 0000000 0000000 00000022521 15125212406 0025762 0 ustar 00root root 0000000 0000000 /*
* Octave arduino base library
* Copyright (C) 2018 John Donoghue
*
* 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 .
*/
#include "LibraryBase.h"
#include
#include "settings.h"
#define ARDUINO_SOH 0xA5
#define STATE_SOH 0
#define STATE_EXT 1
#define STATE_CMD 2
#define STATE_SIZE 3
#define STATE_DATA 4
#define STATE_EOM 5
#if defined(OCTAVE_USE_WIFI_COMMS)
# if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_RENESAS)
#include
# else
#include
# endif
char wifi_ssid[] = WIFI_SECRET_SSID; // your network SSID (name)
char wifi_pass[] = WIFI_SECRET_PASS;
int wifi_status = WL_IDLE_STATUS;
WiFiServer wifiServer(WIFI_PORT);
WiFiClient wifi_client;
#endif
#ifndef ARDUINO_BAUDRATE
# define ARDUINO_BAUDRATE 9600
#endif
// some standard(ish) error messages used throughout the addons
const char ERRORMSG_INVALID_NUMBER_OF_ARGS[] PROGMEM = "Invalid number of args";
const char ERRORMSG_UNIMPLEMENTED[] PROGMEM = "Unimplemented feature";
const char ERRORMSG_INVALID_ARGS[] PROGMEM = "Invalid args";
const char ERRORMSG_INVALID_MODE[] PROGMEM = "Invalid mode";
const char ERRORMSG_INVALID_PIN[] PROGMEM = "Invalid pin";
const char ERRORMSG_INVALID_DEVICE[] PROGMEM = "Invalid device id";
static const char ERRORMSG_UNKNOWN_CMDID[] PROGMEM = "Unknown cmdID";
const char *
OctaveLibraryBase::getLibraryName () const
{
return libName.c_str ();
}
void
OctaveLibraryBase::setup ()
{
}
void
OctaveLibraryBase::loop ()
{
}
void OctaveLibraryBase::commandHandler(byte cmdID, byte* inputs, unsigned int payload_size)
{
commandHandler((uint8_t)cmdID, (uint8_t*)inputs, (uint8_t)payload_size);
}
void OctaveLibraryBase::commandHandler(uint8_t cmdID, uint8_t* inputs, uint8_t payload_size)
{
sendErrorMsg_P(ERRORMSG_UNIMPLEMENTED);
}
void
OctaveLibraryBase::sendResponseMsg (uint8_t cmdID, const uint8_t *data, uint8_t sz)
{
#if defined(OCTAVE_USE_WIFI_COMMS)
if(wifi_status == 1)
{
wifi_client.write ((uint8_t)ARDUINO_SOH);
wifi_client.write ((uint8_t)id);
wifi_client.write (cmdID);
wifi_client.write (sz);
if(sz)
{
wifi_client.write (data, sz);
}
}
#else
OCTAVE_COMMS_PORT.write ((uint8_t)ARDUINO_SOH);
OCTAVE_COMMS_PORT.write ((uint8_t)id);
OCTAVE_COMMS_PORT.write (cmdID);
OCTAVE_COMMS_PORT.write (sz);
if(sz)
{
OCTAVE_COMMS_PORT.write (data, sz);
}
// flush appears to lockup port in some devices
//OCTAVE_COMMS_PORT.flush ();
#endif
}
void
OctaveLibraryBase::sendWaitMsg ()
{
sendResponseMsg (ARDUINO_WAIT, NULL, 0);
}
void
OctaveLibraryBase::sendErrorMsg (const char *err)
{
// work out len to max 200
int len = 0;
while(err[len] != '\0' && len < 200) len++;
sendResponseMsg (ARDUINO_ERROR, (uint8_t *)err, len);
}
void
OctaveLibraryBase::debugPrint (const char *err, ...)
{
char buffer[201];
va_list args;
va_start (args, err);
vsnprintf (buffer,200,err, args);
va_end (args);
// work out len to max 200
int len = 0;
while(buffer[len] != '\0' && len < 200) len++;
sendResponseMsg (ARDUINO_DEBUG, (uint8_t *)buffer, len);
}
void
OctaveLibraryBase::sendResponseMsg_P (uint8_t cmdID, const uint8_t *data PROGMEM, uint8_t sz)
{
char tmp[256];
for (int i=0;ilibName.c_str ();
}
return "";
}
uint8_t
OctaveArduinoClass::registerLibrary (LibraryBase *lib)
{
if (libcount < MAX_ARDUINO_LIBS)
{
lib->id = libcount;
libs[libcount] = lib;
libcount ++;
return libcount-1;
}
return 255;
}
uint8_t
OctaveArduinoClass::processMessage (uint8_t libid, uint8_t cmd, uint8_t *data, uint8_t sz)
{
if (libid >= MAX_ARDUINO_LIBS || libs[libid] == 0)
{
if(libcount > 0)
libs[0]->sendErrorMsg_P(ERRORMSG_UNIMPLEMENTED);
}
else
{
libs[libid]->commandHandler((byte)cmd, (byte *)data, (unsigned int)sz);
return 1;
}
return 0;
}
#if defined(WIFI_STATIC_IP)
static int get_ip_parts(const char *str, uint8_t parts[4])
{
uint8_t i = 0;
uint8_t o = 0;
while(str[i] != '\0')
{
if(str[i] == '.')
{
o ++;
if(o < 4)
parts[o] = 0;
}
if(str[i] >= '0' && str[i] <= '9')
{
if(o < 4)
parts[o] = parts[o]*10 + (str[i] - '0');
}
i++;
}
return o;
}
static IPAddress make_ip_address(const char *str)
{
uint8_t parts[4];
get_ip_parts(str, parts);
return IPAddress(parts[0], parts[1], parts[2], parts[3]);
}
static IPAddress make_gateway_address(const char *str)
{
uint8_t parts[4];
get_ip_parts(str, parts);
return IPAddress(parts[0], parts[1], parts[2], 1);
}
#endif
void
OctaveArduinoClass::init ()
{
OCTAVE_COMMS_PORT.begin (ARDUINO_BAUDRATE);
#if defined(OCTAVE_USE_WIFI_COMMS)
#ifdef ARDUINO_ARCH_ESP32
WiFi.begin(wifi_ssid, wifi_pass);
#endif
while(!OCTAVE_COMMS_PORT) {}
#if defined(WIFI_STATIC_IP)
#ifdef ARDUINO_ARCH_ESP32
WiFi.config(make_ip_address(WIFI_STATIC_IP), make_gateway_address(WIFI_STATIC_IP), IPAddress(255, 255, 0, 0));
#else
WiFi.config(make_ip_address(WIFI_STATIC_IP));
#endif
#endif
while (wifi_status != WL_CONNECTED) {
OCTAVE_COMMS_PORT.println("Attempting to connect to nework...");
///Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
wifi_status = WiFi.begin(wifi_ssid, wifi_pass);
// wait 5 seconds for connection:
delay(5000);
}
// show some info about our connection
OCTAVE_COMMS_PORT.println("Connected to network");
OCTAVE_COMMS_PORT.print("SSID: ");
OCTAVE_COMMS_PORT.println(WiFi.SSID());
// print your WiFi shield's IP address:
IPAddress ip = WiFi.localIP();
OCTAVE_COMMS_PORT.print("IP Address: ");
OCTAVE_COMMS_PORT.println(ip);
// print the received signal strength:
long rssi = WiFi.RSSI();
OCTAVE_COMMS_PORT.print("signal strength (RSSI):");
OCTAVE_COMMS_PORT.print(rssi);
OCTAVE_COMMS_PORT.println(" dBm");
wifi_status = 0;
wifiServer.begin();
#endif
for (int i=0; isetup ();
}
}
void
OctaveArduinoClass::runLoop()
{
int ch;
#if defined(OCTAVE_USE_WIFI_COMMS)
WiFiClient client = wifiServer.available();
if(client.connected())
{
//wifi_client = wifiServer.available();
wifi_client = client;
if(wifi_status == 0)
{
OCTAVE_COMMS_PORT.println("Connected");
wifi_status = 1;
}
}
else if(wifi_status == 1 && !wifi_client.connected())
{
OCTAVE_COMMS_PORT.println("Disconnected");
wifi_status = 0;
}
while(wifi_status == 1 && wifi_client.available())
{
ch = wifi_client.read();
#else
if (OCTAVE_COMMS_PORT.available())
{
ch = OCTAVE_COMMS_PORT.read();
#endif
switch (msg_state)
{
case STATE_SOH:
msg_hdr[STATE_SOH] = ch;
if (ch == ARDUINO_SOH)
msg_state = STATE_EXT;
break;
case STATE_EXT:
msg_hdr[STATE_EXT] = ch;
msg_state = STATE_CMD;
break;
case STATE_CMD:
msg_hdr[STATE_CMD] = ch;
msg_state = STATE_SIZE;
break;
case STATE_SIZE:
msg_hdr[STATE_SIZE] = ch;
msg_datapos = 0;
if (ch > 0)
msg_state = STATE_DATA;
else
msg_state = STATE_EOM;
break;
case STATE_DATA:
if (msg_datapos < sizeof(msg_data))
msg_data[msg_datapos] = ch;
msg_datapos ++;
if (msg_datapos == msg_hdr[STATE_SIZE])
msg_state = STATE_EOM;
break;
default:
msg_state = STATE_SOH;
break;
}
if(msg_state == STATE_EOM)
{
msg_state = STATE_SOH;
processMessage (msg_hdr[STATE_EXT], msg_hdr[STATE_CMD], msg_data, msg_hdr[STATE_SIZE]);
}
}
for (int i=0; iloop();
}
}
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/LibraryBase.h 0000664 0000000 0000000 00000005750 15125212406 0025434 0 ustar 00root root 0000000 0000000 /*
* Octave arduino library interface
* Copyright (C) 2018-2022 John Donoghue
*
* 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 .
*/
#ifndef OCTAVE_LIBRARY_BASE_H
#define OCTAVE_LIBRARY_BASE_H
#include
#define VERSION_MAJOR 0
#define VERSION_MINOR 12
#define VERSION_PATCH 3
#if defined(ARDUINO_SAM_DUE)
# define OCTAVE_COMMS_PORT SERIAL_PORT_MONITOR
#elif defined(SERIAL_PORT_USBVIRTUAL)
// sparkfun samed21 dev/mini
# define OCTAVE_COMMS_PORT SERIAL_PORT_USBVIRTUAL
#elif defined(SERIAL_PORT_MONITOR)
# define OCTAVE_COMMS_PORT SERIAL_PORT_MONITOR
#else
# define OCTAVE_COMMS_PORT Serial
#endif
class OctaveLibraryBase
{
public:
String libName;
int id;
virtual void commandHandler(uint8_t cmdID, uint8_t* inputs, uint8_t payload_size);
// matlab compatability
virtual void commandHandler(byte cmdID, byte* inputs, unsigned int payload_size);
virtual void setup();
virtual void loop();
const char * getLibraryName() const;
#define ARDUINO_ERROR 255
#define ARDUINO_WAIT 254
#define ARDUINO_DEBUG 253
void sendResponseMsg(uint8_t cmdID, const uint8_t *data, uint8_t sz);
void sendResponseMsg_P(uint8_t cmdID, const uint8_t *data PROGMEM, uint8_t sz);
void sendErrorMsg(const char *msg);
void sendErrorMsg_P(const char *msg PROGMEM);
void sendUnknownCmdIDMsg();
void sendInvalidNumArgsMsg();
void sendWaitMsg();
void debugPrint(const char *, ...);
};
typedef OctaveLibraryBase LibraryBase;
class OctaveArduinoClass
{
uint8_t msg_state;
uint8_t msg_datapos;
uint8_t msg_hdr[4];
uint8_t msg_data[256];
#define MAX_ARDUINO_LIBS 20
int libcount;
OctaveLibraryBase *libs[MAX_ARDUINO_LIBS];
public:
OctaveArduinoClass();
uint8_t registerLibrary(LibraryBase *lib);
int getLibCount() const { return libcount; }
const char * getLibName(uint8_t idx) const;
void init();
void runLoop();
private:
uint8_t processMessage(uint8_t libid, uint8_t cmd, uint8_t *data, uint8_t sz);
};
// for matlab compatability
typedef OctaveArduinoClass MWArduinoClass;
// error strings
extern const char ERRORMSG_INVALID_NUMBER_OF_ARGS[] PROGMEM;
extern const char ERRORMSG_INVALID_ARGS[] PROGMEM;
extern const char ERRORMSG_INVALID_MODE[] PROGMEM;
extern const char ERRORMSG_INVALID_PIN[] PROGMEM;
extern const char ERRORMSG_UNIMPLEMENTED[] PROGMEM;
extern const char ERRORMSG_INVALID_DEVICE[] PROGMEM;
#endif // OCTAVE_LIBRARY_BASE_H
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/OctaveCoreLibrary.cpp 0000664 0000000 0000000 00000024435 15125212406 0027150 0 ustar 00root root 0000000 0000000 /*
* Octave arduino core interface
* Copyright (C) 2018-2019 John Donoghue
*
* 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 .
*/
#include "settings.h"
#include "OctaveCoreLibrary.h"
#if defined(ARDUINO_ARCH_ESP32) && ! defined(ARDUINO_NANO_ESP32)
// contains analogWrite
#include
#endif
#define ARDUINO_RESET 0
#define ARDUINO_INIT 1
#define ARDUINO_CONFIGPIN 2
#define ARDUINO_DIGITAL 3
#define ARDUINO_ANALOG 4
#define ARDUINO_PWM 5
#define ARDUINO_PLAYTONE 6
#define ARDUINO_GETLIB 8
#define ARDUINO_VERSION 20
#define ARDUINO_UPTIME 21
// endian flag
#define ARDUINO_LITTLEENDIAN 0x00
#define ARDUINO_BIGENDIAN 0x80
#define ARDUINO_ENDIAN ARDUINO_LITTLEENDIAN
// TODO: how know what board we are ???
//compiler provides something like:
// -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR
// freq ide ver board arch
#if defined(ARDUINO_AVR_UNO)
#define BOARD_ID 0
#elif defined(ARDUINO_AVR_MEGA2560)
#define BOARD_ID 1
#elif defined(ARDUINO_AVR_NANO)
#define BOARD_ID 2
#elif defined(ARDUINO_AVR_UNO_WIFI_REV2)
#define BOARD_ID 5
#elif defined(ARDUINO_AVR_NANO_EVERY)
#define BOARD_ID 6
#elif defined(ARDUINO_AVR_LILYPAD)
#define BOARD_ID 10
#elif defined(ARDUINO_AVR_PRO)
#define BOARD_ID 20
#elif defined(ARDUINO_AVR_PROMICRO)
#define BOARD_ID 21
#elif defined(ARDUINO_AVR_LEONARDO)
#define BOARD_ID 22
#elif defined(ARDUINO_AVR_MICRO)
#define BOARD_ID 23
#elif defined(ARDUINO_SAMD_ZERO)
// sparkfun samed21 dev/mini
#if USB_VID == 0x1B4F && USB_PID == 0x8D21
#define BOARD_ID 41
#else
// Arduino Zero
#define BOARD_ID 40
#endif
#elif defined(ARDUINO_SAM_DUE)
#define BOARD_ID 45
#define NUM_TOTAL_PINS PINS_COUNT
#elif defined(ARDUINO_SAMD_MKRZERO)
#define BOARD_ID 50
#define NUM_TOTAL_PINS 33
#elif defined(ARDUINO_SAMD_MKR1000)
#define BOARD_ID 51
#define NUM_TOTAL_PINS 30
#elif defined(ARDUINO_ARDUINO_NANO33BLE)
#define BOARD_ID 60
#define NUM_TOTAL_PINS 34
#elif defined(ARDUINO_MATTER)
#define BOARD_ID 65
#define NUM_TOTAL_PINS 22+3
#elif defined(ARDUINO_RASPBERRY_PI_PICO)
#define BOARD_ID 100
#ifndef ARDUINO_ARCH_MBED
#error "Expected mbed architechture"
#endif
#elif defined(ARDUINO_NANO_RP2040_CONNECT)
#define BOARD_ID 101
#define BOARD_VOLTAGE 33
#ifndef ARDUINO_ARCH_MBED
#error "Expected mbed architechture"
#endif
#elif defined(ARDUINO_NANO_ESP32)
#define BOARD_ID 102
#define BOARD_VOLTAGE 33
#elif defined(ARDUINO_ESP32_DEV)
#define BOARD_ID 111
#define BOARD_VOLTAGE 33
#elif defined(ARDUINO_UNOR4_WIFI)
#define BOARD_ID 112
#elif defined(ARDUINO_NANO_R4)
#define BOARD_ID 113
#define NUM_TOTAL_PINS 26
#elif defined(ARDUINO_UNOR4_MINIMA)
#define BOARD_ID 114
#else
#error "Unknown board type"
#endif
// board voltage = actualV*10
#ifndef BOARD_VOLTAGE
#if defined(ARDUINO_ARCH_SAMD) || defined (ARDUINO_ARCH_NRF52840) || defined (ARDUINO_ARCH_SAM) || defined (ARDUINO_ARCH_RP2040)
#define BOARD_VOLTAGE 33
#elif defined(ARDUINO_AVR_PRO) || defined(ARDUINO_AVR_PROMICRO)
#if F_CPU == 8000000L
#define BOARD_VOLTAGE 33
#else
#define BOARD_VOLTAGE 50
#endif
#else
#define BOARD_VOLTAGE 50
#endif
#endif
static const int8_t map_config_mode[] PROGMEM =
{
INPUT, // unset
INPUT, // analoginput
INPUT, // dig in
OUTPUT, // dig out
INPUT_PULLUP, // pullup
INPUT_PULLUP, //-1, // i2c TODO: ??
OUTPUT, // pwm
OUTPUT, // servo
OUTPUT, // spi TODO ?
INPUT, // interrupt
-1, // reserved
};
int
get_mode(uint8_t m)
{
if (m < sizeof (map_config_mode))
{
return pgm_read_byte_near (map_config_mode + m);
}
return INPUT;
}
#define pinToAnalog(a) (a < A0 ? 0 : a-A0)
#ifndef NUM_TOTAL_PINS
#define NUM_TOTAL_PINS NUM_DIGITAL_PINS
#endif
//#ifdef UNO_WIFI_REV2_328MODE
// #error ("Uno wifi firmware must be compiled without a 328 emultaion enabled")
//#endif
static uint8_t pinconfig[NUM_TOTAL_PINS];
#if defined (ARDUINO_ARCH_AVR) || defined (ARDUINO_ARCH_MEGAAVR)
#include
void
reset ()
{
wdt_enable (WDTO_1S);
while(1) {}
}
#elif defined (ARDUINO_ARCH_SAMD) || defined (ARDUINO_ARCH_NRF52840) || defined (ARDUINO_ARCH_SAM) || defined (ARDUINO_ARCH_RP2040) || defined(ARDUINO_ARCH_RENESAS)
void
reset ()
{
// processor software reset
NVIC_SystemReset ();
}
#elif defined (ARDUINO_ARCH_ESP32)
void
reset ()
{
ESP.restart ();
}
#elif defined (ARDUINO_ARCH_SILABS)
void
reset ()
{
NVIC_SystemReset ();
}
#else
#error("Unimplemented architecture for reset")
#endif
OctaveCoreLibrary::OctaveCoreLibrary (OctaveArduinoClass &oc)
: occlass (oc)
{
libName = "Core";
oc.registerLibrary (this);
// set pins as not set
for(unsigned int i = 0; i= sizeof(map_config_mode))
{
sendErrorMsg_P (ERRORMSG_INVALID_MODE);
}
else if (datasz >= 1 && data[0] >= NUM_TOTAL_PINS)
{
sendErrorMsg_P (ERRORMSG_INVALID_PIN);
}
else if (datasz == 2 && data[0] < NUM_TOTAL_PINS && data[1] < sizeof(map_config_mode))
{
int mode = get_mode (data[1]);
pinconfig[data[0]] = data[1];
if (mode != -1)
{
pinMode (data[0], mode);
}
sendResponseMsg (cmdID, data, 0);
}
else
{
sendInvalidNumArgsMsg ();
}
break;
case ARDUINO_DIGITAL:
if (datasz == 1)
{
val = digitalRead (data[0]);
if (val == HIGH)
data[1] = 1;
else
data[1] = 0;
sendResponseMsg (cmdID, data, 2);
}
else if (datasz == 2)
{
digitalWrite (data[0], data[1] ? HIGH : LOW);
sendResponseMsg (cmdID, data, 0);
}
else
{
sendInvalidNumArgsMsg ();
}
break;
case ARDUINO_ANALOG:
if (datasz == 1)
{
val = analogRead (pinToAnalog(data[0]));
data[1] = (val>>8)&0xff;
data[2] = (val)&0xff;
sendResponseMsg (cmdID, data, 3);
}
else
{
sendInvalidNumArgsMsg ();
}
break;
case ARDUINO_PWM:
if (datasz == 2)
{
analogWrite (data[0], data[1]);
sendResponseMsg (cmdID, data, 0);
}
else
{
sendInvalidNumArgsMsg ();
}
break;
case ARDUINO_PLAYTONE:
if (datasz == 5)
{
#if defined(ARDUINO_SAM_DUE)
sendErrorMsg_P (ERRORMSG_UNIMPLEMENTED);
#else
// 0 = pin
// 1 = freqh
// 2 = freql (hz)
// 3 = durh
// 4 = durl (10ths of second)
unsigned long duration = (((unsigned long)(data[3]))<<8 | data[4]) * 100;
unsigned int freq = (((unsigned int)(data[1]))<<8 | data[2]);
if (freq == 0)
noTone (data[0]);
else
tone (data[0], freq, duration);
sendResponseMsg (cmdID, data, 0);
#endif
}
else
{
sendInvalidNumArgsMsg ();
}
break;
case ARDUINO_VERSION:
{
data[0] = VERSION_MAJOR;
data[1] = VERSION_MINOR;
data[2] = VERSION_PATCH;
sendResponseMsg (cmdID, data, 3);
}
break;
case ARDUINO_UPTIME:
{
unsigned long t = millis ();
data[0] = (t>>24)&0xff;
data[1] = (t>>16)&0xff;
data[2] = (t>>8)&0xff;
data[3] = (t>>0)&0xff;
sendResponseMsg (cmdID, data, 4);
}
break;
default:
sendUnknownCmdIDMsg ();
break;
}
}
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/OctaveCoreLibrary.h 0000664 0000000 0000000 00000001741 15125212406 0026610 0 ustar 00root root 0000000 0000000 /*
* Octave arduino core interface
* Copyright (C) 2018 John Donoghue
*
* 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 .
*/
#include "LibraryBase.h"
class OctaveCoreLibrary : public LibraryBase
{
OctaveArduinoClass &occlass;
public:
OctaveCoreLibrary(OctaveArduinoClass &oc);
void commandHandler(uint8_t cmdID, uint8_t* inputs, uint8_t payload_size);
};
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/OctaveI2CLibrary.cpp 0000664 0000000 0000000 00000027046 15125212406 0026636 0 ustar 00root root 0000000 0000000 /*
* Octave arduino i2c interface
* Copyright (C) 2018 John Donoghue
*
* 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 .
*/
#include "settings.h"
#include "OctaveI2CLibrary.h"
#define ARDUINO_SCANI2C 0
#define ARDUINO_CONFIGI2C 1
// replaces below as diff data format
//#define ARDUINO_WRITEI2C 2
//#define ARDUINO_READI2C 3
//#define ARDUINO_WRITEI2CREG 4
//#define ARDUINO_READI2CREG 5
// new ids as new data
#define ARDUINO_WRITEI2C 6
#define ARDUINO_READI2C 7
#define ARDUINO_WRITEI2CREG 8
#define ARDUINO_READI2CREG 9
#ifdef USE_I2C
#include
static uint8_t i2c_enabled[2] = { false, false };
static uint8_t i2c_address = 0;
#if !defined(WIRE_INTERFACES_COUNT)
# if defined(ARDUINO_ARDUINO_NANO33BLE)
# define WIRE_INTERFACES_COUNT 2
# else
# if defined(WIRE_HOWMANY)
# define WIRE_INTERFACES_COUNT WIRE_HOWMANY
# else
# define WIRE_INTERFACES_COUNT 1
# endif
# endif
#endif
#if !defined(ARDUINO_ARCH_ESP32)
#define I2C_SUPPORTS_ENDCALL 1
#endif
#endif
OctaveI2CLibrary::OctaveI2CLibrary (OctaveArduinoClass &oc)
{
libName = "I2C";
oc.registerLibrary (this);
}
void
OctaveI2CLibrary::commandHandler (uint8_t cmdID, uint8_t* data, uint8_t datasz)
{
switch (cmdID)
{
#ifdef USE_I2C
case ARDUINO_WRITEI2C:
case ARDUINO_WRITEI2CREG:
{
if (datasz < 3 || datasz > 32)
{
// bus
// address
// data
sendInvalidNumArgsMsg ();
}
else
{
if (data[0] >= WIRE_INTERFACES_COUNT || data[0] > 1)
{
sendErrorMsg_P (ERRORMSG_INVALID_DEVICE);
return;
}
if (data[0] == 0)
{
Wire.beginTransmission (data[1]); // should be i2c_address
byte c;
for(c=2;c 1
if (data[0] == 1)
{
Wire1.beginTransmission (data[1]); // should be i2c_address
byte c;
for(c=2;c= WIRE_INTERFACES_COUNT || data[0] > 1)
{
sendErrorMsg_P (ERRORMSG_INVALID_DEVICE);
return;
}
if (data[0] == 0)
{
Wire.requestFrom (data[1], (size_t)data[2]);
byte c = 0;
byte l = data[2];
if (l > 5) sendWaitMsg ();
datasz = 1;
for (c=0;c<=l;c++)
{
if (Wire.available ())
{
data[datasz] = Wire.read ();
datasz ++;
}
}
}
#if WIRE_INTERFACES_COUNT > 1
if (data[0] == 1)
{
Wire1.requestFrom (data[1], (size_t)data[2]);
byte c = 0;
byte l = data[2];
if (l > 5) sendWaitMsg ();
datasz = 1;
for (c=0;c<=l;c++)
{
if (Wire1.available ())
{
data[datasz] = Wire1.read ();
datasz ++;
}
}
}
#endif
sendResponseMsg (cmdID,data, datasz);
}
break;
}
case ARDUINO_READI2CREG:
{
if (datasz < 5)
{
// bus
// address
// regsz
// reg
// numbytes
sendInvalidNumArgsMsg ();
}
else if (datasz != data[2]+4)
{
sendInvalidNumArgsMsg ();
}
else
{
if (data[0] >= WIRE_INTERFACES_COUNT || data[0] > 1)
{
sendErrorMsg_P (ERRORMSG_INVALID_DEVICE);
return;
}
if (data[0] == 0)
{
Wire.beginTransmission (data[1]);
byte c = 0;
for (c=0;c 5) sendWaitMsg ();
datasz = 2;
for (c=0;c<=l;c++)
{
if (Wire.available ())
{
data[datasz] = Wire.read ();
datasz ++;
}
}
}
#if WIRE_INTERFACES_COUNT > 1
if (data[0] == 1)
{
Wire1.beginTransmission (data[1]);
byte c = 0;
for (c=0;c 5) sendWaitMsg ();
datasz = 2;
for (c=0;c<=l;c++)
{
if (Wire1.available ())
{
data[datasz] = Wire1.read ();
datasz ++;
}
}
}
#endif
sendResponseMsg (cmdID,data, datasz);
}
break;
}
case ARDUINO_SCANI2C:
{
if (datasz != 2)
{
sendInvalidNumArgsMsg ();
}
else
{
byte error = 1;
// bus 0
// address
if (data[0] >= WIRE_INTERFACES_COUNT || data[0] > 1)
{
sendErrorMsg_P (ERRORMSG_INVALID_DEVICE);
return;
}
if (!i2c_enabled[data[0]])
{
if(data[0] == 0) Wire.begin ();
#if WIRE_INTERFACES_COUNT > 1
if(data[0] == 1) Wire1.begin ();
#endif
}
if (data[0] == 0)
{
Wire.beginTransmission (data[1]);
error = Wire.endTransmission ();
}
#if WIRE_INTERFACES_COUNT > 1
if (data[0] == 1)
{
Wire1.beginTransmission (data[1]);
error = Wire1.endTransmission ();
}
#endif
if (error == 0)
data[2] = 1;
else
data[2] = 0;
if (!i2c_enabled[data[0]])
{
#if defined (I2C_SUPPORTS_ENDCALL)
if(data[0] == 0) Wire.end ();
# if WIRE_INTERFACES_COUNT > 1
if(data[0] == 1) Wire1.end ();
# endif
#endif
}
sendResponseMsg (cmdID, data, 3);
}
break;
}
case ARDUINO_CONFIGI2C:
{
if (datasz == 2 || datasz == 3 || datasz == 5)
{
// i2c bus 0
// enable 1
// i2caddress (optional)
// bitratehi
// birtarelo
if (data[0] >= WIRE_INTERFACES_COUNT || data[0] > 1)
{
sendErrorMsg_P (ERRORMSG_INVALID_DEVICE);
return;
}
// enable
if (data[1] == 1)
{
i2c_enabled[data[0]] = 1;
if (data[0] == 0)
{
// TODO: i dont think need any more as setting i2c as pullup inputs before making it i2c
#if defined(ARDUINO_AVR_NANO_EVERY) || defined (ARDUINO_NANO_RP2040_CONNECT)
// arduino every A4,A5 pin is connected to 2 pins each on the micro controller
// so need ensure that the non I2C pins are pulled hi so doesnt effect the i2c pins
pinMode(18, INPUT_PULLUP);
pinMode(19, INPUT_PULLUP);
#endif
}
if (datasz>= 3)
i2c_address = data[2];
else
i2c_address = 0;
if (data[0] == 0)
{
if (i2c_address > 0)
Wire.begin (i2c_address);
else
Wire.begin ();
if (datasz == 5)
{
int32_t bitrate = (((uint32_t)data[3])<<8) | ((uint32_t)data[4]);
Wire.setClock (bitrate*1000L);
}
}
#if WIRE_INTERFACES_COUNT > 1
if (data[0] == 1)
{
if (i2c_address > 0)
Wire1.begin (i2c_address);
else
Wire1.begin ();
if (datasz == 5)
{
int32_t bitrate = (((uint32_t)data[3])<<8) | ((uint32_t)data[4]);
Wire1.setClock (bitrate*1000L);
}
}
#endif
}
else
{
// disable
#if defined (I2C_SUPPORTS_ENDCALL)
if (data[0] == 0) Wire.end ();
# if WIRE_INTERFACES_COUNT > 1
if (data[0] == 1) Wire1.end ();
# endif
#endif
i2c_enabled[data[0]] = 0;
}
sendResponseMsg (cmdID, data, datasz);
}
else if (datasz == 1)
{
// query config of device
// i2c id
// enable
// address
if (data[0] >= WIRE_INTERFACES_COUNT || data[0] > 1)
{
sendErrorMsg_P (ERRORMSG_INVALID_DEVICE);
return;
}
data[1] = i2c_enabled[data[0]];
data[2] = i2c_address;
sendResponseMsg (cmdID,data, 3);
}
else
{
sendInvalidNumArgsMsg ();
}
break;
}
#endif
default:
sendUnknownCmdIDMsg ();
break;
}
}
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/OctaveI2CLibrary.h 0000664 0000000 0000000 00000001677 15125212406 0026305 0 ustar 00root root 0000000 0000000 /*
* Octave arduino i2c interface
* Copyright (C) 2018 John Donoghue
*
* 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 .
*/
#include "LibraryBase.h"
class OctaveI2CLibrary : public LibraryBase
{
public:
OctaveI2CLibrary(OctaveArduinoClass &oc);
void commandHandler(uint8_t cmdID, uint8_t* inputs, uint8_t payload_size);
};
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/OctaveRotaryEncoderLibrary.cpp 0000664 0000000 0000000 00000015362 15125212406 0031037 0 ustar 00root root 0000000 0000000 /*
* Octave arduino encoder interface
* Copyright (C) 2018 John Donoghue
*
* 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 .
*/
#include "settings.h"
#include "OctaveRotaryEncoderLibrary.h"
#define ARDUINO_RESET_ENCODER 0
#define ARDUINO_CONFIG_ENCODER 1
#define ARDUINO_READPOS_ENCODER 2
#define ARDUINO_READSPEED_ENCODER 3
#ifdef USE_ROTARYENCODER
static const char ERRORMSG_CANT_READ[] PROGMEM = "Max encoder reached";
static int8_t enc_states[] = {0,-1,1,0,1,0,0,-1,-1,0,0,1,0,1,-1,0};
#define MAX_ROTARYENCODERS 8
class RotaryEncoder
{
#define USED 1
#define POLL 2
public:
uint8_t flags;
uint8_t pins[2];
int16_t cnt;
int16_t oldcnt;
uint16_t speed;
uint8_t state;
RotaryEncoder();
uint8_t init (uint8_t p1, uint8_t p2);
uint8_t free() { flags = 0; return 0;}
uint16_t readCount ();
uint16_t readSpeed ();
uint8_t resetCount (uint8_t h=0, uint8_t l=0);
void poll ();
void process (unsigned long diff);
};
RotaryEncoder::RotaryEncoder ()
{
flags = 0;
}
uint8_t
RotaryEncoder::init (uint8_t p1, uint8_t p2)
{
flags = USED | POLL;
state = 0;
cnt = 0;
oldcnt = 0;
pins[0] = p1;
pins[1] = p2;
pinMode (pins[0], INPUT);
digitalWrite (pins[0], HIGH);
pinMode (pins[1], INPUT);
digitalWrite (pins[1], HIGH);
return 0;
}
uint16_t
RotaryEncoder::readCount ()
{
return cnt;
}
uint16_t
RotaryEncoder::readSpeed ()
{
return speed;
}
uint8_t
RotaryEncoder::resetCount (uint8_t h, uint8_t l)
{
uint16_t v= ((uint16_t)h)<<8 | l;
cnt = (int16_t)v;
oldcnt = cnt;
return 0;
}
void
RotaryEncoder::poll ()
{
// get curr state and prev state - gives 16 possible outcomes
// wheich can then do a lookup table for detection
state = (state<<2) | (digitalRead(pins[1]) ? 2 : 0) | (digitalRead(pins[0]) ? 1 : 0);
int8_t dir = enc_states[state&0xf];
if(dir < 0 && cnt > -32000) cnt += dir;
if(dir > 0 && cnt < 32000) cnt += dir;
}
void
RotaryEncoder::process (unsigned long t)
{
//input millis
long s = ((cnt - oldcnt) * 1000) / t;
if(s < 0) s = -s;
if(s > 32000) s = 32000;
if(s != 0)
speed = s;
else if(speed > 0)
speed --;
oldcnt = cnt;
}
static RotaryEncoder encoders[MAX_ROTARYENCODERS];
RotaryEncoder *
getRotaryEncoder (uint8_t id)
{
uint8_t i;
RotaryEncoder * unused = 0;
for (i=0;iinit(data[0], data[2]);
sendResponseMsg (cmdID, data, 2);
}
// free
else if (data[1] == 0 && reg->flags && datasz == 2)
{
reg->free ();
sendResponseMsg (cmdID, data, 2);
}
else
{
sendErrorMsg_P (ERRORMSG_INVALID_ARGS);
}
}
else
{
sendErrorMsg_P (ERRORMSG_INVALID_ARGS);
}
break;
}
case ARDUINO_RESET_ENCODER:
{
// 0 = id (currently using the datapin id)
RotaryEncoder * reg = getRotaryEncoder(data[0]);
if(reg && reg->flags)
{
data[1] = reg->resetCount (data[1], data[2]);
sendResponseMsg (cmdID,data, 2);
}
else
{
sendErrorMsg_P (ERRORMSG_INVALID_ARGS);
}
break;
}
case ARDUINO_READPOS_ENCODER:
{
// 0 = id
// 1 = reset flag
RotaryEncoder * reg = getRotaryEncoder (data[0]);
if(reg && reg->flags && datasz == 2)
{
uint16_t v = reg->readCount ();
if (data[1] == 1)
reg->resetCount();
data[1] = (v>>8)&0xff;
data[2] = (v)&0xff;
unsigned long t = millis ();
data[3] = (t>>24)&0xff;
data[4] = (t>>16)&0xff;
data[5] = (t>>8)&0xff;
data[6] = (t)&0xff;
datasz = 7;
sendResponseMsg (cmdID, data, datasz);
}
else
{
sendErrorMsg_P (ERRORMSG_INVALID_ARGS);
}
break;
}
case ARDUINO_READSPEED_ENCODER:
{
// 0 = id
RotaryEncoder * reg = getRotaryEncoder (data[0]);
if(reg && reg->flags && datasz == 1)
{
uint16_t v = reg->readSpeed ();
datasz = 3;
data[1] = (v>>8)&0xff;
data[2] = (v)&0xff;
sendResponseMsg (cmdID, data, datasz);
}
else
{
sendErrorMsg_P (ERRORMSG_INVALID_ARGS);
}
break;
}
#endif
default:
sendUnknownCmdIDMsg ();
break;
}
}
void
OctaveRotaryEncoderLibrary::loop ()
{
#ifdef USE_ROTARYENCODER
static unsigned long speedtime = 0;
unsigned long newtime;
// any thing that needs poll
for (int i=0; iflags & POLL)
{
enc->poll();
}
}
// do any periodic processing
newtime = millis();
if (speedtime < newtime)
{
unsigned long diff = (newtime - speedtime);
if (diff > 50)
{
speedtime = newtime;
for (int i=0; iflags)
enc->process(diff);
}
}
}
else if (speedtime > newtime)
{
speedtime = newtime;
}
#endif
}
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/OctaveRotaryEncoderLibrary.h 0000664 0000000 0000000 00000001767 15125212406 0030510 0 ustar 00root root 0000000 0000000 /*
* Octave arduino shift register interface
* Copyright (C) 2018 John Donoghue
*
* 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 .
*/
#include "LibraryBase.h"
class OctaveRotaryEncoderLibrary : public LibraryBase
{
public:
OctaveRotaryEncoderLibrary(OctaveArduinoClass &oc);
void commandHandler(uint8_t cmdID, uint8_t* inputs, uint8_t payload_size);
virtual void loop();
};
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/OctaveSPILibrary.cpp 0000664 0000000 0000000 00000011407 15125212406 0026706 0 ustar 00root root 0000000 0000000 /*
* Octave arduino spi interface
* Copyright (C) 2018 John Donoghue
*
* 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 .
*/
#include "settings.h"
#include "OctaveSPILibrary.h"
#define ARDUINO_CONFIGSPI 1
#define ARDUINO_READ_WRITE_SPI 2
#ifdef USE_SPI
#include
class SPIDevice
{
#define USED 1
#define ENABLED 2
public:
uint8_t flags;
uint8_t cspin;
uint8_t bitorder;
uint8_t mode;
SPIDevice();
uint8_t init(uint8_t id, uint8_t mode, uint8_t order);
uint8_t free();
void set_cs(uint8_t state);
int transfer(uint8_t *data, int sz);
SPISettings settings();
};
SPIDevice::SPIDevice ()
{
flags = 0;
}
uint8_t
SPIDevice::init (uint8_t id, uint8_t spi_mode, uint8_t spi_bitorder)
{
flags = USED|ENABLED;
cspin = id;
if (spi_mode == 0) mode = SPI_MODE0;
else if (spi_mode == 1) mode = SPI_MODE1;
else if (spi_mode == 2) mode = SPI_MODE2;
else if (spi_mode == 3) mode = SPI_MODE3;
else mode = SPI_MODE0;
bitorder = spi_bitorder;
return 0;
}
uint8_t
SPIDevice::free ()
{
flags = 0;
return 0;
}
void SPIDevice::set_cs(uint8_t state)
{
digitalWrite (cspin, state);
}
SPISettings SPIDevice::settings()
{
return SPISettings(4000000, bitorder==0 ? MSBFIRST : LSBFIRST , mode);
}
int
SPIDevice::transfer (uint8_t *data, int sz)
{
SPI.transfer (data, sz);
return 0;
}
#define MAX_SPI_DEVICES 5
static SPIDevice spidevs[MAX_SPI_DEVICES];
SPIDevice *
getSPI (uint8_t id)
{
uint8_t i;
SPIDevice * unused = 0;
for (i=0; iinit(data[0], data[2], data[3]);
// TODO: first call only ?
SPI.begin ();
dev->set_cs(HIGH);
}
else
{
// TODO: last call only
// SPI.end ();
dev->free();
}
sendResponseMsg (cmdID,data, 2);
}
else if(datasz == 1)
{
SPIDevice * dev = getSPI (data[0]);
if(dev == 0 || (dev->flags&USED)==0)
{
sendErrorMsg_P (ERRORMSG_INVALID_DEVICE);
return;
}
// TODO: last call only
// SPI.end ();
dev->free();
}
else
{
sendInvalidNumArgsMsg ();
}
break;
}
case ARDUINO_READ_WRITE_SPI:
if (datasz >= 2)
{
SPIDevice * dev = getSPI (data[0]);
if(dev == 0 || (dev->flags&USED)==0)
{
sendErrorMsg_P (ERRORMSG_INVALID_DEVICE);
return;
}
// begin transaction
SPI.beginTransaction (dev->settings());
// set CS low
dev->set_cs(LOW);
delay (1);
// transfer the bytes
dev->transfer(&data[1], datasz-1);
// set CS hi
dev->set_cs(HIGH);
delay (1);
// endtransaction
SPI.endTransaction ();
sendResponseMsg (cmdID, data, datasz);
}
else
{
sendInvalidNumArgsMsg ();
}
break;
#endif
default:
sendUnknownCmdIDMsg ();
break;
}
}
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/OctaveSPILibrary.h 0000664 0000000 0000000 00000001677 15125212406 0026363 0 ustar 00root root 0000000 0000000 /*
* Octave arduino spi interface
* Copyright (C) 2018 John Donoghue
*
* 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 .
*/
#include "LibraryBase.h"
class OctaveSPILibrary : public LibraryBase
{
public:
OctaveSPILibrary(OctaveArduinoClass &oc);
void commandHandler(uint8_t cmdID, uint8_t* inputs, uint8_t payload_size);
};
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/OctaveSerialLibrary.cpp 0000664 0000000 0000000 00000021207 15125212406 0027471 0 ustar 00root root 0000000 0000000 /*
* Octave arduino serial interface
* Copyright (C) 2019 John Donoghue
*
* 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 .
*/
#include "settings.h"
#include "OctaveSerialLibrary.h"
#define ARDUINO_CONFIGSERIAL 1
#define ARDUINO_WRITESERIAL 2
#define ARDUINO_READSERIAL 3
#define ARDUINO_STATSERIAL 4
#ifdef USE_SERIAL
#if defined(ARDUINO_AVR_NANO_EVERY)
# ifndef SERIAL_PORT_HARDWARE_OPEN
# define SERIAL_PORT_HARDWARE_OPEN SERIAL_PORT_HARDWARE
# endif
#endif
#if defined(ARDUINO_MATTER)
# ifndef SERIAL_PORT_HARDWARE_OPEN
# define SERIAL_PORT_HARDWARE_OPEN Serial
# define SERIAL_PORT_HARDWARE_OPEN1 Serial1
# endif
#endif
#if defined(ARDUINO_NANO_R4)
# ifndef SERIAL_PORT_HARDWARE_OPEN
# define SERIAL_PORT_HARDWARE_OPEN Serial
# define SERIAL_PORT_HARDWARE_OPEN1 Serial1
# endif
#endif
#ifndef SERIAL_PORT_HARDWARE_OPEN
#error "This device does not support the serial octave serial interface"
#endif
#if defined(ARDUINO_SAM_DUE)
static USARTClass * serial[] = {
#else
static HardwareSerial * serial[] = {
#endif
#ifdef SERIAL_PORT_HARDWARE_OPEN1
0,
#endif
#ifdef SERIAL_PORT_HARDWARE_OPEN2
0,
#endif
#ifdef SERIAL_PORT_HARDWARE_OPEN3
0,
#endif
0
};
#define NUM_SERIAL_PORTS (sizeof(serial)/sizeof(HardwareSerial*))
#endif
OctaveSerialLibrary::OctaveSerialLibrary (OctaveArduinoClass &oc)
{
libName = "Serial";
oc.registerLibrary (this);
}
void
OctaveSerialLibrary::setup ()
{
#ifdef USE_SERIAL
serial[0] = &SERIAL_PORT_HARDWARE_OPEN;
#ifdef SERIAL_PORT_HARDWARE_OPEN1
serial[1] = &SERIAL_PORT_HARDWARE_OPEN1;
#endif
#ifdef SERIAL_PORT_HARDWARE_OPEN2
serial[2] = &SERIAL_PORT_HARDWARE_OPEN2;
#endif
#ifdef SERIAL_PORT_HARDWARE_OPEN3
serial[3] = &SERIAL_PORT_HARDWARE_OPEN3;
#endif
#endif
OctaveLibraryBase::setup ();
}
void
OctaveSerialLibrary::commandHandler (uint8_t cmdID, uint8_t* data, uint8_t datasz)
{
switch (cmdID)
{
#ifdef USE_SERIAL
case ARDUINO_WRITESERIAL:
{
if (datasz < 2 || datasz > 32)
{
// id
// data
sendInvalidNumArgsMsg ();
}
else if (data[0] < 1 || data[0] > NUM_SERIAL_PORTS)
{
sendErrorMsg_P (ERRORMSG_INVALID_DEVICE);
}
else
{
uint8_t id = data[0]-1;
serial[id]->write (&data[1], datasz-1);
data[1] = 1;
sendResponseMsg (cmdID, data, 2);
}
break;
}
case ARDUINO_READSERIAL:
{
if (datasz != 3)
{
// port
// numbytes
// timeout in 10th of second
sendInvalidNumArgsMsg ();
}
else if (data[0] < 1 || data[0] > NUM_SERIAL_PORTS)
{
sendErrorMsg_P (ERRORMSG_INVALID_DEVICE);
}
else
{
uint8_t id = data[0]-1;
uint8_t timeout = data[2];
byte c = 0;
byte l = data[1];
// if have a timeout, try wait that time for enough data before returning
if (timeout > 0)
{
sendWaitMsg ();
unsigned long t = millis();
unsigned long e = t + timeout * 100; // 10th of a seconf to millis
while (e > t && serial[id]->available() < l)
{
t = millis();
}
}
datasz = 1;
for (c=0; cavailable ())
{
data[datasz] = serial[id]->read ();
datasz ++;
}
}
sendResponseMsg(cmdID,data, datasz);
}
break;
}
case ARDUINO_STATSERIAL:
{
if (datasz != 1)
{
// port
sendInvalidNumArgsMsg ();
}
else if (data[0] < 1 || data[0] > NUM_SERIAL_PORTS)
{
sendErrorMsg_P (ERRORMSG_INVALID_DEVICE);
}
else
{
uint8_t id = data[0]-1;
data[1] = serial[id]->available ();
sendResponseMsg (cmdID, data, 2);
}
break;
}
case ARDUINO_CONFIGSERIAL:
{
if (datasz > 0 && (data[0] < 1 || data[0] > NUM_SERIAL_PORTS))
{
sendErrorMsg_P(ERRORMSG_INVALID_DEVICE);
}
// enable
else if (datasz == 9 && data[1] == 1)
{
uint8_t id = data[0]-1;
// data[1] = enable
uint32_t baud = ((uint32_t)data[2]<<24) | ((uint32_t)data[3]<<16) | ((uint32_t)data[4]<<8) | data[5];
#if defined(ARDUINO_SAM_DUE) || defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_SAMD_MKR1000)
uint32_t conf = 0;
#else
uint8_t conf = 0;
#endif
// data[6] = databits
// data[7] = stopbits
// data[8] = parity
if (data[8] == 2) // parity even
{
if (data[7] == 1)
{
switch (data[6])
{
case 5: conf = SERIAL_5E1; break;
case 6: conf = SERIAL_6E1; break;
case 7: conf = SERIAL_7E1; break;
default: conf = SERIAL_8E1; break;
}
}
else // 2 stop bits
{
switch (data[6])
{
case 5: conf = SERIAL_5E2; break;
case 6: conf = SERIAL_6E2; break;
case 7: conf = SERIAL_7E2; break;
default: conf = SERIAL_8E2; break;
}
}
}
else if (data[8] == 1) // parity odd
{
if (data[7] == 1)
{
switch (data[6])
{
case 5: conf = SERIAL_5O1; break;
case 6: conf = SERIAL_6O1; break;
case 7: conf = SERIAL_7O1; break;
default: conf = SERIAL_8O1; break;
}
}
else // 2 stop bits
{
switch (data[6])
{
case 5: conf = SERIAL_5O2; break;
case 6: conf = SERIAL_6O2; break;
case 7: conf = SERIAL_7O2; break;
default: conf = SERIAL_8O2; break;
}
}
}
else // parity none
{
if (data[7] == 1)
{
switch (data[6])
{
case 5: conf = SERIAL_5N1; break;
case 6: conf = SERIAL_6N1; break;
case 7: conf = SERIAL_7N1; break;
default: conf = SERIAL_8N1; break;
}
}
else // 2 stop bits
{
switch (data[6])
{
case 5: conf = SERIAL_5N2; break;
case 6: conf = SERIAL_6N2; break;
case 7: conf = SERIAL_7N2; break;
default: conf = SERIAL_8N2; break;
}
}
}
#if defined(ARDUINO_SAM_DUE)
serial[id]->begin (baud, (USARTClass::USARTModes)conf);
#else
serial[id]->begin (baud, conf);
#endif
sendResponseMsg (cmdID, data, 2);
}
// disable
else if (datasz == 2 && data[1] == 0)
{
uint8_t id = data[0]-1;
serial[id]->end ();
sendResponseMsg (cmdID, data, 2);
}
else
{
sendInvalidNumArgsMsg ();
}
break;
}
#endif
default:
sendUnknownCmdIDMsg();
break;
}
}
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/OctaveSerialLibrary.h 0000664 0000000 0000000 00000001731 15125212406 0027136 0 ustar 00root root 0000000 0000000 /*
* Octave arduino serial interface
* Copyright (C) 2019 John Donoghue
*
* 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 .
*/
#include "LibraryBase.h"
class OctaveSerialLibrary : public LibraryBase
{
public:
OctaveSerialLibrary(OctaveArduinoClass &oc);
void setup();
void commandHandler(uint8_t cmdID, uint8_t* inputs, uint8_t payload_size);
};
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/OctaveServoLibrary.cpp 0000664 0000000 0000000 00000004673 15125212406 0027360 0 ustar 00root root 0000000 0000000 /*
* Octave arduino servo interface
* Copyright (C) 2018 John Donoghue
*
* 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 .
*/
#include "settings.h"
#include "OctaveServoLibrary.h"
#define ARDUINO_SERVO 0
#define ARDUINO_CONFIG_SERVO 1
#ifdef USE_SERVO
// NOTE: if cant fint servo.h, you probally dont have the Servo library installed
// go to Sketch -> Include Library -> Manage Libraries, and select 'Servo'
// For ESP boards, it bwill need to be ESP32Servo
# if defined(ARDUINO_ARCH_ESP32)
#include
# else
#include
# endif
Servo servo[NUM_DIGITAL_PINS];
uint16_t servo_pos[NUM_DIGITAL_PINS];
#endif
OctaveServoLibrary::OctaveServoLibrary (OctaveArduinoClass &oc)
{
libName = "Servo";
oc.registerLibrary (this);
}
void
OctaveServoLibrary::commandHandler (uint8_t cmdID, uint8_t* data, uint8_t datasz)
{
switch (cmdID)
{
#ifdef USE_SERVO
case ARDUINO_SERVO:
if (datasz == 1)
{
uint16_t ms = servo_pos[data[0]];
data[1] = (ms>>8);
data[2] = (ms&0xff);
sendResponseMsg (cmdID, data, 3);
}
else if (datasz == 3)
{
uint16_t ms = ((int)data[1]<<8) | ((int)data[2]);
servo_pos[data[0]] = ms;
servo[data[0]].writeMicroseconds (ms);
sendResponseMsg (cmdID, data, 1);
}
else
{
sendInvalidNumArgsMsg ();
}
break;
case ARDUINO_CONFIG_SERVO:
if (datasz > 0)
{
// pin
// conf stuff ... ?
servo[data[0]].attach (data[0]);
sendResponseMsg (cmdID, data, 1);
}
else
{
sendInvalidNumArgsMsg ();
}
break;
#endif
default:
sendUnknownCmdIDMsg ();
break;
}
}
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/OctaveServoLibrary.h 0000664 0000000 0000000 00000001705 15125212406 0027016 0 ustar 00root root 0000000 0000000 /*
* Octave arduino servo interface
* Copyright (C) 2018 John Donoghue
*
* 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 .
*/
#include "LibraryBase.h"
class OctaveServoLibrary : public LibraryBase
{
public:
OctaveServoLibrary(OctaveArduinoClass &oc);
void commandHandler(uint8_t cmdID, uint8_t* inputs, uint8_t payload_size);
};
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/OctaveShiftRegisterLibrary.cpp 0000664 0000000 0000000 00000025063 15125212406 0031040 0 ustar 00root root 0000000 0000000 /*
* Octave arduino shift register interface
* Copyright (C) 2018 John Donoghue
*
* 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 .
*/
#include "settings.h"
#include "OctaveShiftRegisterLibrary.h"
#define ARDUINO_RESET_SHIFTREG 0
#define ARDUINO_CONFIG_SHIFTREG 1
#define ARDUINO_WRITE_SHIFTREG 2
#define ARDUINO_READ_SHIFTREG 3
#define TYPE_74HC164 0
// input p2s
#define TYPE_74HC165 1
// output s2p
#define TYPE_74HC595 2
#define SER_74HC595_DATA 0
#define SER_74HC595_CLK 1
#define SER_74HC595_LATCH 2
#define SER_74HC595_RESET 3
#define SER_74HC165_DATA 0
#define SER_74HC165_CLK 1
#define SER_74HC165_LOAD 2
#define SER_74HC165_CLOCKEN 3
#define SER_74HC164_DATA 0
#define SER_74HC164_CLK 1
#define SER_74HC164_RESET 2
static const char ERRORMSG_CANT_READ[] PROGMEM = "This register cant not read";
static const char ERRORMSG_CANT_WRITE[] PROGMEM = "This register can not write";
#ifdef USE_SHIFTREG
#define MAX_SHIFT_REGISTERS 8
class ShiftRegister
{
public:
uint8_t used;
uint8_t type;
uint8_t pins[6];
ShiftRegister ();
bool canread ();
bool canwrite ();
uint8_t init ();
uint8_t csenable (bool en);
uint8_t latch ();
uint8_t read ();
uint8_t free () { used = 0; return 0;}
uint8_t write (uint8_t);
uint8_t reset ();
};
ShiftRegister::ShiftRegister ()
{
used = 0;
}
bool
ShiftRegister::canread ()
{
return (type == TYPE_74HC165);
}
bool
ShiftRegister::canwrite ()
{
return (type == TYPE_74HC164 || type == TYPE_74HC595);
}
uint8_t
ShiftRegister::init ()
{
// depends on type of what need do
if (type == TYPE_74HC164)
{
pinMode (pins[SER_74HC164_DATA], OUTPUT);
pinMode (pins[SER_74HC164_CLK], OUTPUT);
// have reset pin
if (used > SER_74HC164_RESET)
{
pinMode (pins[SER_74HC164_RESET], OUTPUT);
digitalWrite (pins[SER_74HC164_RESET], LOW);
}
digitalWrite (pins[SER_74HC595_CLK], LOW);
if (used > SER_74HC164_RESET)
{
// have reset pin - so unset clr
digitalWrite (pins[SER_74HC164_RESET], HIGH);
}
}
if (type == TYPE_74HC165)
{
// serial data is input
pinMode (pins[SER_74HC165_DATA], INPUT);
// init with clock and load high
pinMode (pins[SER_74HC165_CLK], OUTPUT);
pinMode (pins[SER_74HC165_LOAD], OUTPUT);
digitalWrite (pins[SER_74HC165_CLK], HIGH);
digitalWrite (pins[SER_74HC165_LOAD], HIGH);
}
if (type == TYPE_74HC595)
{
pinMode (pins[SER_74HC595_DATA], OUTPUT);
pinMode (pins[SER_74HC595_CLK], OUTPUT); // clk
pinMode (pins[SER_74HC595_LATCH], OUTPUT); // latch
// have reset pin
if (used > SER_74HC595_RESET)
{
pinMode (pins[SER_74HC595_RESET], OUTPUT); // reset (optional)
digitalWrite (pins[SER_74HC595_RESET], LOW);
}
// clock start high
digitalWrite (pins[SER_74HC595_CLK], LOW);
// latch
digitalWrite (pins[SER_74HC595_LATCH], LOW);
// have reset pin - so unset clr
if (used > SER_74HC595_RESET)
{
digitalWrite (pins[SER_74HC595_RESET], HIGH);
}
}
return 0;
}
uint8_t
ShiftRegister::csenable (bool en)
{
if (type == TYPE_74HC164)
{
// nothing to do
}
else if (type == TYPE_74HC165)
{
// enable the clock with clockenalepin
digitalWrite (pins[SER_74HC165_CLOCKEN], en ? LOW : HIGH);
}
else if (type == TYPE_74HC595)
{
// nothing to do
}
return 0;
}
uint8_t
ShiftRegister::latch ()
{
if (type == TYPE_74HC164)
{
// no latch
}
else if (type == TYPE_74HC165)
{
// trigger loading, by toggle on loadpin
digitalWrite (pins[SER_74HC165_LOAD], LOW);
delayMicroseconds (5);
digitalWrite (pins[SER_74HC165_LOAD], HIGH);
delayMicroseconds (5);
}
else if (type == TYPE_74HC595)
{
// latches on rising edge
digitalWrite (pins[SER_74HC595_LATCH], HIGH);
delayMicroseconds (5);
digitalWrite (pins[SER_74HC595_LATCH], LOW);
delayMicroseconds (5);
}
return 0;
}
uint8_t
ShiftRegister::read ()
{
uint8_t val = 0;
if (type == TYPE_74HC165)
{
val = shiftIn(pins[SER_74HC165_DATA], pins[SER_74HC165_CLK], MSBFIRST);
}
return val;
}
uint8_t
ShiftRegister::write (uint8_t d)
{
if (type == TYPE_74HC595)
{
shiftOut (pins[SER_74HC595_DATA], pins[SER_74HC595_CLK], MSBFIRST, d);
return 1;
}
if (type == TYPE_74HC164)
{
shiftOut (pins[SER_74HC164_DATA], pins[SER_74HC164_CLK], MSBFIRST, d);
return 1;
}
return 0;
}
uint8_t
ShiftRegister::reset ()
{
if (type == TYPE_74HC595)
{
// have reset pin - so unset clr
if (used > SER_74HC595_RESET)
{
digitalWrite (pins[SER_74HC595_RESET], LOW);
delayMicroseconds (5);
digitalWrite (pins[SER_74HC595_RESET], HIGH);
delayMicroseconds (5);
return 1;
}
}
else if (type == TYPE_74HC164)
{
if (used > SER_74HC164_RESET)
{
digitalWrite (pins[SER_74HC164_RESET], LOW);
delayMicroseconds (5);
digitalWrite (pins[SER_74HC164_RESET], HIGH);
delayMicroseconds (5);
return 1;
}
}
return 0;
}
static ShiftRegister shiftregs[MAX_SHIFT_REGISTERS];
ShiftRegister *
getShiftRegister (uint8_t id)
{
uint8_t i;
ShiftRegister * unused = 0;
for (i=0; i 0)
{
if (shiftregs[i].pins[0] == id)
return &shiftregs[i];
}
else if (!unused)
{
unused = &shiftregs[i];
}
}
return unused;
}
#endif
OctaveShiftRegisterLibrary::OctaveShiftRegisterLibrary(OctaveArduinoClass &oc)
{
libName = "ShiftRegister";
oc.registerLibrary (this);
}
void
OctaveShiftRegisterLibrary::commandHandler (uint8_t cmdID, uint8_t* data, uint8_t datasz)
{
switch (cmdID)
{
#ifdef USE_SHIFTREG
case ARDUINO_CONFIG_SHIFTREG:
{
// 0 = id/datapin
// 1 - enable/alloc
// [ 2 = type
// 3 = pins []
// 4 ... ]
ShiftRegister * reg = getShiftRegister (data[0]);
if (reg)
{
// alloc
if (data[1] == 1 && datasz >= 4)
{
// data = DATAPIN E T CLK PIN? PIN? ...
//
// DATAPIN (doubles as ID)
// E = enable (1 vs 0) ie: alloc/free
// T = type 0 = 74HC164, ...
// CLK clock pin
// otherpins
// pins used = pins defined
reg->used = datasz - 2;
// 1st pin is the register id
reg->pins[0] = data[0];
reg->type = data[2];
byte c = 0;
for (c=0; cused-1; c++)
{
reg->pins[c+1] = data[3+c];
}
reg->init ();
sendResponseMsg (cmdID, data, 2);
}
// free
else if (data[1] == 0 && reg->used > 0 && datasz == 2)
{
reg->used = 0;
reg->free ();
sendResponseMsg (cmdID, data, 2);
}
else
{
sendErrorMsg_P (ERRORMSG_INVALID_ARGS);
}
}
else
{
sendErrorMsg_P (ERRORMSG_INVALID_ARGS);
}
break;
}
case ARDUINO_RESET_SHIFTREG:
{
// 0 = id (currently using the datapin id)
ShiftRegister * reg = getShiftRegister (data[0]);
if (reg && reg->used > 0)
{
data[1] = reg->reset ();
sendResponseMsg (cmdID, data, 2);
}
else
{
sendErrorMsg_P (ERRORMSG_INVALID_ARGS);
}
break;
}
case ARDUINO_WRITE_SHIFTREG:
{
// 0 = id
// byte 0
// [byte1....]
ShiftRegister * reg = getShiftRegister(data[0]);
if (reg && reg->used > 0 && datasz >= 2)
{
if (reg->canwrite())
{
reg->csenable (true);
byte c = 0;
for (c=1; cwrite (data[c]);
}
// num bytes wrote
data[1] = datasz-1;
datasz = 2;
reg->latch ();
reg->csenable (false);
sendResponseMsg (cmdID, data, datasz);
}
else
{
// chip cant do write
sendErrorMsg_P (ERRORMSG_CANT_WRITE);
}
}
else
{
sendErrorMsg_P (ERRORMSG_INVALID_ARGS);
}
break;
}
case ARDUINO_READ_SHIFTREG:
{
// 0 = id
// 1 = numbytes
ShiftRegister * reg = getShiftRegister (data[0]);
if (reg && reg->used > 0 && datasz == 2)
{
if (reg->canread ())
{
reg->csenable (true);
reg->latch ();
byte c = 0;
datasz = data[1];
for (c=1; cread ();
}
reg->csenable (false);
sendResponseMsg (cmdID, data, datasz);
}
else
{
// cant read
sendErrorMsg_P( ERRORMSG_CANT_READ);
}
}
else
{
sendErrorMsg_P (ERRORMSG_INVALID_ARGS);
}
break;
}
#endif
default:
sendUnknownCmdIDMsg ();
break;
}
}
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/OctaveShiftRegisterLibrary.h 0000664 0000000 0000000 00000001736 15125212406 0030506 0 ustar 00root root 0000000 0000000 /*
* Octave arduino shift register interface
* Copyright (C) 2018 John Donoghue
*
* 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 .
*/
#include "LibraryBase.h"
class OctaveShiftRegisterLibrary : public LibraryBase
{
public:
OctaveShiftRegisterLibrary(OctaveArduinoClass &oc);
void commandHandler(uint8_t cmdID, uint8_t* inputs, uint8_t payload_size);
};
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/OctaveUltrasonicLibrary.cpp 0000664 0000000 0000000 00000010771 15125212406 0030401 0 ustar 00root root 0000000 0000000 /*
* Octave arduino ultrasonic interface
* Copyright (C) 2019 John Donoghue
*
* 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 .
*/
#include "settings.h"
#include "OctaveUltrasonicLibrary.h"
#define ARDUINO_CONFIG_ULTRASONIC 1
#define ARDUINO_READ_ULTRASONIC 2
static const char ERRORMSG_CANT_READ[] PROGMEM = "Max ultrasonics reached";
#ifdef USE_ULTRASONIC
#define MAX_ULTRASONICS 4
class Ultrasonic
{
#define USED 1
public:
uint8_t flags;
uint8_t pins[2];
uint8_t state;
Ultrasonic ();
uint8_t init (uint8_t p1, uint8_t p2);
uint8_t free () { flags = 0; return 0;}
uint32_t read ();
};
Ultrasonic::Ultrasonic ()
{
flags = 0;
}
uint8_t
Ultrasonic::init (uint8_t p1, uint8_t p2=0xff)
{
flags = USED;
pins[0] = p1;
pins[1] = p2;
if(p1 == p2)
pins[1] = 0xff;
pinMode (pins[0], OUTPUT);
digitalWrite (pins[0], LOW);
if (pins[1] != 0xff)
{
pinMode (pins[1], INPUT);
digitalWrite (pins[1], LOW);
}
return 0;
}
uint32_t
Ultrasonic::read ()
{
uint32_t duration;
digitalWrite (pins[0], LOW);
delayMicroseconds (5);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite (pins[0], HIGH);
delayMicroseconds (10);
digitalWrite (pins[0], LOW);
if (pins[1] == 0xff)
{
pinMode (pins[0], INPUT);
duration = pulseIn(pins[0], HIGH, 250);
pinMode (pins[0], OUTPUT);
}
else
{
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn (pins[1], HIGH); //, 250);
}
return duration;
}
static Ultrasonic ultrasonics[MAX_ULTRASONICS];
Ultrasonic *
getUltrasonic (uint8_t id)
{
uint8_t i;
Ultrasonic * unused = 0;
for (i=0; iinit (data[0]);
sendResponseMsg (cmdID,data, 2);
}
else if(data[1] == 1 && datasz == 3)
{
reg->init (data[0], data[2]);
sendResponseMsg (cmdID,data, 2);
}
// free
else if (data[1] == 0 && reg->flags && datasz == 2)
{
reg->free ();
sendResponseMsg(cmdID,data, 2);
}
else
{
sendErrorMsg_P (ERRORMSG_INVALID_ARGS);
}
}
else
{
sendErrorMsg_P (ERRORMSG_INVALID_ARGS);
}
break;
}
case ARDUINO_READ_ULTRASONIC:
{
// 0 = id
Ultrasonic * reg = getUltrasonic (data[0]);
if (reg && datasz == 1)
{
uint32_t v = reg->read ();
data[1] = (v>>24)&0xff;
data[2] = (v>>16)&0xff;
data[3] = (v>>8)&0xff;
data[4] = (v)&0xff;
datasz = 5;
sendResponseMsg (cmdID, data, datasz);
}
else
{
sendErrorMsg_P (ERRORMSG_INVALID_ARGS);
}
break;
}
#endif
default:
sendUnknownCmdIDMsg ();
break;
}
}
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/OctaveUltrasonicLibrary.h 0000664 0000000 0000000 00000001730 15125212406 0030041 0 ustar 00root root 0000000 0000000 /*
* Octave arduino shift register interface
* Copyright (C) 2019 John Donoghue
*
* 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 .
*/
#include "LibraryBase.h"
class OctaveUltrasonicLibrary : public LibraryBase
{
public:
OctaveUltrasonicLibrary(OctaveArduinoClass &oc);
void commandHandler(uint8_t cmdID, uint8_t* inputs, uint8_t payload_size);
};
gnu-octave-octave-arduino-deeeb99/inst/+arduinoio/lib/octave.ino 0000664 0000000 0000000 00000004112 15125212406 0025043 0 ustar 00root root 0000000 0000000 /*
* Octave arduino interface
* Copyright (C) 2018-2023 John Donoghue
*
* 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 .
*/
#include "settings.h"
#include "LibraryBase.h"
// lib manager / processing
static OctaveArduinoClass octavearduino;
// include the base library
#include "OctaveCoreLibrary.h"
OctaveCoreLibrary lib0(octavearduino);
#ifdef USE_I2C
#include "OctaveI2CLibrary.h"
OctaveI2CLibrary lib1(octavearduino);
#endif
#ifdef USE_SPI
#include "OctaveSPILibrary.h"
OctaveSPILibrary lib2(octavearduino);
#endif
#ifdef USE_SERVO
#include "OctaveServoLibrary.h"
OctaveServoLibrary lib3(octavearduino);
#endif
#ifdef USE_SHIFTREG
#include "OctaveShiftRegisterLibrary.h"
OctaveShiftRegisterLibrary lib4(octavearduino);
#endif
#ifdef USE_ROTARYENCODER
#include "OctaveRotaryEncoderLibrary.h"
OctaveRotaryEncoderLibrary lib5(octavearduino);
#endif
#ifdef USE_ULTRASONIC
#include "OctaveUltrasonicLibrary.h"
OctaveUltrasonicLibrary lib6(octavearduino);
#endif
#ifdef USE_SERIAL
#include "OctaveSerialLibrary.h"
OctaveSerialLibrary lib7(octavearduino);
#endif
// additional addons included from generated addons.h file
#include "addons.h"
void setup() {
#if defined(ARDUINO_ARCH_AVR)
// clear watchdog
// clear all flags
MCUSR = 0;
/* Write logical one to WDCE and WDE */
/* Keep old prescaler setting to prevent unintentional time-out */
WDTCSR |= _BV(WDCE) | _BV(WDE);
WDTCSR = 0;
#endif
octavearduino.init();
}
void loop() {
octavearduino.runLoop();
}
gnu-octave-octave-arduino-deeeb99/inst/+arduinoioaddons/ 0000775 0000000 0000000 00000000000 15125212406 0023500 5 ustar 00root root 0000000 0000000 gnu-octave-octave-arduino-deeeb99/inst/+arduinoioaddons/+EEPRomAddon/ 0000775 0000000 0000000 00000000000 15125212406 0025610 5 ustar 00root root 0000000 0000000 gnu-octave-octave-arduino-deeeb99/inst/+arduinoioaddons/+EEPRomAddon/EEPRom.m 0000664 0000000 0000000 00000013007 15125212406 0027056 0 ustar 00root root 0000000 0000000 ## Copyright (C) 2018-2020 John Donoghue
##
## 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
## .
classdef EEPRom < arduinoio.LibraryBase
## -*- texinfo -*-
## @deftypefn {} {} arduinoioaddons.EEPRomAddon.EEPRom
## EEPROM addon for arduino
##
## Allows read and write of uint8 data to the onboard arduino EEPROM.
##
## @subsubheading Example
## Assuming eeprom addon has been programmed into the Arduino:
## @example
## a = arduino ();
## e = addon (a, "eepromaddon/eeprom");
## write (e, 0, uint8("hello world"));
## str = uint8( read(e, 0, 11) )
## @end example
##
## @seealso{addon}
## @end deftypefn
##
## @subsubheading Properties
## @var{length} - Size of the EEPROM.
##
## @subheading Methods
## @deftypefn {} {@var{eeprom} =} EEPRom ()
## Constructor to create EEPROM device.
## @subsubheading Outputs
## @var{eeprom} - created EEPROM device.
## @end deftypefn
##
## @deftypefn {} {} erase ()
## Erase all values in EEPROM (Effectively setting the 0xFF)
## @end deftypefn
##
## @deftypefn {} {} write (@var{address}, @var{uintdata})
## Write data to EEPROM at the provided address.
## @subsubheading Inputs
## @var{address} - start address to write data to, should be an
## integer between 0 and the size of the EEPROM.
##
## @var{uintdata} a value or array of uint8 data to write to EEPROM.
## @end deftypefn
##
## @deftypefn {} {@var{data} =} read (@var{address})
## @deftypefnx {} {@var{data} =} read (@var{address}, @var{count})
## Read data from starting address of EEPROM.
## @subsubheading Inputs
## @var{address} - start address to read data from, should be an
## integer between 0 and the size of the EEPROM.
##
## @var{count} - Number of uint8 values to read from the EEPROM (default is 1)
##
## @subsubheading Outputs
## @var{data} a value or array of uint8 data read from the EEPROM.
## @end deftypefn
properties(Access = private)
len = 0;
endproperties
# commands
properties(Access = private, Constant = true)
INIT_COMMAND = hex2dec('00');
ERASE_COMMAND = hex2dec('01');
READ_COMMAND = hex2dec('02');
WRITE_COMMAND = hex2dec('03');
endproperties
properties(Access = protected, Constant = true)
LibraryName = 'EEPRomAddon/EEPRom';
DependentLibraries = {};
#ArduinoLibraryHeaderFiles = {};
CppHeaderFile = fullfile(arduinoio.FilePath(mfilename('fullpath')), 'EEPRomAddon.h');
CppClassName = 'EEPRom';
endproperties
methods
# constructor
function obj = EEPRom(parentObj)
obj.Parent = parentObj;
if nargin != 1
error ("EEPRom: expected arduino parent as only argument");
endif
obj.Pins = {};
data = sendCommand(obj.Parent, obj.LibraryName, obj.INIT_COMMAND, []);
length = uint16(data(1))*256 + uint16(data(2))
obj.len = length;
endfunction
function len = length (obj)
len = obj.len;
endfunction
function erase(obj)
cmdID = obj.ERASE_COMMAND;
sendCommand(obj.Parent, obj.LibraryName, cmdID, []);
endfunction
function value = read(obj, address, num)
cmdID = obj.READ_COMMAND;
if nargin != 2 && nargin != 3
error ("EEPRom: expected address and optional number of bytes");
endif
if nargin == 2
num = 1;
endif
if ! isnumeric(address) || address < 0 || address >= obj.len || mod(address, 1) != 0
error ("EEProm: expected address to be between 0 and %d", obj.len);
endif
if ! isnumeric(num) || num < 0 || num > 128 || mod(num, 1) != 0
error ("EEProm: num expected to be integer between 0 and %d", 128);
endif
if address + num > obj.len
error ("EEPRom: address + num (%d) is out of EEPRom bounds of %d\n", (address+num), obj.len);
endif
intval = uint16(address);
datain = [ bitshift(intval,-8) bitand(intval, 255) num];
dataout = sendCommand(obj.Parent, obj.LibraryName, cmdID, datain);
value = dataout;
endfunction
function write(obj, address, value)
cmdID = obj.WRITE_COMMAND;
if nargin != 3
error ("EEPRom: expected address and value");
endif
if ! isnumeric(address) || address < 0 || address >= obj.len || mod(address, 1) != 0
error ("expected address to be between 0 and %d", obj.len);
endif
num = numel(value);
if num < 0 || num > 128
error ("EEProm: value size expected to be between 0 and %d", 128);
endif
if (address + num > obj.len)
error ("EEPRom: address + numel(value) (%d) is out of EEPRom bounds of %d\n", (address+num), obj.len);
endif
intval = uint16(address);
datain = [ bitshift(intval,-8) bitand(intval, 255) value];
sendCommand(obj.Parent, obj.LibraryName, cmdID, datain);
endfunction
function disp (obj)
printf(" %s with properties\n", class(obj));
printf(" length = %d\n", obj.len);
endfunction
endmethods
endclassdef
gnu-octave-octave-arduino-deeeb99/inst/+arduinoioaddons/+EEPRomAddon/EEPRomAddon.h 0000664 0000000 0000000 00000004341 15125212406 0030020 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2018 John Donoghue
*
* 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
* .
*/
#include "LibraryBase.h"
#include // arduino liquid crystal library
#define EEPROM_INIT 0x00
#define EEPROM_ERASE 0x01
#define EEPROM_READ 0x02
#define EEPROM_WRITE 0x03
class EEPRom : public LibraryBase
{
public:
EEPRom(OctaveArduinoClass& a)
{
libName = "EEPRomAddon/EEProm";
a.registerLibrary(this);
}
void commandHandler(uint8_t cmdId, uint8_t* data, uint8_t datasz)
{
switch(cmdId)
{
case EEPROM_INIT:
{
uint16_t sz = EEPROM.length();
data[0] = (sz>>8)&0xff;
data[1] = (sz)&0xff;
sendResponseMsg(cmdId, data, 2);
break;
}
case EEPROM_ERASE:
{
for (int a=0;a= 3)
{
uint16_t addr = (uint16_t(data[0])<<8) | data[1];
datasz = datasz-2;
for(int i=0;i