/** * @file % !FILENAME % * * @section desc File description * * External interrupts init and acknowledge functions for % !CPUNAME % * Automatically generated by goil on % !TIMESTAMP % * from root OIL file % !OILFILENAME % * * @section copyright Copyright * * Trampoline OS * * Trampoline is copyright (c) LS2N 2005-2017 * Trampoline is protected by the French intellectual property law. * * This software is distributed under the GNU Public Licence v2 * *** * * External Interrupts initialization for the AVR-Arduino Microcontroller * * Inits are done according to the source(s) pin(s) selected for an interrupt * vector corresponding to an or a set of interrupt(s) line(s) * */ #include "tpl_machine.h" #include "Arduino.h" #define OS_START_SEC_CODE #include "tpl_memmap.h" % # look for EXTERNAL IRQ interrupt sources in COUNTERS and ISR let ITOBJ := COUNTER | ISR foreach obj in ITOBJ do if [obj::SOURCE subString: 0, 3] == "PIN" then #external interrupt if exists obj::SOURCE_S then let P:=obj::SOURCE_S let pinId := [obj::SOURCE subString: 3, 4] %void %!obj::SOURCE%_Handler();\n% end if #SOURCE structure end if #external interrupt end foreach % FUNC(void, OS_CODE) tpl_init_external_interrupts() { % ## check TODO #program the EXTERNAL interrupt pin foreach obj in ITOBJ do if [obj::SOURCE subString: 0, 3] == "PIN" then #external interrupt if exists obj::SOURCE_S then let P:=obj::SOURCE_S let pinId := [obj::SOURCE subString: 3, 4] #pullup? if P::PULL == "UP" then % pinMode(%!pinId%, INPUT_PULLUP);\n% else % pinMode(%!pinId%, INPUT);\n% end if #interrupt % attachInterrupt(digitalPinToInterrupt(%!pinId%), %!obj::SOURCE%_Handler, %!P::MODE%);\n% end if #SOURCE structure end if #external interrupt end foreach %}\n% % #define OS_STOP_SEC_CODE #include "tpl_memmap.h" /* End of file % !FILENAME % */