├── examples ├── timer │ ├── .gitignore │ ├── src │ │ ├── panicoverride.nim │ │ └── timer.nim │ ├── config.nims │ ├── README.md │ └── timer.nimble ├── progmem │ ├── .gitignore │ ├── src │ │ └── panicoverride.nim │ ├── config.nims │ ├── README.md │ ├── scripts │ │ └── serial_read │ └── progmem.nimble ├── usart │ ├── .gitignore │ ├── src │ │ ├── panicoverride.nim │ │ ├── usart9bits.nim │ │ └── usart.nim │ ├── config.nims │ ├── scripts │ │ └── serial_test │ ├── README.md │ └── usart.nimble ├── arduino_uno_blink │ ├── .gitignore │ ├── src │ │ ├── panicoverride.nim │ │ ├── counter.nim │ │ └── arduino_uno_blink.nim │ ├── config.nims │ ├── README.md │ └── arduino_uno_blink.nimble └── bootloader │ ├── .gitignore │ ├── src │ ├── panicoverride.nim │ ├── application.nim │ ├── delay.nim │ └── bootloader.nim │ ├── config.nims │ ├── bootloader.nimble │ ├── scripts │ └── embed │ └── README.md ├── .gitignore ├── avr_io.nimble ├── src └── avr_io │ ├── interrupt │ └── private │ │ ├── attiny13.nim │ │ ├── attiny13a.nim │ │ ├── attiny26.nim │ │ ├── attiny25.nim │ │ ├── attiny45.nim │ │ ├── attiny85.nim │ │ ├── attiny43u.nim │ │ ├── attiny24.nim │ │ ├── attiny44.nim │ │ ├── attiny84.nim │ │ ├── attiny24a.nim │ │ ├── attiny44a.nim │ │ ├── attiny84a.nim │ │ ├── atmega8515.nim │ │ ├── atmega8.nim │ │ ├── atmega8a.nim │ │ ├── attiny2313.nim │ │ ├── attiny48.nim │ │ ├── attiny87.nim │ │ ├── attiny88.nim │ │ ├── at90pwm161.nim │ │ ├── at90pwm81.nim │ │ ├── attiny167.nim │ │ ├── atmega16.nim │ │ ├── atmega16a.nim │ │ ├── atmega16hva.nim │ │ ├── atmega32.nim │ │ ├── atmega32a.nim │ │ ├── atmega8535.nim │ │ ├── atmega8hva.nim │ │ ├── attiny2313a.nim │ │ ├── attiny4313.nim │ │ ├── attiny261.nim │ │ ├── attiny261a.nim │ │ ├── attiny461.nim │ │ ├── attiny461a.nim │ │ ├── attiny861.nim │ │ ├── attiny861a.nim │ │ ├── atmega165a.nim │ │ ├── atmega165p.nim │ │ ├── atmega165pa.nim │ │ ├── atmega325.nim │ │ ├── atmega325a.nim │ │ ├── atmega325p.nim │ │ ├── atmega325pa.nim │ │ ├── atmega645.nim │ │ ├── atmega645a.nim │ │ ├── atmega645p.nim │ │ ├── atmega169a.nim │ │ ├── atmega169p.nim │ │ ├── atmega329.nim │ │ ├── atmega329a.nim │ │ ├── atmega329p.nim │ │ ├── atmega406.nim │ │ ├── atmega649.nim │ │ ├── atmega649a.nim │ │ ├── atmega649p.nim │ │ ├── atmega169pa.nim │ │ ├── atmega329pa.nim │ │ ├── atmega3250.nim │ │ ├── atmega3250a.nim │ │ ├── atmega3250p.nim │ │ ├── atmega3250pa.nim │ │ ├── atmega3290.nim │ │ ├── atmega3290a.nim │ │ ├── atmega3290p.nim │ │ ├── atmega3290pa.nim │ │ ├── atmega6450.nim │ │ ├── atmega6450a.nim │ │ ├── atmega6450p.nim │ │ ├── atmega6490.nim │ │ ├── atmega6490a.nim │ │ ├── atmega6490p.nim │ │ ├── atmega64hve2.nim │ │ ├── atmega168.nim │ │ ├── atmega168a.nim │ │ ├── atmega168p.nim │ │ ├── atmega168pa.nim │ │ ├── atmega328.nim │ │ ├── atmega328p.nim │ │ ├── atmega48.nim │ │ ├── atmega48a.nim │ │ ├── atmega48p.nim │ │ ├── atmega48pa.nim │ │ ├── atmega88.nim │ │ ├── atmega88a.nim │ │ ├── atmega88p.nim │ │ ├── atmega88pa.nim │ │ ├── attiny828.nim │ │ ├── atmega168pb.nim │ │ ├── atmega48pb.nim │ │ ├── atmega88pb.nim │ │ ├── atmega162.nim │ │ ├── atmega644.nim │ │ ├── attiny1634.nim │ │ ├── at90usb82.nim │ │ ├── atmega8u2.nim │ │ ├── at90usb162.nim │ │ ├── atmega16hvb.nim │ │ ├── atmega16u2.nim │ │ ├── atmega32hvb.nim │ │ ├── atmega32u2.nim │ │ ├── atmega16hvbrevb.nim │ │ ├── atmega32hvbrevb.nim │ │ ├── attiny441.nim │ │ ├── attiny841.nim │ │ ├── atmega164a.nim │ │ ├── atmega164p.nim │ │ ├── atmega164pa.nim │ │ ├── atmega16m1.nim │ │ ├── atmega324a.nim │ │ ├── atmega324p.nim │ │ ├── atmega324pa.nim │ │ ├── atmega32c1.nim │ │ ├── atmega32m1.nim │ │ ├── atmega644a.nim │ │ ├── atmega644p.nim │ │ ├── atmega644pa.nim │ │ ├── atmega64c1.nim │ │ ├── atmega64m1.nim │ │ ├── atmegas64m1.nim │ │ ├── at90pwm1.nim │ │ ├── at90pwm216.nim │ │ ├── at90pwm2b.nim │ │ ├── at90pwm3.nim │ │ ├── at90pwm316.nim │ │ ├── at90pwm3b.nim │ │ ├── atmega64.nim │ │ ├── atmega128.nim │ │ ├── atmega1284.nim │ │ ├── atmega1284p.nim │ │ ├── atmega128a.nim │ │ ├── atmega64a.nim │ │ ├── atmegas128.nim │ │ ├── at90can128.nim │ │ ├── at90can32.nim │ │ ├── at90can64.nim │ │ ├── at90usb646.nim │ │ ├── at90usb647.nim │ │ ├── at90usb1286.nim │ │ ├── at90usb1287.nim │ │ ├── atmega16u4.nim │ │ ├── atmega32u4.nim │ │ ├── atmega328pb.nim │ │ ├── atmega324pb.nim │ │ ├── atmega1280.nim │ │ ├── atmega1281.nim │ │ ├── atmega2560.nim │ │ ├── atmega2561.nim │ │ ├── atmega640.nim │ │ ├── atmega64rfr2.nim │ │ ├── atmega1284rfr2.nim │ │ ├── atmega128rfr2.nim │ │ ├── atmega2564rfr2.nim │ │ ├── atmega256rfr2.nim │ │ ├── atmega644rfr2.nim │ │ └── atmega128rfa1.nim │ ├── private │ ├── attiny13.nim │ ├── attiny13a.nim │ ├── attiny26.nim │ ├── attiny25.nim │ ├── attiny45.nim │ ├── attiny85.nim │ ├── attiny43u.nim │ └── attiny2313.nim │ └── system.nim ├── LICENSE └── scripts └── supported.nims /examples/timer/.gitignore: -------------------------------------------------------------------------------- 1 | .nimcache 2 | src/timer 3 | *.elf 4 | *.hex 5 | *.bin -------------------------------------------------------------------------------- /examples/progmem/.gitignore: -------------------------------------------------------------------------------- 1 | .nimcache/ 2 | src/progmem 3 | *.elf 4 | *.hex 5 | *.bin -------------------------------------------------------------------------------- /examples/usart/.gitignore: -------------------------------------------------------------------------------- 1 | .nimcache/ 2 | src/usart 3 | src/usart9bits 4 | *.elf 5 | *.hex 6 | *.bin -------------------------------------------------------------------------------- /examples/arduino_uno_blink/.gitignore: -------------------------------------------------------------------------------- 1 | .nimcache/ 2 | src/arduino_uno_blink 3 | *.elf 4 | *.hex 5 | *.bin -------------------------------------------------------------------------------- /examples/bootloader/.gitignore: -------------------------------------------------------------------------------- 1 | .nimcache/ 2 | src/bootloader 3 | src/application 4 | *.elf 5 | *.hex 6 | *.bin -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vscode/ 3 | nimclipboard/ 4 | deps/ 5 | scripts/data 6 | scripts/*.py 7 | scripts/*.sh 8 | nim.cfg -------------------------------------------------------------------------------- /avr_io.nimble: -------------------------------------------------------------------------------- 1 | # Package 2 | 3 | version = "0.7.0" 4 | author = "Gianmarco Marcello" 5 | description = "AVR registers, interrupts, progmem and peripheral support in nim!" 6 | license = "BSD-3-Clause" 7 | srcDir = "src" 8 | 9 | 10 | # Dependencies 11 | 12 | requires "nim >= 2.0.10" 13 | -------------------------------------------------------------------------------- /examples/timer/src/panicoverride.nim: -------------------------------------------------------------------------------- 1 | proc exit(code: int) {.importc, header: "", cdecl.} 2 | 3 | {.push stack_trace: off, profiler:off.} 4 | 5 | proc rawoutput(s: string) = discard 6 | 7 | proc panic(s: string) = 8 | rawoutput(s) 9 | while true: 10 | discard 11 | exit(1) 12 | 13 | {.pop.} 14 | -------------------------------------------------------------------------------- /examples/usart/src/panicoverride.nim: -------------------------------------------------------------------------------- 1 | proc exit(code: int) {.importc, header: "", cdecl.} 2 | 3 | {.push stack_trace: off, profiler:off.} 4 | 5 | proc rawoutput(s: string) = discard 6 | 7 | proc panic(s: string) = 8 | rawoutput(s) 9 | while true: 10 | discard 11 | exit(1) 12 | 13 | {.pop.} 14 | -------------------------------------------------------------------------------- /examples/bootloader/src/panicoverride.nim: -------------------------------------------------------------------------------- 1 | proc exit(code: int) {.importc, header: "", cdecl.} 2 | 3 | {.push stack_trace: off, profiler:off.} 4 | 5 | proc rawoutput(s: string) = discard 6 | 7 | proc panic(s: string) = 8 | rawoutput(s) 9 | while true: 10 | discard 11 | exit(1) 12 | 13 | {.pop.} 14 | -------------------------------------------------------------------------------- /examples/progmem/src/panicoverride.nim: -------------------------------------------------------------------------------- 1 | proc exit(code: int) {.importc, header: "", cdecl.} 2 | 3 | {.push stack_trace: off, profiler:off.} 4 | 5 | proc rawoutput(s: string) = discard 6 | 7 | proc panic(s: string) = 8 | rawoutput(s) 9 | while true: 10 | discard 11 | exit(1) 12 | 13 | {.pop.} 14 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny13.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | Tim0OvfVect = 3, 6 | EeRdyVect = 4, 7 | AnaCompVect = 5, 8 | Tim0CompAVect = 6, 9 | Tim0CompBVect = 7, 10 | WdtVect = 8, 11 | AdcVect = 9, 12 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny13a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | Tim0OvfVect = 3, 6 | EeRdyVect = 4, 7 | AnaCompVect = 5, 8 | Tim0CompAVect = 6, 9 | Tim0CompBVect = 7, 10 | WdtVect = 8, 11 | AdcVect = 9, 12 | -------------------------------------------------------------------------------- /examples/arduino_uno_blink/src/panicoverride.nim: -------------------------------------------------------------------------------- 1 | proc exit(code: int) {.importc, header: "", cdecl.} 2 | 3 | {.push stack_trace: off, profiler:off.} 4 | 5 | proc rawoutput(s: string) = discard 6 | 7 | proc panic(s: string) = 8 | rawoutput(s) 9 | while true: 10 | discard 11 | exit(1) 12 | 13 | {.pop.} 14 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny26.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | IoPinsVect = 2, 5 | Timer1CmpaVect = 3, 6 | Timer1CmpbVect = 4, 7 | Timer1Ovf1Vect = 5, 8 | Timer0Ovf0Vect = 6, 9 | UsiStrtVect = 7, 10 | UsiOvfVect = 8, 11 | EeRdyVect = 9, 12 | AnaCompVect = 10, 13 | AdcVect = 11, 14 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny25.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | Timer1CompAVect = 3, 6 | Timer1OvfVect = 4, 7 | Timer0OvfVect = 5, 8 | EeRdyVect = 6, 9 | AnaCompVect = 7, 10 | AdcVect = 8, 11 | Timer1CompBVect = 9, 12 | Timer0CompAVect = 10, 13 | Timer0CompBVect = 11, 14 | WdtVect = 12, 15 | UsiStartVect = 13, 16 | UsiOvfVect = 14, 17 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny45.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | Timer1CompAVect = 3, 6 | Timer1OvfVect = 4, 7 | Timer0OvfVect = 5, 8 | EeRdyVect = 6, 9 | AnaCompVect = 7, 10 | AdcVect = 8, 11 | Timer1CompBVect = 9, 12 | Timer0CompAVect = 10, 13 | Timer0CompBVect = 11, 14 | WdtVect = 12, 15 | UsiStartVect = 13, 16 | UsiOvfVect = 14, 17 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny85.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | Timer1CompAVect = 3, 6 | Timer1OvfVect = 4, 7 | Timer0OvfVect = 5, 8 | EeRdyVect = 6, 9 | AnaCompVect = 7, 10 | AdcVect = 8, 11 | Timer1CompBVect = 9, 12 | Timer0CompAVect = 10, 13 | Timer0CompBVect = 11, 14 | WdtVect = 12, 15 | UsiStartVect = 13, 16 | UsiOvfVect = 14, 17 | -------------------------------------------------------------------------------- /examples/progmem/config.nims: -------------------------------------------------------------------------------- 1 | switch("os", "standalone") 2 | switch("cpu", "avr") 3 | switch("gc", "none") 4 | switch("define", "release") 5 | switch("define", "USING_ATMEGA328P") 6 | switch("nimcache", ".nimcache") 7 | 8 | switch("cc", "gcc") 9 | switch("avr.standalone.gcc.options.linker", "-static") 10 | switch("avr.standalone.gcc.exe", "avr-gcc") 11 | switch("avr.standalone.gcc.linkerexe", "avr-gcc") 12 | 13 | when defined(windows): 14 | switch("gcc.options.always", "-w -fmax-errors=3") 15 | -------------------------------------------------------------------------------- /examples/timer/config.nims: -------------------------------------------------------------------------------- 1 | switch("os", "standalone") 2 | switch("cpu", "avr") 3 | switch("gc", "none") 4 | switch("define", "release") 5 | switch("define", "USING_ATMEGA328P") 6 | switch("nimcache", ".nimcache") 7 | 8 | switch("cc", "gcc") 9 | switch("avr.standalone.gcc.options.linker", "-static") 10 | switch("avr.standalone.gcc.exe", "avr-gcc") 11 | switch("avr.standalone.gcc.linkerexe", "avr-gcc") 12 | 13 | when defined(windows): 14 | switch("gcc.options.always", "-w -fmax-errors=3") 15 | -------------------------------------------------------------------------------- /examples/usart/config.nims: -------------------------------------------------------------------------------- 1 | switch("os", "standalone") 2 | switch("cpu", "avr") 3 | switch("gc", "none") 4 | switch("define", "release") 5 | switch("define", "USING_ATMEGA328P") 6 | switch("nimcache", ".nimcache") 7 | 8 | switch("cc", "gcc") 9 | switch("avr.standalone.gcc.options.linker", "-static") 10 | switch("avr.standalone.gcc.exe", "avr-gcc") 11 | switch("avr.standalone.gcc.linkerexe", "avr-gcc") 12 | 13 | when defined(windows): 14 | switch("gcc.options.always", "-w -fmax-errors=3") 15 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny43u.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | WdtVect = 4, 7 | Tim1CompAVect = 5, 8 | Tim1CompBVect = 6, 9 | Tim1OvfVect = 7, 10 | Tim0CompAVect = 8, 11 | Tim0CompBVect = 9, 12 | Tim0OvfVect = 10, 13 | AnaCompVect = 11, 14 | AdcVect = 12, 15 | EeRdyVect = 13, 16 | UsiStartVect = 14, 17 | UsiOvfVect = 15, 18 | -------------------------------------------------------------------------------- /examples/arduino_uno_blink/config.nims: -------------------------------------------------------------------------------- 1 | switch("os", "standalone") 2 | switch("cpu", "avr") 3 | switch("gc", "none") 4 | switch("define", "release") 5 | switch("define", "USING_ATMEGA328P") 6 | switch("nimcache", ".nimcache") 7 | 8 | switch("cc", "gcc") 9 | switch("avr.standalone.gcc.options.linker", "-static") 10 | switch("avr.standalone.gcc.exe", "avr-gcc") 11 | switch("avr.standalone.gcc.linkerexe", "avr-gcc") 12 | 13 | when defined(windows): 14 | switch("gcc.options.always", "-w -fmax-errors=3") 15 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny24.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | ExtInt0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | WdtVect = 4, 7 | Tim1CaptVect = 5, 8 | Tim1CompAVect = 6, 9 | Tim1CompBVect = 7, 10 | Tim1OvfVect = 8, 11 | Tim0CompAVect = 9, 12 | Tim0CompBVect = 10, 13 | Tim0OvfVect = 11, 14 | AnaCompVect = 12, 15 | AdcVect = 13, 16 | EeRdyVect = 14, 17 | UsiStrVect = 15, 18 | UsiOvfVect = 16, 19 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny44.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | ExtInt0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | WdtVect = 4, 7 | Tim1CaptVect = 5, 8 | Tim1CompAVect = 6, 9 | Tim1CompBVect = 7, 10 | Tim1OvfVect = 8, 11 | Tim0CompAVect = 9, 12 | Tim0CompBVect = 10, 13 | Tim0OvfVect = 11, 14 | AnaCompVect = 12, 15 | AdcVect = 13, 16 | EeRdyVect = 14, 17 | UsiStrVect = 15, 18 | UsiOvfVect = 16, 19 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny84.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | ExtInt0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | WdtVect = 4, 7 | Tim1CaptVect = 5, 8 | Tim1CompAVect = 6, 9 | Tim1CompBVect = 7, 10 | Tim1OvfVect = 8, 11 | Tim0CompAVect = 9, 12 | Tim0CompBVect = 10, 13 | Tim0OvfVect = 11, 14 | AnaCompVect = 12, 15 | AdcVect = 13, 16 | EeRdyVect = 14, 17 | UsiStrVect = 15, 18 | UsiOvfVect = 16, 19 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny24a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | ExtInt0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | WdtVect = 4, 7 | Tim1CaptVect = 5, 8 | Tim1CompAVect = 6, 9 | Tim1CompBVect = 7, 10 | Tim1OvfVect = 8, 11 | Tim0CompAVect = 9, 12 | Tim0CompBVect = 10, 13 | Tim0OvfVect = 11, 14 | AnaCompVect = 12, 15 | AdcVect = 13, 16 | EeRdyVect = 14, 17 | UsiStrVect = 15, 18 | UsiOvfVect = 16, 19 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny44a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | ExtInt0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | WdtVect = 4, 7 | Tim1CaptVect = 5, 8 | Tim1CompAVect = 6, 9 | Tim1CompBVect = 7, 10 | Tim1OvfVect = 8, 11 | Tim0CompAVect = 9, 12 | Tim0CompBVect = 10, 13 | Tim0OvfVect = 11, 14 | AnaCompVect = 12, 15 | AdcVect = 13, 16 | EeRdyVect = 14, 17 | UsiStrVect = 15, 18 | UsiOvfVect = 16, 19 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny84a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | ExtInt0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | WdtVect = 4, 7 | Tim1CaptVect = 5, 8 | Tim1CompAVect = 6, 9 | Tim1CompBVect = 7, 10 | Tim1OvfVect = 8, 11 | Tim0CompAVect = 9, 12 | Tim0CompBVect = 10, 13 | Tim0OvfVect = 11, 14 | AnaCompVect = 12, 15 | AdcVect = 13, 16 | EeRdyVect = 14, 17 | UsiStrVect = 15, 18 | UsiOvfVect = 16, 19 | -------------------------------------------------------------------------------- /examples/bootloader/config.nims: -------------------------------------------------------------------------------- 1 | switch("os", "standalone") 2 | switch("cpu", "avr") 3 | switch("gc", "none") 4 | switch("define", "release") 5 | switch("checks", "off") 6 | switch("opt", "size") 7 | switch("define", "USING_ATMEGA644") 8 | switch("nimcache", ".nimcache") 9 | 10 | switch("cc", "gcc") 11 | switch("avr.standalone.gcc.options.linker", "-static") 12 | switch("avr.standalone.gcc.exe", "avr-gcc") 13 | switch("avr.standalone.gcc.linkerexe", "avr-gcc") 14 | 15 | when defined(windows): 16 | switch("gcc.options.always", "-w -fmax-errors=3") 17 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega8515.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Timer1CaptVect = 3, 6 | Timer1CompAVect = 4, 7 | Timer1CompBVect = 5, 8 | Timer1OvfVect = 6, 9 | Timer0OvfVect = 7, 10 | SpiStcVect = 8, 11 | UsartRxVect = 9, 12 | UsartUdreVect = 10, 13 | UsartTxVect = 11, 14 | AnaCompVect = 12, 15 | Int2Vect = 13, 16 | Timer0CompVect = 14, 17 | EeRdyVect = 15, 18 | SpmRdyVect = 16, 19 | -------------------------------------------------------------------------------- /examples/arduino_uno_blink/src/counter.nim: -------------------------------------------------------------------------------- 1 | import volatile 2 | 3 | type 4 | Counter = object 5 | threshold: int 6 | ctr: int 7 | 8 | proc newCounter*(threshold: int): Counter = 9 | return Counter(threshold: threshold, ctr: 0) 10 | 11 | proc `inc`*(c: var Counter) = 12 | let count = volatileLoad(addr c.ctr) 13 | volatileStore(addr c.ctr, count + 1) 14 | 15 | proc checkThreshold*(c: var Counter): bool = 16 | let count = volatileLoad(addr c.ctr) 17 | count == c.threshold 18 | 19 | proc reset*(c: var Counter) = 20 | volatileStore(addr c.ctr, 0) 21 | -------------------------------------------------------------------------------- /examples/usart/scripts/serial_test: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import serial 4 | import struct 5 | import sys 6 | 7 | def do8bit(): 8 | try: 9 | while True: 10 | port = "/dev/ttyACM0" 11 | if len(sys.argv) == 2: 12 | port = sys.argv[1] 13 | 14 | c = serial.Serial(port=port, baudrate=9600) 15 | d = input("Insert any word: ") 16 | dd = f"{d}\n".encode() 17 | c.write(dd) 18 | print("Received: ", c.readline()) 19 | except KeyboardInterrupt: 20 | c.close() 21 | 22 | 23 | if __name__ == "__main__": 24 | do8bit() -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega8.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Timer2CompVect = 3, 6 | Timer2OvfVect = 4, 7 | Timer1CaptVect = 5, 8 | Timer1CompAVect = 6, 9 | Timer1CompBVect = 7, 10 | Timer1OvfVect = 8, 11 | Timer0OvfVect = 9, 12 | SpiStcVect = 10, 13 | UsartRxcVect = 11, 14 | UsartUdreVect = 12, 15 | UsartTxcVect = 13, 16 | AdcVect = 14, 17 | EeRdyVect = 15, 18 | AnaCompVect = 16, 19 | TwiVect = 17, 20 | SpmRdyVect = 18, 21 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega8a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Timer2CompVect = 3, 6 | Timer2OvfVect = 4, 7 | Timer1CaptVect = 5, 8 | Timer1CompAVect = 6, 9 | Timer1CompBVect = 7, 10 | Timer1OvfVect = 8, 11 | Timer0OvfVect = 9, 12 | SpiStcVect = 10, 13 | UsartRxcVect = 11, 14 | UsartUdreVect = 12, 15 | UsartTxcVect = 13, 16 | AdcVect = 14, 17 | EeRdyVect = 15, 18 | AnaCompVect = 16, 19 | TwiVect = 17, 20 | SpmRdyVect = 18, 21 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny2313.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Timer1CaptVect = 3, 6 | Timer1CompAVect = 4, 7 | Timer1OvfVect = 5, 8 | Timer0OvfVect = 6, 9 | UsartRxVect = 7, 10 | UsartUdreVect = 8, 11 | UsartTxVect = 9, 12 | AnaCompVect = 10, 13 | PCIntVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer0CompAVect = 13, 16 | Timer0CompBVect = 14, 17 | UsiStartVect = 15, 18 | UsiOverflowVect = 16, 19 | EepromReadyVect = 17, 20 | WdtOverflowVect = 18, 21 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny48.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | PCInt3Vect = 6, 9 | WdtVect = 7, 10 | Timer1CaptVect = 8, 11 | Timer1CompAVect = 9, 12 | Timer1CompBVect = 10, 13 | Timer1OvfVect = 11, 14 | Timer0CompAVect = 12, 15 | Timer0CompBVect = 13, 16 | Timer0OvfVect = 14, 17 | SpiStcVect = 15, 18 | AdcVect = 16, 19 | EeRdyVect = 17, 20 | AnalogCompVect = 18, 21 | TwiVect = 19, 22 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny87.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | WdtVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompAVect = 10, 13 | Timer0OvfVect = 11, 14 | LinTcVect = 12, 15 | LinErrVect = 13, 16 | SpiStcVect = 14, 17 | AdcVect = 15, 18 | EeRdyVect = 16, 19 | AnaCompVect = 17, 20 | UsiStartVect = 18, 21 | UsiOvfVect = 19, 22 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny88.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | PCInt3Vect = 6, 9 | WdtVect = 7, 10 | Timer1CaptVect = 8, 11 | Timer1CompAVect = 9, 12 | Timer1CompBVect = 10, 13 | Timer1OvfVect = 11, 14 | Timer0CompAVect = 12, 15 | Timer0CompBVect = 13, 16 | Timer0OvfVect = 14, 17 | SpiStcVect = 15, 18 | AdcVect = 16, 19 | EeRdyVect = 17, 20 | AnalogCompVect = 18, 21 | TwiVect = 19, 22 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/at90pwm161.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Psc2CaptVect = 1, 4 | Psc2EcVect = 2, 5 | Psc2EecVect = 3, 6 | Psc0CaptVect = 4, 7 | Psc0EcVect = 5, 8 | Psc0EecVect = 6, 9 | AnalogComp1Vect = 7, 10 | AnalogComp2Vect = 8, 11 | AnalogComp3Vect = 9, 12 | Int0Vect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1OvfVect = 12, 15 | AdcVect = 13, 16 | Int1Vect = 14, 17 | SpiStcVect = 15, 18 | Int2Vect = 16, 19 | WdtVect = 17, 20 | EeReadyVect = 18, 21 | SpmReadyVect = 19, 22 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/at90pwm81.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Psc2CaptVect = 1, 4 | Psc2EcVect = 2, 5 | Psc2EecVect = 3, 6 | Psc0CaptVect = 4, 7 | Psc0EcVect = 5, 8 | Psc0EecVect = 6, 9 | AnalogComp1Vect = 7, 10 | AnalogComp2Vect = 8, 11 | AnalogComp3Vect = 9, 12 | Int0Vect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1OvfVect = 12, 15 | AdcVect = 13, 16 | Int1Vect = 14, 17 | SpiStcVect = 15, 18 | Int2Vect = 16, 19 | WdtVect = 17, 20 | EeReadyVect = 18, 21 | SpmReadyVect = 19, 22 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny167.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | WdtVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompAVect = 10, 13 | Timer0OvfVect = 11, 14 | LinTcVect = 12, 15 | LinErrVect = 13, 16 | SpiStcVect = 14, 17 | AdcVect = 15, 18 | EeRdyVect = 16, 19 | AnaCompVect = 17, 20 | UsiStartVect = 18, 21 | UsiOvfVect = 19, 22 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega16.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Timer2CompVect = 3, 6 | Timer2OvfVect = 4, 7 | Timer1CaptVect = 5, 8 | Timer1CompAVect = 6, 9 | Timer1CompBVect = 7, 10 | Timer1OvfVect = 8, 11 | Timer0OvfVect = 9, 12 | SpiStcVect = 10, 13 | UsartRxcVect = 11, 14 | UsartUdreVect = 12, 15 | UsartTxcVect = 13, 16 | AdcVect = 14, 17 | EeRdyVect = 15, 18 | AnaCompVect = 16, 19 | TwiVect = 17, 20 | Int2Vect = 18, 21 | Timer0CompVect = 19, 22 | SpmRdyVect = 20, 23 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega16a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Timer2CompVect = 3, 6 | Timer2OvfVect = 4, 7 | Timer1CaptVect = 5, 8 | Timer1CompAVect = 6, 9 | Timer1CompBVect = 7, 10 | Timer1OvfVect = 8, 11 | Timer0OvfVect = 9, 12 | SpiStcVect = 10, 13 | UsartRxcVect = 11, 14 | UsartUdreVect = 12, 15 | UsartTxcVect = 13, 16 | AdcVect = 14, 17 | EeRdyVect = 15, 18 | AnaCompVect = 16, 19 | TwiVect = 17, 20 | Int2Vect = 18, 21 | Timer0CompVect = 19, 22 | SpmRdyVect = 20, 23 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega16hva.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | BpintVect = 1, 4 | VregmonVect = 2, 5 | Int0Vect = 3, 6 | Int1Vect = 4, 7 | Int2Vect = 5, 8 | WdtVect = 6, 9 | Timer1IcVect = 7, 10 | Timer1CompAVect = 8, 11 | Timer1CompBVect = 9, 12 | Timer1OvfVect = 10, 13 | Timer0IcVect = 11, 14 | Timer0CompAVect = 12, 15 | Timer0CompBVect = 13, 16 | Timer0OvfVect = 14, 17 | SpiStcVect = 15, 18 | VadcVect = 16, 19 | CcadcConvVect = 17, 20 | CcadcRegCurVect = 18, 21 | CcadcAccVect = 19, 22 | EeReadyVect = 20, 23 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega32.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | UsartRxcVect = 13, 16 | UsartUdreVect = 14, 17 | UsartTxcVect = 15, 18 | AdcVect = 16, 19 | EeRdyVect = 17, 20 | AnaCompVect = 18, 21 | TwiVect = 19, 22 | SpmRdyVect = 20, 23 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega32a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | UsartRxcVect = 13, 16 | UsartUdreVect = 14, 17 | UsartTxcVect = 15, 18 | AdcVect = 16, 19 | EeRdyVect = 17, 20 | AnaCompVect = 18, 21 | TwiVect = 19, 22 | SpmRdyVect = 20, 23 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega8535.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Timer2CompVect = 3, 6 | Timer2OvfVect = 4, 7 | Timer1CaptVect = 5, 8 | Timer1CompAVect = 6, 9 | Timer1CompBVect = 7, 10 | Timer1OvfVect = 8, 11 | Timer0OvfVect = 9, 12 | SpiStcVect = 10, 13 | UsartRxVect = 11, 14 | UsartUdreVect = 12, 15 | UsartTxVect = 13, 16 | AdcVect = 14, 17 | EeRdyVect = 15, 18 | AnaCompVect = 16, 19 | TwiVect = 17, 20 | Int2Vect = 18, 21 | Timer0CompVect = 19, 22 | SpmRdyVect = 20, 23 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega8hva.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | BpintVect = 1, 4 | VregmonVect = 2, 5 | Int0Vect = 3, 6 | Int1Vect = 4, 7 | Int2Vect = 5, 8 | WdtVect = 6, 9 | Timer1IcVect = 7, 10 | Timer1CompAVect = 8, 11 | Timer1CompBVect = 9, 12 | Timer1OvfVect = 10, 13 | Timer0IcVect = 11, 14 | Timer0CompAVect = 12, 15 | Timer0CompBVect = 13, 16 | Timer0OvfVect = 14, 17 | SpiStcVect = 15, 18 | VadcVect = 16, 19 | CcadcConvVect = 17, 20 | CcadcRegCurVect = 18, 21 | CcadcAccVect = 19, 22 | EeReadyVect = 20, 23 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny2313a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Timer1CaptVect = 3, 6 | Timer1CompAVect = 4, 7 | Timer1OvfVect = 5, 8 | Timer0OvfVect = 6, 9 | UsartRxVect = 7, 10 | UsartUdreVect = 8, 11 | UsartTxVect = 9, 12 | AnaCompVect = 10, 13 | PCIntBVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer0CompAVect = 13, 16 | Timer0CompBVect = 14, 17 | UsiStartVect = 15, 18 | UsiOverflowVect = 16, 19 | EepromReadyVect = 17, 20 | WdtOverflowVect = 18, 21 | PCIntAVect = 19, 22 | PCIntDVect = 20, 23 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny4313.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Timer1CaptVect = 3, 6 | Timer1CompAVect = 4, 7 | Timer1OvfVect = 5, 8 | Timer0OvfVect = 6, 9 | UsartRxVect = 7, 10 | UsartUdreVect = 8, 11 | UsartTxVect = 9, 12 | AnaCompVect = 10, 13 | PCIntBVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer0CompAVect = 13, 16 | Timer0CompBVect = 14, 17 | UsiStartVect = 15, 18 | UsiOverflowVect = 16, 19 | EepromReadyVect = 17, 20 | WdtOverflowVect = 18, 21 | PCIntAVect = 19, 22 | PCIntDVect = 20, 23 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny261.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCIntVect = 2, 5 | Timer1CompAVect = 3, 6 | Timer1CompBVect = 4, 7 | Timer1OvfVect = 5, 8 | Timer0OvfVect = 6, 9 | UsiStartVect = 7, 10 | UsiOvfVect = 8, 11 | EeRdyVect = 9, 12 | AnaCompVect = 10, 13 | AdcVect = 11, 14 | WdtVect = 12, 15 | Int1Vect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0CaptVect = 16, 19 | Timer1CompDVect = 17, 20 | FaultProtectionVect = 18, 21 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny261a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCIntVect = 2, 5 | Timer1CompAVect = 3, 6 | Timer1CompBVect = 4, 7 | Timer1OvfVect = 5, 8 | Timer0OvfVect = 6, 9 | UsiStartVect = 7, 10 | UsiOvfVect = 8, 11 | EeRdyVect = 9, 12 | AnaCompVect = 10, 13 | AdcVect = 11, 14 | WdtVect = 12, 15 | Int1Vect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0CaptVect = 16, 19 | Timer1CompDVect = 17, 20 | FaultProtectionVect = 18, 21 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny461.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCIntVect = 2, 5 | Timer1CompAVect = 3, 6 | Timer1CompBVect = 4, 7 | Timer1OvfVect = 5, 8 | Timer0OvfVect = 6, 9 | UsiStartVect = 7, 10 | UsiOvfVect = 8, 11 | EeRdyVect = 9, 12 | AnaCompVect = 10, 13 | AdcVect = 11, 14 | WdtVect = 12, 15 | Int1Vect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0CaptVect = 16, 19 | Timer1CompDVect = 17, 20 | FaultProtectionVect = 18, 21 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny461a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCIntVect = 2, 5 | Timer1CompAVect = 3, 6 | Timer1CompBVect = 4, 7 | Timer1OvfVect = 5, 8 | Timer0OvfVect = 6, 9 | UsiStartVect = 7, 10 | UsiOvfVect = 8, 11 | EeRdyVect = 9, 12 | AnaCompVect = 10, 13 | AdcVect = 11, 14 | WdtVect = 12, 15 | Int1Vect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0CaptVect = 16, 19 | Timer1CompDVect = 17, 20 | FaultProtectionVect = 18, 21 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny861.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCIntVect = 2, 5 | Timer1CompAVect = 3, 6 | Timer1CompBVect = 4, 7 | Timer1OvfVect = 5, 8 | Timer0OvfVect = 6, 9 | UsiStartVect = 7, 10 | UsiOvfVect = 8, 11 | EeRdyVect = 9, 12 | AnaCompVect = 10, 13 | AdcVect = 11, 14 | WdtVect = 12, 15 | Int1Vect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0CaptVect = 16, 19 | Timer1CompDVect = 17, 20 | FaultProtectionVect = 18, 21 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny861a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCIntVect = 2, 5 | Timer1CompAVect = 3, 6 | Timer1CompBVect = 4, 7 | Timer1OvfVect = 5, 8 | Timer0OvfVect = 6, 9 | UsiStartVect = 7, 10 | UsiOvfVect = 8, 11 | EeRdyVect = 9, 12 | AnaCompVect = 10, 13 | AdcVect = 11, 14 | WdtVect = 12, 15 | Int1Vect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0CaptVect = 16, 19 | Timer1CompDVect = 17, 20 | FaultProtectionVect = 18, 21 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega165a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega165p.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega165pa.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega325.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega325a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega325p.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega325pa.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega645.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega645a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega645p.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega169a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | LcdVect = 22, 25 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega169p.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | LcdVect = 22, 25 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega329.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | LcdVect = 22, 25 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega329a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | LcdVect = 22, 25 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega329p.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | LcdVect = 22, 25 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega406.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | BpintVect = 1, 4 | Int0Vect = 2, 5 | Int1Vect = 3, 6 | Int2Vect = 4, 7 | Int3Vect = 5, 8 | PCInt0Vect = 6, 9 | PCInt1Vect = 7, 10 | WdtVect = 8, 11 | WakeUpVect = 9, 12 | Tim1CompVect = 10, 13 | Tim1OvfVect = 11, 14 | Tim0CompAVect = 12, 15 | Tim0CompBVect = 13, 16 | Tim0OvfVect = 14, 17 | TwiBusCdVect = 15, 18 | TwiVect = 16, 19 | VadcVect = 17, 20 | CcadcConvVect = 18, 21 | CcadcRegCurVect = 19, 22 | CcadcAccVect = 20, 23 | EeReadyVect = 21, 24 | SpmReadyVect = 22, 25 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega649.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | LcdVect = 22, 25 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega649a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | LcdVect = 22, 25 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega649p.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | LcdVect = 22, 25 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega169pa.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | LcdVect = 22, 25 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega329pa.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | Usart0RxVect = 13, 16 | Usart0UdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | LcdVect = 22, 25 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega3250.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | UsartRxVect = 13, 16 | UsartUdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | NotUsedVect = 22, 25 | PCInt2Vect = 23, 26 | PCInt3Vect = 24, 27 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega3250a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | UsartRxVect = 13, 16 | UsartUdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | NotUsedVect = 22, 25 | PCInt2Vect = 23, 26 | PCInt3Vect = 24, 27 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega3250p.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | UsartRxVect = 13, 16 | UsartUdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | NotUsedVect = 22, 25 | PCInt2Vect = 23, 26 | PCInt3Vect = 24, 27 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega3250pa.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | UsartRxVect = 13, 16 | UsartUdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | NotUsedVect = 22, 25 | PCInt2Vect = 23, 26 | PCInt3Vect = 24, 27 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega3290.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | UsartRxVect = 13, 16 | UsartUdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | LcdVect = 22, 25 | PCInt2Vect = 23, 26 | PCInt3Vect = 24, 27 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega3290a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | UsartRxVect = 13, 16 | UsartUdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | LcdVect = 22, 25 | PCInt2Vect = 23, 26 | PCInt3Vect = 24, 27 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega3290p.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | UsartRxVect = 13, 16 | UsartUdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | LcdVect = 22, 25 | PCInt2Vect = 23, 26 | PCInt3Vect = 24, 27 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega3290pa.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | UsartRxVect = 13, 16 | UsartUdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | LcdVect = 22, 25 | PCInt2Vect = 23, 26 | PCInt3Vect = 24, 27 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega6450.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | UsartRxVect = 13, 16 | UsartUdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | NotUsedVect = 22, 25 | PCInt2Vect = 23, 26 | PCInt3Vect = 24, 27 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega6450a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | UsartRxVect = 13, 16 | UsartUdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | NotUsedVect = 22, 25 | PCInt2Vect = 23, 26 | PCInt3Vect = 24, 27 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega6450p.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | UsartRxVect = 13, 16 | UsartUdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | NotUsedVect = 22, 25 | PCInt2Vect = 23, 26 | PCInt3Vect = 24, 27 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega6490.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | UsartRxVect = 13, 16 | UsartUdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | LcdVect = 22, 25 | PCInt2Vect = 23, 26 | PCInt3Vect = 24, 27 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega6490a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | UsartRxVect = 13, 16 | UsartUdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | LcdVect = 22, 25 | PCInt2Vect = 23, 26 | PCInt3Vect = 24, 27 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega6490p.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | Timer2CompVect = 4, 7 | Timer2OvfVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompVect = 10, 13 | Timer0OvfVect = 11, 14 | SpiStcVect = 12, 15 | UsartRxVect = 13, 16 | UsartUdreVect = 14, 17 | Usart0TxVect = 15, 18 | UsiStartVect = 16, 19 | UsiOverflowVect = 17, 20 | AnalogCompVect = 18, 21 | AdcVect = 19, 22 | EeReadyVect = 20, 23 | SpmReadyVect = 21, 24 | LcdVect = 22, 25 | PCInt2Vect = 23, 26 | PCInt3Vect = 24, 27 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega64hve2.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | WdtVect = 4, 7 | WakeupVect = 5, 8 | Timer1IcVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0IcVect = 10, 13 | Timer0CompAVect = 11, 14 | Timer0CompBVect = 12, 15 | Timer0OvfVect = 13, 16 | LinStatusVect = 14, 17 | LinErrorVect = 15, 18 | SpiStcVect = 16, 19 | VadcConvVect = 17, 20 | VadcAccVect = 18, 21 | CadcConvVect = 19, 22 | CadcRegCurVect = 20, 23 | CadcAccVect = 21, 24 | EeReadyVect = 22, 25 | SpmVect = 23, 26 | PllVect = 24, 27 | -------------------------------------------------------------------------------- /examples/arduino_uno_blink/README.md: -------------------------------------------------------------------------------- 1 | # arduino_uno_blink 2 | 3 | A simple example of using the avr_io library to blink the builtin led of an Arduino Uno, 4 | using a timer-based delay with an interrupt service routine. 5 | 6 | ## Dependencies 7 | 8 | - ```avr-gcc``` 9 | - ```avr-libc``` 10 | - ```avrdude``` 11 | 12 | ## Building the project 13 | 14 | To build the project, just run: 15 | 16 | ```bash 17 | nimble build 18 | ``` 19 | 20 | Additional targets: 21 | 22 | ```bash 23 | nimble clear # cleans the artifacts from a previous build 24 | nimble flash # flashes the .hex file onto the Arduino Uno 25 | nimble flash_debug # flashes the .elf file onto the Arduino Uno 26 | ``` 27 | 28 | Notice that the specified port is the default one for an Arduino on Linux, change it 29 | accordingly to your system. 30 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega168.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | WdtVect = 6, 9 | Timer2CompAVect = 7, 10 | Timer2CompBVect = 8, 11 | Timer2OvfVect = 9, 12 | Timer1CaptVect = 10, 13 | Timer1CompAVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer1OvfVect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | UsartRxVect = 18, 21 | UsartUdreVect = 19, 22 | UsartTxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | TwiVect = 24, 27 | SpmReadyVect = 25, 28 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega168a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | WdtVect = 6, 9 | Timer2CompAVect = 7, 10 | Timer2CompBVect = 8, 11 | Timer2OvfVect = 9, 12 | Timer1CaptVect = 10, 13 | Timer1CompAVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer1OvfVect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | UsartRxVect = 18, 21 | UsartUdreVect = 19, 22 | UsartTxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | TwiVect = 24, 27 | SpmReadyVect = 25, 28 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega168p.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | WdtVect = 6, 9 | Timer2CompAVect = 7, 10 | Timer2CompBVect = 8, 11 | Timer2OvfVect = 9, 12 | Timer1CaptVect = 10, 13 | Timer1CompAVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer1OvfVect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | UsartRxVect = 18, 21 | UsartUdreVect = 19, 22 | UsartTxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | TwiVect = 24, 27 | SpmReadyVect = 25, 28 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega168pa.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | WdtVect = 6, 9 | Timer2CompAVect = 7, 10 | Timer2CompBVect = 8, 11 | Timer2OvfVect = 9, 12 | Timer1CaptVect = 10, 13 | Timer1CompAVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer1OvfVect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | UsartRxVect = 18, 21 | UsartUdreVect = 19, 22 | UsartTxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | TwiVect = 24, 27 | SpmReadyVect = 25, 28 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega328.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | WdtVect = 6, 9 | Timer2CompAVect = 7, 10 | Timer2CompBVect = 8, 11 | Timer2OvfVect = 9, 12 | Timer1CaptVect = 10, 13 | Timer1CompAVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer1OvfVect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | UsartRxVect = 18, 21 | UsartUdreVect = 19, 22 | UsartTxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | TwiVect = 24, 27 | SpmReadyVect = 25, 28 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega328p.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | WdtVect = 6, 9 | Timer2CompAVect = 7, 10 | Timer2CompBVect = 8, 11 | Timer2OvfVect = 9, 12 | Timer1CaptVect = 10, 13 | Timer1CompAVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer1OvfVect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | UsartRxVect = 18, 21 | UsartUdreVect = 19, 22 | UsartTxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | TwiVect = 24, 27 | SpmReadyVect = 25, 28 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega48.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | WdtVect = 6, 9 | Timer2CompAVect = 7, 10 | Timer2CompBVect = 8, 11 | Timer2OvfVect = 9, 12 | Timer1CaptVect = 10, 13 | Timer1CompAVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer1OvfVect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | UsartRxVect = 18, 21 | UsartUdreVect = 19, 22 | UsartTxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | TwiVect = 24, 27 | SpmReadyVect = 25, 28 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega48a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | WdtVect = 6, 9 | Timer2CompAVect = 7, 10 | Timer2CompBVect = 8, 11 | Timer2OvfVect = 9, 12 | Timer1CaptVect = 10, 13 | Timer1CompAVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer1OvfVect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | UsartRxVect = 18, 21 | UsartUdreVect = 19, 22 | UsartTxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | TwiVect = 24, 27 | SpmReadyVect = 25, 28 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega48p.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | WdtVect = 6, 9 | Timer2CompAVect = 7, 10 | Timer2CompBVect = 8, 11 | Timer2OvfVect = 9, 12 | Timer1CaptVect = 10, 13 | Timer1CompAVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer1OvfVect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | UsartRxVect = 18, 21 | UsartUdreVect = 19, 22 | UsartTxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | TwiVect = 24, 27 | SpmReadyVect = 25, 28 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega48pa.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | WdtVect = 6, 9 | Timer2CompAVect = 7, 10 | Timer2CompBVect = 8, 11 | Timer2OvfVect = 9, 12 | Timer1CaptVect = 10, 13 | Timer1CompAVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer1OvfVect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | UsartRxVect = 18, 21 | UsartUdreVect = 19, 22 | UsartTxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | TwiVect = 24, 27 | SpmReadyVect = 25, 28 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega88.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | WdtVect = 6, 9 | Timer2CompAVect = 7, 10 | Timer2CompBVect = 8, 11 | Timer2OvfVect = 9, 12 | Timer1CaptVect = 10, 13 | Timer1CompAVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer1OvfVect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | UsartRxVect = 18, 21 | UsartUdreVect = 19, 22 | UsartTxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | TwiVect = 24, 27 | SpmReadyVect = 25, 28 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega88a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | WdtVect = 6, 9 | Timer2CompAVect = 7, 10 | Timer2CompBVect = 8, 11 | Timer2OvfVect = 9, 12 | Timer1CaptVect = 10, 13 | Timer1CompAVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer1OvfVect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | UsartRxVect = 18, 21 | UsartUdreVect = 19, 22 | UsartTxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | TwiVect = 24, 27 | SpmReadyVect = 25, 28 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega88p.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | WdtVect = 6, 9 | Timer2CompAVect = 7, 10 | Timer2CompBVect = 8, 11 | Timer2OvfVect = 9, 12 | Timer1CaptVect = 10, 13 | Timer1CompAVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer1OvfVect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | UsartRxVect = 18, 21 | UsartUdreVect = 19, 22 | UsartTxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | TwiVect = 24, 27 | SpmReadyVect = 25, 28 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega88pa.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | WdtVect = 6, 9 | Timer2CompAVect = 7, 10 | Timer2CompBVect = 8, 11 | Timer2OvfVect = 9, 12 | Timer1CaptVect = 10, 13 | Timer1CompAVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer1OvfVect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | UsartRxVect = 18, 21 | UsartUdreVect = 19, 22 | UsartTxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | TwiVect = 24, 27 | SpmReadyVect = 25, 28 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny828.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | PCInt3Vect = 6, 9 | WdtVect = 7, 10 | Timer1CaptVect = 8, 11 | Timer1CompAVect = 9, 12 | Timer1CompBVect = 10, 13 | Timer1OvfVect = 11, 14 | Timer0CompAVect = 12, 15 | Timer0CompBVect = 13, 16 | Timer0OvfVect = 14, 17 | SpiStcVect = 15, 18 | UsartStartVect = 16, 19 | UsartRxVect = 17, 20 | UsartUdreVect = 18, 21 | UsartTxVect = 19, 22 | AdcVect = 20, 23 | EeReadyVect = 21, 24 | AnalogCompVect = 22, 25 | TwiSlaveVect = 23, 26 | SpmReadyVect = 24, 27 | QtripVect = 25, 28 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega168pb.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | WdtVect = 6, 9 | Timer2CompAVect = 7, 10 | Timer2CompBVect = 8, 11 | Timer2OvfVect = 9, 12 | Timer1CaptVect = 10, 13 | Timer1CompAVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer1OvfVect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | UsartRxVect = 18, 21 | UsartUdreVect = 19, 22 | UsartTxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | TwiVect = 24, 27 | SpmReadyVect = 25, 28 | UsartStartVect = 26, 29 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega48pb.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | WdtVect = 6, 9 | Timer2CompAVect = 7, 10 | Timer2CompBVect = 8, 11 | Timer2OvfVect = 9, 12 | Timer1CaptVect = 10, 13 | Timer1CompAVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer1OvfVect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | UsartRxVect = 18, 21 | UsartUdreVect = 19, 22 | UsartTxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | TwiVect = 24, 27 | SpmReadyVect = 25, 28 | UsartStartVect = 26, 29 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega88pb.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | WdtVect = 6, 9 | Timer2CompAVect = 7, 10 | Timer2CompBVect = 8, 11 | Timer2OvfVect = 9, 12 | Timer1CaptVect = 10, 13 | Timer1CompAVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer1OvfVect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | UsartRxVect = 18, 21 | UsartUdreVect = 19, 22 | UsartTxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | TwiVect = 24, 27 | SpmReadyVect = 25, 28 | UsartStartVect = 26, 29 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega162.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | PCInt0Vect = 4, 7 | PCInt1Vect = 5, 8 | Timer3CaptVect = 6, 9 | Timer3CompAVect = 7, 10 | Timer3CompBVect = 8, 11 | Timer3OvfVect = 9, 12 | Timer2CompVect = 10, 13 | Timer2OvfVect = 11, 14 | Timer1CaptVect = 12, 15 | Timer1CompAVect = 13, 16 | Timer1CompBVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompVect = 16, 19 | Timer0OvfVect = 17, 20 | SpiStcVect = 18, 21 | Usart0RxcVect = 19, 22 | Usart1RxcVect = 20, 23 | Usart0UdreVect = 21, 24 | Usart1UdreVect = 22, 25 | Usart0TxcVect = 23, 26 | Usart1TxcVect = 24, 27 | EeRdyVect = 25, 28 | AnaCompVect = 26, 29 | SpmRdyVect = 27, 30 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega644.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | PCInt0Vect = 4, 7 | PCInt1Vect = 5, 8 | PCInt2Vect = 6, 9 | PCInt3Vect = 7, 10 | WdtVect = 8, 11 | Timer2CompAVect = 9, 12 | Timer2CompBVect = 10, 13 | Timer2OvfVect = 11, 14 | Timer1CaptVect = 12, 15 | Timer1CompAVect = 13, 16 | Timer1CompBVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompAVect = 16, 19 | Timer0CompBVect = 17, 20 | Timer0OvfVect = 18, 21 | SpiStcVect = 19, 22 | Usart0RxVect = 20, 23 | Usart0UdreVect = 21, 24 | Usart0TxVect = 22, 25 | AnalogCompVect = 23, 26 | AdcVect = 24, 27 | EeReadyVect = 25, 28 | TwiVect = 26, 29 | SpmReadyVect = 27, 30 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny1634.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | PCInt2Vect = 4, 7 | WdtVect = 5, 8 | Timer1CaptVect = 6, 9 | Timer1CompAVect = 7, 10 | Timer1CompBVect = 8, 11 | Timer1OvfVect = 9, 12 | Timer0CompAVect = 10, 13 | Timer0CompBVect = 11, 14 | Timer0OvfVect = 12, 15 | AnaCompVect = 13, 16 | AdcVect = 14, 17 | Usart0StartVect = 15, 18 | Usart0RxVect = 16, 19 | Usart0UdreVect = 17, 20 | Usart0TxVect = 18, 21 | Usart1StartVect = 19, 22 | Usart1RxVect = 20, 23 | Usart1UdreVect = 21, 24 | Usart1TxVect = 22, 25 | UsiStartVect = 23, 26 | UsiOverflowVect = 24, 27 | TwiSlaveVect = 25, 28 | EeRdyVect = 26, 29 | QtripVect = 27, 30 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/at90usb82.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | PCInt1Vect = 10, 13 | UsbGenVect = 11, 14 | UsbComVect = 12, 15 | WdtVect = 13, 16 | Timer1CaptVect = 14, 17 | Timer1CompAVect = 15, 18 | Timer1CompBVect = 16, 19 | Timer1CompCVect = 17, 20 | Timer1OvfVect = 18, 21 | Timer0CompAVect = 19, 22 | Timer0CompBVect = 20, 23 | Timer0OvfVect = 21, 24 | SpiStcVect = 22, 25 | Usart1RxVect = 23, 26 | Usart1UdreVect = 24, 27 | Usart1TxVect = 25, 28 | AnalogCompVect = 26, 29 | EeReadyVect = 27, 30 | SpmReadyVect = 28, 31 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega8u2.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | PCInt1Vect = 10, 13 | UsbGenVect = 11, 14 | UsbComVect = 12, 15 | WdtVect = 13, 16 | Timer1CaptVect = 14, 17 | Timer1CompAVect = 15, 18 | Timer1CompBVect = 16, 19 | Timer1CompCVect = 17, 20 | Timer1OvfVect = 18, 21 | Timer0CompAVect = 19, 22 | Timer0CompBVect = 20, 23 | Timer0OvfVect = 21, 24 | SpiStcVect = 22, 25 | Usart1RxVect = 23, 26 | Usart1UdreVect = 24, 27 | Usart1TxVect = 25, 28 | AnalogCompVect = 26, 29 | EeReadyVect = 27, 30 | SpmReadyVect = 28, 31 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/at90usb162.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | PCInt1Vect = 10, 13 | UsbGenVect = 11, 14 | UsbComVect = 12, 15 | WdtVect = 13, 16 | Timer1CaptVect = 14, 17 | Timer1CompAVect = 15, 18 | Timer1CompBVect = 16, 19 | Timer1CompCVect = 17, 20 | Timer1OvfVect = 18, 21 | Timer0CompAVect = 19, 22 | Timer0CompBVect = 20, 23 | Timer0OvfVect = 21, 24 | SpiStcVect = 22, 25 | Usart1RxVect = 23, 26 | Usart1UdreVect = 24, 27 | Usart1TxVect = 25, 28 | AnalogCompVect = 26, 29 | EeReadyVect = 27, 30 | SpmReadyVect = 28, 31 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega16hvb.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | BpintVect = 1, 4 | VregmonVect = 2, 5 | Int0Vect = 3, 6 | Int1Vect = 4, 7 | Int2Vect = 5, 8 | Int3Vect = 6, 9 | PCInt0Vect = 7, 10 | PCInt1Vect = 8, 11 | WdtVect = 9, 12 | BgscdVect = 10, 13 | ChdetVect = 11, 14 | Timer1IcVect = 12, 15 | Timer1CompAVect = 13, 16 | Timer1CompBVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0IcVect = 16, 19 | Timer0CompAVect = 17, 20 | Timer0CompBVect = 18, 21 | Timer0OvfVect = 19, 22 | TwibuscdVect = 20, 23 | TwiVect = 21, 24 | SpiStcVect = 22, 25 | VadcVect = 23, 26 | CcadcConvVect = 24, 27 | CcadcRegCurVect = 25, 28 | CcadcAccVect = 26, 29 | EeReadyVect = 27, 30 | SpmVect = 28, 31 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega16u2.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | PCInt1Vect = 10, 13 | UsbGenVect = 11, 14 | UsbComVect = 12, 15 | WdtVect = 13, 16 | Timer1CaptVect = 14, 17 | Timer1CompAVect = 15, 18 | Timer1CompBVect = 16, 19 | Timer1CompCVect = 17, 20 | Timer1OvfVect = 18, 21 | Timer0CompAVect = 19, 22 | Timer0CompBVect = 20, 23 | Timer0OvfVect = 21, 24 | SpiStcVect = 22, 25 | Usart1RxVect = 23, 26 | Usart1UdreVect = 24, 27 | Usart1TxVect = 25, 28 | AnalogCompVect = 26, 29 | EeReadyVect = 27, 30 | SpmReadyVect = 28, 31 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega32hvb.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | BpintVect = 1, 4 | VregmonVect = 2, 5 | Int0Vect = 3, 6 | Int1Vect = 4, 7 | Int2Vect = 5, 8 | Int3Vect = 6, 9 | PCInt0Vect = 7, 10 | PCInt1Vect = 8, 11 | WdtVect = 9, 12 | BgscdVect = 10, 13 | ChdetVect = 11, 14 | Timer1IcVect = 12, 15 | Timer1CompAVect = 13, 16 | Timer1CompBVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0IcVect = 16, 19 | Timer0CompAVect = 17, 20 | Timer0CompBVect = 18, 21 | Timer0OvfVect = 19, 22 | TwibuscdVect = 20, 23 | TwiVect = 21, 24 | SpiStcVect = 22, 25 | VadcVect = 23, 26 | CcadcConvVect = 24, 27 | CcadcRegCurVect = 25, 28 | CcadcAccVect = 26, 29 | EeReadyVect = 27, 30 | SpmVect = 28, 31 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega32u2.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | PCInt1Vect = 10, 13 | UsbGenVect = 11, 14 | UsbComVect = 12, 15 | WdtVect = 13, 16 | Timer1CaptVect = 14, 17 | Timer1CompAVect = 15, 18 | Timer1CompBVect = 16, 19 | Timer1CompCVect = 17, 20 | Timer1OvfVect = 18, 21 | Timer0CompAVect = 19, 22 | Timer0CompBVect = 20, 23 | Timer0OvfVect = 21, 24 | SpiStcVect = 22, 25 | Usart1RxVect = 23, 26 | Usart1UdreVect = 24, 27 | Usart1TxVect = 25, 28 | AnalogCompVect = 26, 29 | EeReadyVect = 27, 30 | SpmReadyVect = 28, 31 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega16hvbrevb.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | BpintVect = 1, 4 | VregmonVect = 2, 5 | Int0Vect = 3, 6 | Int1Vect = 4, 7 | Int2Vect = 5, 8 | Int3Vect = 6, 9 | PCInt0Vect = 7, 10 | PCInt1Vect = 8, 11 | WdtVect = 9, 12 | BgscdVect = 10, 13 | ChdetVect = 11, 14 | Timer1IcVect = 12, 15 | Timer1CompAVect = 13, 16 | Timer1CompBVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0IcVect = 16, 19 | Timer0CompAVect = 17, 20 | Timer0CompBVect = 18, 21 | Timer0OvfVect = 19, 22 | TwibuscdVect = 20, 23 | TwiVect = 21, 24 | SpiStcVect = 22, 25 | VadcVect = 23, 26 | CcadcConvVect = 24, 27 | CcadcRegCurVect = 25, 28 | CcadcAccVect = 26, 29 | EeReadyVect = 27, 30 | SpmVect = 28, 31 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega32hvbrevb.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | BpintVect = 1, 4 | VregmonVect = 2, 5 | Int0Vect = 3, 6 | Int1Vect = 4, 7 | Int2Vect = 5, 8 | Int3Vect = 6, 9 | PCInt0Vect = 7, 10 | PCInt1Vect = 8, 11 | WdtVect = 9, 12 | BgscdVect = 10, 13 | ChdetVect = 11, 14 | Timer1IcVect = 12, 15 | Timer1CompAVect = 13, 16 | Timer1CompBVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0IcVect = 16, 19 | Timer0CompAVect = 17, 20 | Timer0CompBVect = 18, 21 | Timer0OvfVect = 19, 22 | TwibuscdVect = 20, 23 | TwiVect = 21, 24 | SpiStcVect = 22, 25 | VadcVect = 23, 26 | CcadcConvVect = 24, 27 | CcadcRegCurVect = 25, 28 | CcadcAccVect = 26, 29 | EeReadyVect = 27, 30 | SpmVect = 28, 31 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny441.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | WdtVect = 4, 7 | Timer1CaptVect = 5, 8 | Timer1CompAVect = 6, 9 | Timer1CompBVect = 7, 10 | Timer1OvfVect = 8, 11 | Timer0CompAVect = 9, 12 | Timer0CompBVect = 10, 13 | Timer0OvfVect = 11, 14 | AnaComp0Vect = 12, 15 | AdcVect = 13, 16 | EeRdyVect = 14, 17 | AnaComp1Vect = 15, 18 | Timer2CaptVect = 16, 19 | Timer2CompAVect = 17, 20 | Timer2CompBVect = 18, 21 | Timer2OvfVect = 19, 22 | SpiVect = 20, 23 | Usart0StartVect = 21, 24 | Usart0RxVect = 22, 25 | Usart0UdreVect = 23, 26 | Usart0TxVect = 24, 27 | Usart1StartVect = 25, 28 | Usart1RxVect = 26, 29 | Usart1UdreVect = 27, 30 | Usart1TxVect = 28, 31 | TwiSlaveVect = 29, 32 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/attiny841.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | PCInt0Vect = 2, 5 | PCInt1Vect = 3, 6 | WdtVect = 4, 7 | Timer1CaptVect = 5, 8 | Timer1CompAVect = 6, 9 | Timer1CompBVect = 7, 10 | Timer1OvfVect = 8, 11 | Timer0CompAVect = 9, 12 | Timer0CompBVect = 10, 13 | Timer0OvfVect = 11, 14 | AnaComp0Vect = 12, 15 | AdcVect = 13, 16 | EeRdyVect = 14, 17 | AnaComp1Vect = 15, 18 | Timer2CaptVect = 16, 19 | Timer2CompAVect = 17, 20 | Timer2CompBVect = 18, 21 | Timer2OvfVect = 19, 22 | SpiVect = 20, 23 | Usart0StartVect = 21, 24 | Usart0RxVect = 22, 25 | Usart0UdreVect = 23, 26 | Usart0TxVect = 24, 27 | Usart1StartVect = 25, 28 | Usart1RxVect = 26, 29 | Usart1UdreVect = 27, 30 | Usart1TxVect = 28, 31 | TwiSlaveVect = 29, 32 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega164a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | PCInt0Vect = 4, 7 | PCInt1Vect = 5, 8 | PCInt2Vect = 6, 9 | PCInt3Vect = 7, 10 | WdtVect = 8, 11 | Timer2CompAVect = 9, 12 | Timer2CompBVect = 10, 13 | Timer2OvfVect = 11, 14 | Timer1CaptVect = 12, 15 | Timer1CompAVect = 13, 16 | Timer1CompBVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompAVect = 16, 19 | Timer0CompBVect = 17, 20 | Timer0OvfVect = 18, 21 | SpiStcVect = 19, 22 | Usart0RxVect = 20, 23 | Usart0UdreVect = 21, 24 | Usart0TxVect = 22, 25 | AnalogCompVect = 23, 26 | AdcVect = 24, 27 | EeReadyVect = 25, 28 | TwiVect = 26, 29 | SpmReadyVect = 27, 30 | Usart1RxVect = 28, 31 | Usart1UdreVect = 29, 32 | Usart1TxVect = 30, 33 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega164p.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | PCInt0Vect = 4, 7 | PCInt1Vect = 5, 8 | PCInt2Vect = 6, 9 | PCInt3Vect = 7, 10 | WdtVect = 8, 11 | Timer2CompAVect = 9, 12 | Timer2CompBVect = 10, 13 | Timer2OvfVect = 11, 14 | Timer1CaptVect = 12, 15 | Timer1CompAVect = 13, 16 | Timer1CompBVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompAVect = 16, 19 | Timer0CompBVect = 17, 20 | Timer0OvfVect = 18, 21 | SpiStcVect = 19, 22 | Usart0RxVect = 20, 23 | Usart0UdreVect = 21, 24 | Usart0TxVect = 22, 25 | AnalogCompVect = 23, 26 | AdcVect = 24, 27 | EeReadyVect = 25, 28 | TwiVect = 26, 29 | SpmReadyVect = 27, 30 | Usart1RxVect = 28, 31 | Usart1UdreVect = 29, 32 | Usart1TxVect = 30, 33 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega164pa.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | PCInt0Vect = 4, 7 | PCInt1Vect = 5, 8 | PCInt2Vect = 6, 9 | PCInt3Vect = 7, 10 | WdtVect = 8, 11 | Timer2CompAVect = 9, 12 | Timer2CompBVect = 10, 13 | Timer2OvfVect = 11, 14 | Timer1CaptVect = 12, 15 | Timer1CompAVect = 13, 16 | Timer1CompBVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompAVect = 16, 19 | Timer0CompBVect = 17, 20 | Timer0OvfVect = 18, 21 | SpiStcVect = 19, 22 | Usart0RxVect = 20, 23 | Usart0UdreVect = 21, 24 | Usart0TxVect = 22, 25 | AnalogCompVect = 23, 26 | AdcVect = 24, 27 | EeReadyVect = 25, 28 | TwiVect = 26, 29 | SpmReadyVect = 27, 30 | Usart1RxVect = 28, 31 | Usart1UdreVect = 29, 32 | Usart1TxVect = 30, 33 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega16m1.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Anacomp0Vect = 1, 4 | Anacomp1Vect = 2, 5 | Anacomp2Vect = 3, 6 | Anacomp3Vect = 4, 7 | PscFaultVect = 5, 8 | PscEcVect = 6, 9 | Int0Vect = 7, 10 | Int1Vect = 8, 11 | Int2Vect = 9, 12 | Int3Vect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Timer1OvfVect = 14, 17 | Timer0CompAVect = 15, 18 | Timer0CompBVect = 16, 19 | Timer0OvfVect = 17, 20 | CanIntVect = 18, 21 | CanTovfVect = 19, 22 | LinTcVect = 20, 23 | LinErrVect = 21, 24 | PCInt0Vect = 22, 25 | PCInt1Vect = 23, 26 | PCInt2Vect = 24, 27 | PCInt3Vect = 25, 28 | SpiStcVect = 26, 29 | AdcVect = 27, 30 | WdtVect = 28, 31 | EeReadyVect = 29, 32 | SpmReadyVect = 30, 33 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega324a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | PCInt0Vect = 4, 7 | PCInt1Vect = 5, 8 | PCInt2Vect = 6, 9 | PCInt3Vect = 7, 10 | WdtVect = 8, 11 | Timer2CompAVect = 9, 12 | Timer2CompBVect = 10, 13 | Timer2OvfVect = 11, 14 | Timer1CaptVect = 12, 15 | Timer1CompAVect = 13, 16 | Timer1CompBVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompAVect = 16, 19 | Timer0CompBVect = 17, 20 | Timer0OvfVect = 18, 21 | SpiStcVect = 19, 22 | Usart0RxVect = 20, 23 | Usart0UdreVect = 21, 24 | Usart0TxVect = 22, 25 | AnalogCompVect = 23, 26 | AdcVect = 24, 27 | EeReadyVect = 25, 28 | TwiVect = 26, 29 | SpmReadyVect = 27, 30 | Usart1RxVect = 28, 31 | Usart1UdreVect = 29, 32 | Usart1TxVect = 30, 33 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega324p.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | PCInt0Vect = 4, 7 | PCInt1Vect = 5, 8 | PCInt2Vect = 6, 9 | PCInt3Vect = 7, 10 | WdtVect = 8, 11 | Timer2CompAVect = 9, 12 | Timer2CompBVect = 10, 13 | Timer2OvfVect = 11, 14 | Timer1CaptVect = 12, 15 | Timer1CompAVect = 13, 16 | Timer1CompBVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompAVect = 16, 19 | Timer0CompBVect = 17, 20 | Timer0OvfVect = 18, 21 | SpiStcVect = 19, 22 | Usart0RxVect = 20, 23 | Usart0UdreVect = 21, 24 | Usart0TxVect = 22, 25 | AnalogCompVect = 23, 26 | AdcVect = 24, 27 | EeReadyVect = 25, 28 | TwiVect = 26, 29 | SpmReadyVect = 27, 30 | Usart1RxVect = 28, 31 | Usart1UdreVect = 29, 32 | Usart1TxVect = 30, 33 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega324pa.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | PCInt0Vect = 4, 7 | PCInt1Vect = 5, 8 | PCInt2Vect = 6, 9 | PCInt3Vect = 7, 10 | WdtVect = 8, 11 | Timer2CompAVect = 9, 12 | Timer2CompBVect = 10, 13 | Timer2OvfVect = 11, 14 | Timer1CaptVect = 12, 15 | Timer1CompAVect = 13, 16 | Timer1CompBVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompAVect = 16, 19 | Timer0CompBVect = 17, 20 | Timer0OvfVect = 18, 21 | SpiStcVect = 19, 22 | Usart0RxVect = 20, 23 | Usart0UdreVect = 21, 24 | Usart0TxVect = 22, 25 | AnalogCompVect = 23, 26 | AdcVect = 24, 27 | EeReadyVect = 25, 28 | TwiVect = 26, 29 | SpmReadyVect = 27, 30 | Usart1RxVect = 28, 31 | Usart1UdreVect = 29, 32 | Usart1TxVect = 30, 33 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega32c1.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Anacomp0Vect = 1, 4 | Anacomp1Vect = 2, 5 | Anacomp2Vect = 3, 6 | Anacomp3Vect = 4, 7 | PscFaultVect = 5, 8 | PscEcVect = 6, 9 | Int0Vect = 7, 10 | Int1Vect = 8, 11 | Int2Vect = 9, 12 | Int3Vect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Timer1OvfVect = 14, 17 | Timer0CompAVect = 15, 18 | Timer0CompBVect = 16, 19 | Timer0OvfVect = 17, 20 | CanIntVect = 18, 21 | CanTovfVect = 19, 22 | LinTcVect = 20, 23 | LinErrVect = 21, 24 | PCInt0Vect = 22, 25 | PCInt1Vect = 23, 26 | PCInt2Vect = 24, 27 | PCInt3Vect = 25, 28 | SpiStcVect = 26, 29 | AdcVect = 27, 30 | WdtVect = 28, 31 | EeReadyVect = 29, 32 | SpmReadyVect = 30, 33 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega32m1.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Anacomp0Vect = 1, 4 | Anacomp1Vect = 2, 5 | Anacomp2Vect = 3, 6 | Anacomp3Vect = 4, 7 | PscFaultVect = 5, 8 | PscEcVect = 6, 9 | Int0Vect = 7, 10 | Int1Vect = 8, 11 | Int2Vect = 9, 12 | Int3Vect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Timer1OvfVect = 14, 17 | Timer0CompAVect = 15, 18 | Timer0CompBVect = 16, 19 | Timer0OvfVect = 17, 20 | CanIntVect = 18, 21 | CanTovfVect = 19, 22 | LinTcVect = 20, 23 | LinErrVect = 21, 24 | PCInt0Vect = 22, 25 | PCInt1Vect = 23, 26 | PCInt2Vect = 24, 27 | PCInt3Vect = 25, 28 | SpiStcVect = 26, 29 | AdcVect = 27, 30 | WdtVect = 28, 31 | EeReadyVect = 29, 32 | SpmReadyVect = 30, 33 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega644a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | PCInt0Vect = 4, 7 | PCInt1Vect = 5, 8 | PCInt2Vect = 6, 9 | PCInt3Vect = 7, 10 | WdtVect = 8, 11 | Timer2CompAVect = 9, 12 | Timer2CompBVect = 10, 13 | Timer2OvfVect = 11, 14 | Timer1CaptVect = 12, 15 | Timer1CompAVect = 13, 16 | Timer1CompBVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompAVect = 16, 19 | Timer0CompBVect = 17, 20 | Timer0OvfVect = 18, 21 | SpiStcVect = 19, 22 | Usart0RxVect = 20, 23 | Usart0UdreVect = 21, 24 | Usart0TxVect = 22, 25 | AnalogCompVect = 23, 26 | AdcVect = 24, 27 | EeReadyVect = 25, 28 | TwiVect = 26, 29 | SpmReadyVect = 27, 30 | Usart1RxVect = 28, 31 | Usart1UdreVect = 29, 32 | Usart1TxVect = 30, 33 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega644p.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | PCInt0Vect = 4, 7 | PCInt1Vect = 5, 8 | PCInt2Vect = 6, 9 | PCInt3Vect = 7, 10 | WdtVect = 8, 11 | Timer2CompAVect = 9, 12 | Timer2CompBVect = 10, 13 | Timer2OvfVect = 11, 14 | Timer1CaptVect = 12, 15 | Timer1CompAVect = 13, 16 | Timer1CompBVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompAVect = 16, 19 | Timer0CompBVect = 17, 20 | Timer0OvfVect = 18, 21 | SpiStcVect = 19, 22 | Usart0RxVect = 20, 23 | Usart0UdreVect = 21, 24 | Usart0TxVect = 22, 25 | AnalogCompVect = 23, 26 | AdcVect = 24, 27 | EeReadyVect = 25, 28 | TwiVect = 26, 29 | SpmReadyVect = 27, 30 | Usart1RxVect = 28, 31 | Usart1UdreVect = 29, 32 | Usart1TxVect = 30, 33 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega644pa.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | PCInt0Vect = 4, 7 | PCInt1Vect = 5, 8 | PCInt2Vect = 6, 9 | PCInt3Vect = 7, 10 | WdtVect = 8, 11 | Timer2CompAVect = 9, 12 | Timer2CompBVect = 10, 13 | Timer2OvfVect = 11, 14 | Timer1CaptVect = 12, 15 | Timer1CompAVect = 13, 16 | Timer1CompBVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompAVect = 16, 19 | Timer0CompBVect = 17, 20 | Timer0OvfVect = 18, 21 | SpiStcVect = 19, 22 | Usart0RxVect = 20, 23 | Usart0UdreVect = 21, 24 | Usart0TxVect = 22, 25 | AnalogCompVect = 23, 26 | AdcVect = 24, 27 | EeReadyVect = 25, 28 | TwiVect = 26, 29 | SpmReadyVect = 27, 30 | Usart1RxVect = 28, 31 | Usart1UdreVect = 29, 32 | Usart1TxVect = 30, 33 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega64c1.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Anacomp0Vect = 1, 4 | Anacomp1Vect = 2, 5 | Anacomp2Vect = 3, 6 | Anacomp3Vect = 4, 7 | PscFaultVect = 5, 8 | PscEcVect = 6, 9 | Int0Vect = 7, 10 | Int1Vect = 8, 11 | Int2Vect = 9, 12 | Int3Vect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Timer1OvfVect = 14, 17 | Timer0CompAVect = 15, 18 | Timer0CompBVect = 16, 19 | Timer0OvfVect = 17, 20 | CanIntVect = 18, 21 | CanTovfVect = 19, 22 | LinTcVect = 20, 23 | LinErrVect = 21, 24 | PCInt0Vect = 22, 25 | PCInt1Vect = 23, 26 | PCInt2Vect = 24, 27 | PCInt3Vect = 25, 28 | SpiStcVect = 26, 29 | AdcVect = 27, 30 | WdtVect = 28, 31 | EeReadyVect = 29, 32 | SpmReadyVect = 30, 33 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega64m1.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Anacomp0Vect = 1, 4 | Anacomp1Vect = 2, 5 | Anacomp2Vect = 3, 6 | Anacomp3Vect = 4, 7 | PscFaultVect = 5, 8 | PscEcVect = 6, 9 | Int0Vect = 7, 10 | Int1Vect = 8, 11 | Int2Vect = 9, 12 | Int3Vect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Timer1OvfVect = 14, 17 | Timer0CompAVect = 15, 18 | Timer0CompBVect = 16, 19 | Timer0OvfVect = 17, 20 | CanIntVect = 18, 21 | CanTovfVect = 19, 22 | LinTcVect = 20, 23 | LinErrVect = 21, 24 | PCInt0Vect = 22, 25 | PCInt1Vect = 23, 26 | PCInt2Vect = 24, 27 | PCInt3Vect = 25, 28 | SpiStcVect = 26, 29 | AdcVect = 27, 30 | WdtVect = 28, 31 | EeReadyVect = 29, 32 | SpmReadyVect = 30, 33 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmegas64m1.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Anacomp0Vect = 1, 4 | Anacomp1Vect = 2, 5 | Anacomp2Vect = 3, 6 | Anacomp3Vect = 4, 7 | PscFaultVect = 5, 8 | PscEcVect = 6, 9 | Int0Vect = 7, 10 | Int1Vect = 8, 11 | Int2Vect = 9, 12 | Int3Vect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Timer1OvfVect = 14, 17 | Timer0CompAVect = 15, 18 | Timer0CompBVect = 16, 19 | Timer0OvfVect = 17, 20 | CanIntVect = 18, 21 | CanTovfVect = 19, 22 | LinTcVect = 20, 23 | LinErrVect = 21, 24 | PCInt0Vect = 22, 25 | PCInt1Vect = 23, 26 | PCInt2Vect = 24, 27 | PCInt3Vect = 25, 28 | SpiStcVect = 26, 29 | AdcVect = 27, 30 | WdtVect = 28, 31 | EeReadyVect = 29, 32 | SpmReadyVect = 30, 33 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/at90pwm1.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Psc2CaptVect = 1, 4 | Psc2EcVect = 2, 5 | Psc1CaptVect = 3, 6 | Psc1EcVect = 4, 7 | Psc0CaptVect = 5, 8 | Psc0EcVect = 6, 9 | AnalogComp0Vect = 7, 10 | AnalogComp1Vect = 8, 11 | AnalogComp2Vect = 9, 12 | Int0Vect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Reserved15Vect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompAVect = 16, 19 | Timer0OvfVect = 17, 20 | AdcVect = 18, 21 | Int1Vect = 19, 22 | SpiStcVect = 20, 23 | UsartRxVect = 21, 24 | UsartUdreVect = 22, 25 | UsartTxVect = 23, 26 | Int2Vect = 24, 27 | WdtVect = 25, 28 | EeReadyVect = 26, 29 | Timer0CompBVect = 27, 30 | Int3Vect = 28, 31 | Reserved30Vect = 29, 32 | Reserved31Vect = 30, 33 | SpmReadyVect = 31, 34 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/at90pwm216.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Psc2CaptVect = 1, 4 | Psc2EcVect = 2, 5 | Psc1CaptVect = 3, 6 | Psc1EcVect = 4, 7 | Psc0CaptVect = 5, 8 | Psc0EcVect = 6, 9 | AnalogComp0Vect = 7, 10 | AnalogComp1Vect = 8, 11 | AnalogComp2Vect = 9, 12 | Int0Vect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Reserved15Vect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompAVect = 16, 19 | Timer0OvfVect = 17, 20 | AdcVect = 18, 21 | Int1Vect = 19, 22 | SpiStcVect = 20, 23 | UsartRxVect = 21, 24 | UsartUdreVect = 22, 25 | UsartTxVect = 23, 26 | Int2Vect = 24, 27 | WdtVect = 25, 28 | EeReadyVect = 26, 29 | Timer0CompBVect = 27, 30 | Int3Vect = 28, 31 | Reserved30Vect = 29, 32 | Reserved31Vect = 30, 33 | SpmReadyVect = 31, 34 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/at90pwm2b.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Psc2CaptVect = 1, 4 | Psc2EcVect = 2, 5 | Psc1CaptVect = 3, 6 | Psc1EcVect = 4, 7 | Psc0CaptVect = 5, 8 | Psc0EcVect = 6, 9 | AnalogComp0Vect = 7, 10 | AnalogComp1Vect = 8, 11 | AnalogComp2Vect = 9, 12 | Int0Vect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Reserved15Vect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompAVect = 16, 19 | Timer0OvfVect = 17, 20 | AdcVect = 18, 21 | Int1Vect = 19, 22 | SpiStcVect = 20, 23 | UsartRxVect = 21, 24 | UsartUdreVect = 22, 25 | UsartTxVect = 23, 26 | Int2Vect = 24, 27 | WdtVect = 25, 28 | EeReadyVect = 26, 29 | Timer0CompBVect = 27, 30 | Int3Vect = 28, 31 | Reserved30Vect = 29, 32 | Reserved31Vect = 30, 33 | SpmReadyVect = 31, 34 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/at90pwm3.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Psc2CaptVect = 1, 4 | Psc2EcVect = 2, 5 | Psc1CaptVect = 3, 6 | Psc1EcVect = 4, 7 | Psc0CaptVect = 5, 8 | Psc0EcVect = 6, 9 | AnalogComp0Vect = 7, 10 | AnalogComp1Vect = 8, 11 | AnalogComp2Vect = 9, 12 | Int0Vect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Reserved15Vect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompAVect = 16, 19 | Timer0OvfVect = 17, 20 | AdcVect = 18, 21 | Int1Vect = 19, 22 | SpiStcVect = 20, 23 | UsartRxVect = 21, 24 | UsartUdreVect = 22, 25 | UsartTxVect = 23, 26 | Int2Vect = 24, 27 | WdtVect = 25, 28 | EeReadyVect = 26, 29 | Timer0CompBVect = 27, 30 | Int3Vect = 28, 31 | Reserved30Vect = 29, 32 | Reserved31Vect = 30, 33 | SpmReadyVect = 31, 34 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/at90pwm316.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Psc2CaptVect = 1, 4 | Psc2EcVect = 2, 5 | Psc1CaptVect = 3, 6 | Psc1EcVect = 4, 7 | Psc0CaptVect = 5, 8 | Psc0EcVect = 6, 9 | AnalogComp0Vect = 7, 10 | AnalogComp1Vect = 8, 11 | AnalogComp2Vect = 9, 12 | Int0Vect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Reserved15Vect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompAVect = 16, 19 | Timer0OvfVect = 17, 20 | AdcVect = 18, 21 | Int1Vect = 19, 22 | SpiStcVect = 20, 23 | UsartRxVect = 21, 24 | UsartUdreVect = 22, 25 | UsartTxVect = 23, 26 | Int2Vect = 24, 27 | WdtVect = 25, 28 | EeReadyVect = 26, 29 | Timer0CompBVect = 27, 30 | Int3Vect = 28, 31 | Reserved30Vect = 29, 32 | Reserved31Vect = 30, 33 | SpmReadyVect = 31, 34 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/at90pwm3b.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Psc2CaptVect = 1, 4 | Psc2EcVect = 2, 5 | Psc1CaptVect = 3, 6 | Psc1EcVect = 4, 7 | Psc0CaptVect = 5, 8 | Psc0EcVect = 6, 9 | AnalogComp0Vect = 7, 10 | AnalogComp1Vect = 8, 11 | AnalogComp2Vect = 9, 12 | Int0Vect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Reserved15Vect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompAVect = 16, 19 | Timer0OvfVect = 17, 20 | AdcVect = 18, 21 | Int1Vect = 19, 22 | SpiStcVect = 20, 23 | UsartRxVect = 21, 24 | UsartUdreVect = 22, 25 | UsartTxVect = 23, 26 | Int2Vect = 24, 27 | WdtVect = 25, 28 | EeReadyVect = 26, 29 | Timer0CompBVect = 27, 30 | Int3Vect = 28, 31 | Reserved30Vect = 29, 32 | Reserved31Vect = 30, 33 | SpmReadyVect = 31, 34 | -------------------------------------------------------------------------------- /examples/usart/src/usart9bits.nim: -------------------------------------------------------------------------------- 1 | ## A simple application, implementing an echo server running on an 2 | ## ATMega328P-based Arduino Uno, showcasing the 9-bit data Usart peripheral 3 | ## functionalities in synchronous mode. 4 | 5 | import avr_io 6 | 7 | const 8 | builtinLed = 5'u8 9 | 10 | proc loop = 11 | # The baud rate template allows for the end user to have a compile-time 12 | # evaluated baud rate, compliant with the 16-bit value expected from the 13 | # MCU. Use with `const`. 14 | const baud = baudRate(9600'u32) 15 | 16 | # As for the 8-bit example, the ucsz2 bit can be sit directly here as a flag 17 | # in a bitset, enabling 9-bit mode. 18 | usart0.init_uart(baud, {}, {txen, rxen, ucsz2}, {ucsz1, ucsz0}) 19 | portB.as_output_pin(builtinLed) 20 | 21 | while true: 22 | let n = usart0.read_int() # Read up to 9-bit of data 23 | usart0.write_int(n) # And send it back 24 | portB.toggle_pin(builtinLed) # Toggling the LED to have some feedback 25 | 26 | when isMainModule: 27 | loop() 28 | -------------------------------------------------------------------------------- /examples/bootloader/src/application.nim: -------------------------------------------------------------------------------- 1 | ## A incredibly simple application that showcases how to store data in a 2 | ## specific elf section within the binary. 3 | 4 | # We want to put the metadata section just at the end of the application 5 | # section in program memory. 6 | {.passL: "-Wl,--section-start=.metadata=0xDFE8".} 7 | 8 | import avr_io 9 | import delay 10 | 11 | 12 | proc constFill[T](size: static[int], val: T): array[size, T] = 13 | for e in result.mitems: 14 | e = val 15 | 16 | const 17 | led = 0'u8 18 | headerSize = 24 19 | 20 | # Let us reserve a slot of program memory where to keep the hash of this 21 | # application, together with its size and the .text section address. This will 22 | # be filled up by a script in the post build phase. 23 | let header {.section(".metadata").} = constFill(headerSize, 0'u8) 24 | 25 | 26 | proc loop() = 27 | initDelayTimer() 28 | 29 | portA.asOutputPin(led) 30 | portA.clearPin(led) 31 | while true: 32 | portA.togglePin(led) 33 | delayMs(2000) 34 | 35 | when isMainModule: 36 | loop() 37 | -------------------------------------------------------------------------------- /examples/timer/README.md: -------------------------------------------------------------------------------- 1 | # progmem 2 | 3 | An example application showcasing how to interact the timer peripherals on an 4 | ATMega328p MCU. This is compatible with the Arduino Uno board. 5 | 6 | ## Dependencies 7 | 8 | - ```avr-gcc``` 9 | - ```avr-libc``` 10 | - ```avrdude``` 11 | 12 | ## Building the project 13 | 14 | To build the project, just run: 15 | 16 | ```bash 17 | nimble build 18 | ``` 19 | 20 | Additional targets: 21 | 22 | ```bash 23 | nimble clear # cleans the artifacts from a previous build 24 | nimble flash # flashes the .hex file onto the Arduino Uno 25 | nimble flash_debug # flashes the .elf file onto the Arduino Uno 26 | ``` 27 | 28 | ## Check the results 29 | 30 | Three pins are used as the output for three different waveforms managed by 31 | the timers: 32 | 33 | | Timer | Port/Pin | Mode | Frequency | 34 | |--------|----------|-----------------|-----------| 35 | | Timer0 | PORTD[6] | CTC | 2 MHz | 36 | | Timer1 | PORTB[5] | CTC + Interrupt | 125 Hz | 37 | | Timer2 | PORTD[3] | PWM 20% | 1 MHz | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega64.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | Timer2CompVect = 9, 12 | Timer2OvfVect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Timer1OvfVect = 14, 17 | Timer0CompVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | Usart0RxVect = 18, 21 | Usart0UdreVect = 19, 22 | Usart0TxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | Timer1CompCVect = 24, 27 | Timer3CaptVect = 25, 28 | Timer3CompAVect = 26, 29 | Timer3CompBVect = 27, 30 | Timer3CompCVect = 28, 31 | Timer3OvfVect = 29, 32 | Usart1RxVect = 30, 33 | Usart1UdreVect = 31, 34 | Usart1TxVect = 32, 35 | TwiVect = 33, 36 | SpmReadyVect = 34, 37 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega128.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | Timer2CompVect = 9, 12 | Timer2OvfVect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Timer1OvfVect = 14, 17 | Timer0CompVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | Usart0RxVect = 18, 21 | Usart0UdreVect = 19, 22 | Usart0TxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | Timer1CompCVect = 24, 27 | Timer3CaptVect = 25, 28 | Timer3CompAVect = 26, 29 | Timer3CompBVect = 27, 30 | Timer3CompCVect = 28, 31 | Timer3OvfVect = 29, 32 | Usart1RxVect = 30, 33 | Usart1UdreVect = 31, 34 | Usart1TxVect = 32, 35 | TwiVect = 33, 36 | SpmReadyVect = 34, 37 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega1284.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | PCInt0Vect = 4, 7 | PCInt1Vect = 5, 8 | PCInt2Vect = 6, 9 | PCInt3Vect = 7, 10 | WdtVect = 8, 11 | Timer2CompAVect = 9, 12 | Timer2CompBVect = 10, 13 | Timer2OvfVect = 11, 14 | Timer1CaptVect = 12, 15 | Timer1CompAVect = 13, 16 | Timer1CompBVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompAVect = 16, 19 | Timer0CompBVect = 17, 20 | Timer0OvfVect = 18, 21 | SpiStcVect = 19, 22 | Usart0RxVect = 20, 23 | Usart0UdreVect = 21, 24 | Usart0TxVect = 22, 25 | AnalogCompVect = 23, 26 | AdcVect = 24, 27 | EeReadyVect = 25, 28 | TwiVect = 26, 29 | SpmReadyVect = 27, 30 | Usart1RxVect = 28, 31 | Usart1UdreVect = 29, 32 | Usart1TxVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3OvfVect = 34, 37 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega1284p.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | PCInt0Vect = 4, 7 | PCInt1Vect = 5, 8 | PCInt2Vect = 6, 9 | PCInt3Vect = 7, 10 | WdtVect = 8, 11 | Timer2CompAVect = 9, 12 | Timer2CompBVect = 10, 13 | Timer2OvfVect = 11, 14 | Timer1CaptVect = 12, 15 | Timer1CompAVect = 13, 16 | Timer1CompBVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompAVect = 16, 19 | Timer0CompBVect = 17, 20 | Timer0OvfVect = 18, 21 | SpiStcVect = 19, 22 | Usart0RxVect = 20, 23 | Usart0UdreVect = 21, 24 | Usart0TxVect = 22, 25 | AnalogCompVect = 23, 26 | AdcVect = 24, 27 | EeReadyVect = 25, 28 | TwiVect = 26, 29 | SpmReadyVect = 27, 30 | Usart1RxVect = 28, 31 | Usart1UdreVect = 29, 32 | Usart1TxVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3OvfVect = 34, 37 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega128a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | Timer2CompVect = 9, 12 | Timer2OvfVect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Timer1OvfVect = 14, 17 | Timer0CompVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | Usart0RxVect = 18, 21 | Usart0UdreVect = 19, 22 | Usart0TxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | Timer1CompCVect = 24, 27 | Timer3CaptVect = 25, 28 | Timer3CompAVect = 26, 29 | Timer3CompBVect = 27, 30 | Timer3CompCVect = 28, 31 | Timer3OvfVect = 29, 32 | Usart1RxVect = 30, 33 | Usart1UdreVect = 31, 34 | Usart1TxVect = 32, 35 | TwiVect = 33, 36 | SpmReadyVect = 34, 37 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega64a.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | Timer2CompVect = 9, 12 | Timer2OvfVect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Timer1OvfVect = 14, 17 | Timer0CompVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | Usart0RxVect = 18, 21 | Usart0UdreVect = 19, 22 | Usart0TxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | Timer1CompCVect = 24, 27 | Timer3CaptVect = 25, 28 | Timer3CompAVect = 26, 29 | Timer3CompBVect = 27, 30 | Timer3CompCVect = 28, 31 | Timer3OvfVect = 29, 32 | Usart1RxVect = 30, 33 | Usart1UdreVect = 31, 34 | Usart1TxVect = 32, 35 | TwiVect = 33, 36 | SpmReadyVect = 34, 37 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmegas128.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | Timer2CompVect = 9, 12 | Timer2OvfVect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Timer1OvfVect = 14, 17 | Timer0CompVect = 15, 18 | Timer0OvfVect = 16, 19 | SpiStcVect = 17, 20 | Usart0RxVect = 18, 21 | Usart0UdreVect = 19, 22 | Usart0TxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | Timer1CompCVect = 24, 27 | Timer3CaptVect = 25, 28 | Timer3CompAVect = 26, 29 | Timer3CompBVect = 27, 30 | Timer3CompCVect = 28, 31 | Timer3OvfVect = 29, 32 | Usart1RxVect = 30, 33 | Usart1UdreVect = 31, 34 | Usart1TxVect = 32, 35 | TwiVect = 33, 36 | SpmReadyVect = 34, 37 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/at90can128.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | Timer2CompVect = 9, 12 | Timer2OvfVect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Timer1CompCVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompVect = 16, 19 | Timer0OvfVect = 17, 20 | CanitVect = 18, 21 | OvritVect = 19, 22 | SpiStcVect = 20, 23 | Usart0RxVect = 21, 24 | Usart0UdreVect = 22, 25 | Usart0TxVect = 23, 26 | AnalogCompVect = 24, 27 | AdcVect = 25, 28 | EeReadyVect = 26, 29 | Timer3CaptVect = 27, 30 | Timer3CompAVect = 28, 31 | Timer3CompBVect = 29, 32 | Timer3CompCVect = 30, 33 | Timer3OvfVect = 31, 34 | Usart1RxVect = 32, 35 | Usart1UdreVect = 33, 36 | Usart1TxVect = 34, 37 | TwiVect = 35, 38 | SpmReadyVect = 36, 39 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/at90can32.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | Timer2CompVect = 9, 12 | Timer2OvfVect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Timer1CompCVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompVect = 16, 19 | Timer0OvfVect = 17, 20 | CanitVect = 18, 21 | OvritVect = 19, 22 | SpiStcVect = 20, 23 | Usart0RxVect = 21, 24 | Usart0UdreVect = 22, 25 | Usart0TxVect = 23, 26 | AnalogCompVect = 24, 27 | AdcVect = 25, 28 | EeReadyVect = 26, 29 | Timer3CaptVect = 27, 30 | Timer3CompAVect = 28, 31 | Timer3CompBVect = 29, 32 | Timer3CompCVect = 30, 33 | Timer3OvfVect = 31, 34 | Usart1RxVect = 32, 35 | Usart1UdreVect = 33, 36 | Usart1TxVect = 34, 37 | TwiVect = 35, 38 | SpmReadyVect = 36, 39 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/at90can64.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | Timer2CompVect = 9, 12 | Timer2OvfVect = 10, 13 | Timer1CaptVect = 11, 14 | Timer1CompAVect = 12, 15 | Timer1CompBVect = 13, 16 | Timer1CompCVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompVect = 16, 19 | Timer0OvfVect = 17, 20 | CanitVect = 18, 21 | OvritVect = 19, 22 | SpiStcVect = 20, 23 | Usart0RxVect = 21, 24 | Usart0UdreVect = 22, 25 | Usart0TxVect = 23, 26 | AnalogCompVect = 24, 27 | AdcVect = 25, 28 | EeReadyVect = 26, 29 | Timer3CaptVect = 27, 30 | Timer3CompAVect = 28, 31 | Timer3CompBVect = 29, 32 | Timer3CompCVect = 30, 33 | Timer3OvfVect = 31, 34 | Usart1RxVect = 32, 35 | Usart1UdreVect = 33, 36 | Usart1TxVect = 34, 37 | TwiVect = 35, 38 | SpmReadyVect = 36, 39 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/at90usb646.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | UsbGenVect = 10, 13 | UsbComVect = 11, 14 | WdtVect = 12, 15 | Timer2CompAVect = 13, 16 | Timer2CompBVect = 14, 17 | Timer2OvfVect = 15, 18 | Timer1CaptVect = 16, 19 | Timer1CompAVect = 17, 20 | Timer1CompBVect = 18, 21 | Timer1CompCVect = 19, 22 | Timer1OvfVect = 20, 23 | Timer0CompAVect = 21, 24 | Timer0CompBVect = 22, 25 | Timer0OvfVect = 23, 26 | SpiStcVect = 24, 27 | Usart1RxVect = 25, 28 | Usart1UdreVect = 26, 29 | Usart1TxVect = 27, 30 | AnalogCompVect = 28, 31 | AdcVect = 29, 32 | EeReadyVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3CompCVect = 34, 37 | Timer3OvfVect = 35, 38 | TwiVect = 36, 39 | SpmReadyVect = 37, 40 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/at90usb647.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | UsbGenVect = 10, 13 | UsbComVect = 11, 14 | WdtVect = 12, 15 | Timer2CompAVect = 13, 16 | Timer2CompBVect = 14, 17 | Timer2OvfVect = 15, 18 | Timer1CaptVect = 16, 19 | Timer1CompAVect = 17, 20 | Timer1CompBVect = 18, 21 | Timer1CompCVect = 19, 22 | Timer1OvfVect = 20, 23 | Timer0CompAVect = 21, 24 | Timer0CompBVect = 22, 25 | Timer0OvfVect = 23, 26 | SpiStcVect = 24, 27 | Usart1RxVect = 25, 28 | Usart1UdreVect = 26, 29 | Usart1TxVect = 27, 30 | AnalogCompVect = 28, 31 | AdcVect = 29, 32 | EeReadyVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3CompCVect = 34, 37 | Timer3OvfVect = 35, 38 | TwiVect = 36, 39 | SpmReadyVect = 37, 40 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/at90usb1286.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | UsbGenVect = 10, 13 | UsbComVect = 11, 14 | WdtVect = 12, 15 | Timer2CompAVect = 13, 16 | Timer2CompBVect = 14, 17 | Timer2OvfVect = 15, 18 | Timer1CaptVect = 16, 19 | Timer1CompAVect = 17, 20 | Timer1CompBVect = 18, 21 | Timer1CompCVect = 19, 22 | Timer1OvfVect = 20, 23 | Timer0CompAVect = 21, 24 | Timer0CompBVect = 22, 25 | Timer0OvfVect = 23, 26 | SpiStcVect = 24, 27 | Usart1RxVect = 25, 28 | Usart1UdreVect = 26, 29 | Usart1TxVect = 27, 30 | AnalogCompVect = 28, 31 | AdcVect = 29, 32 | EeReadyVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3CompCVect = 34, 37 | Timer3OvfVect = 35, 38 | TwiVect = 36, 39 | SpmReadyVect = 37, 40 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/at90usb1287.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | UsbGenVect = 10, 13 | UsbComVect = 11, 14 | WdtVect = 12, 15 | Timer2CompAVect = 13, 16 | Timer2CompBVect = 14, 17 | Timer2OvfVect = 15, 18 | Timer1CaptVect = 16, 19 | Timer1CompAVect = 17, 20 | Timer1CompBVect = 18, 21 | Timer1CompCVect = 19, 22 | Timer1OvfVect = 20, 23 | Timer0CompAVect = 21, 24 | Timer0CompBVect = 22, 25 | Timer0OvfVect = 23, 26 | SpiStcVect = 24, 27 | Usart1RxVect = 25, 28 | Usart1UdreVect = 26, 29 | Usart1TxVect = 27, 30 | AnalogCompVect = 28, 31 | AdcVect = 29, 32 | EeReadyVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3CompCVect = 34, 37 | Timer3OvfVect = 35, 38 | TwiVect = 36, 39 | SpmReadyVect = 37, 40 | -------------------------------------------------------------------------------- /examples/bootloader/src/delay.nim: -------------------------------------------------------------------------------- 1 | import avr_io 2 | import volatile 3 | 4 | 5 | const 6 | # Our timer resolution 7 | timerRes = 8'u8 # ms 8 | 9 | 10 | var 11 | # Just used for counting in our delay routines. 12 | elapsed = 0'u8 13 | 14 | 15 | proc timer0Handler() {.isr(Timer0CompAVect).} = 16 | # This simply adds 1 to our volatile global counter. 17 | volatileStore(addr elapsed, volatileLoad(addr elapsed) + 1) 18 | 19 | 20 | proc initDelayTimer*() = 21 | # Same as in the arduino_uno_blink example. This time the clock frequency 22 | # is 8MHz, so by keeping the same configuration, we trigger an interrupt 23 | # every 8ms: 24 | # (T_isr = (1/(f_cpu/prescaling)) * OCR0A) = 1/(8MHz/256) * 250 = 8 ms. 25 | OCR0A[] = 250 26 | TCCR0A.setBit(1) 27 | TCCR0B.setBit(2) 28 | TIMSK0.setBit(1) 29 | 30 | 31 | template delayMs*(t: static[int]) = 32 | # This is a generic, interrupt-driven delay. We poll a global variable 33 | # until its value hits a certain treshold, which is scaled by the interrupt 34 | # frequency for our chosen timer. 35 | const thresh = t div timerRes 36 | sei() 37 | while volatileLoad(addr elapsed) < thresh: 38 | discard 39 | cli() 40 | volatileStore(addr elapsed, 0) 41 | -------------------------------------------------------------------------------- /examples/progmem/README.md: -------------------------------------------------------------------------------- 1 | # progmem 2 | 3 | An example application showcasing how to interact with progmem data. 4 | 5 | ## Dependencies 6 | 7 | - ```avr-gcc``` 8 | - ```avr-libc``` 9 | - ```avrdude``` 10 | 11 | ## Building the project 12 | 13 | To build the project, just run: 14 | 15 | ```bash 16 | nimble build 17 | ``` 18 | 19 | Additional targets: 20 | 21 | ```bash 22 | nimble clear # cleans the artifacts from a previous build 23 | nimble flash # flashes the .hex file onto the Arduino Uno 24 | nimble flash_debug # flashes the .elf file onto the Arduino Uno 25 | ``` 26 | 27 | Notice that the specified port is the default one for an Arduino on Linux, 28 | change it accordingly to your system. 29 | 30 | Once you have flashed the sketch, you can verify that the Arduino Uno is 31 | sending the progmem data through the serial port. 32 | 33 | ## Check the results 34 | 35 | Once the application is uploaded onto the board, you can test it out using 36 | the `serial_read` python script included wihtin this example project 37 | `scripts` directory. 38 | 39 | ```bash 40 | nimble build 41 | nimble flash 42 | ./scripts/serial_read 43 | ``` 44 | 45 | Note that this requires a `python3` installation, together with the 46 | `pyserial` library. -------------------------------------------------------------------------------- /examples/usart/src/usart.nim: -------------------------------------------------------------------------------- 1 | ## A simple application, implementing an echo server running on an 2 | ## ATMega328P-based Arduino Uno, showcasing the basic Usart peripheral 3 | ## functionalities in synchronous mode. 4 | 5 | import avr_io 6 | 7 | const 8 | builtinLed = 5'u8 9 | 10 | proc loop = 11 | # The baud rate template allows for the end user to have a compile-time 12 | # evaluated baud rate, compliant with the 16-bit value expected from the 13 | # MCU. Use with `const`. 14 | const baud = baud_rate(9600'u32) 15 | 16 | # A number of usartN objects will be exposed by the library, depending on the 17 | # number of usart peripherals on the chosen MCU. To initiaize the 18 | # peripheral, just pass the required flags as flagsets for the three control 19 | # registers to the `initUart` procedure. 20 | usart0.init_uart(baud, {}, {txen, rxen}, {ucsz1, ucsz0}) 21 | portB.as_output_pin(builtinLed) 22 | 23 | var buf: array[100, cchar] 24 | while true: 25 | discard usart0.read_line(buf) # Read the data using `buf` as a buffer 26 | usart0.write_string_ln(buf) # Send the 0-terminated string back 27 | portB.toggle_pin(builtinLed) # Toggling the LED to have some feedback 28 | 29 | when isMainModule: 30 | loop() 31 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega16u4.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Reserved1Vect = 5, 8 | Reserved2Vect = 6, 9 | Int6Vect = 7, 10 | Reserved3Vect = 8, 11 | PCInt0Vect = 9, 12 | UsbGenVect = 10, 13 | UsbComVect = 11, 14 | WdtVect = 12, 15 | Reserved4Vect = 13, 16 | Reserved5Vect = 14, 17 | Reserved6Vect = 15, 18 | Timer1CaptVect = 16, 19 | Timer1CompAVect = 17, 20 | Timer1CompBVect = 18, 21 | Timer1CompCVect = 19, 22 | Timer1OvfVect = 20, 23 | Timer0CompAVect = 21, 24 | Timer0CompBVect = 22, 25 | Timer0OvfVect = 23, 26 | SpiStcVect = 24, 27 | Usart1RxVect = 25, 28 | Usart1UdreVect = 26, 29 | Usart1TxVect = 27, 30 | AnalogCompVect = 28, 31 | AdcVect = 29, 32 | EeReadyVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3CompCVect = 34, 37 | Timer3OvfVect = 35, 38 | TwiVect = 36, 39 | SpmReadyVect = 37, 40 | Timer4CompAVect = 38, 41 | Timer4CompBVect = 39, 42 | Timer4CompDVect = 40, 43 | Timer4OvfVect = 41, 44 | Timer4FpfVect = 42, 45 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega32u4.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Reserved1Vect = 5, 8 | Reserved2Vect = 6, 9 | Int6Vect = 7, 10 | Reserved3Vect = 8, 11 | PCInt0Vect = 9, 12 | UsbGenVect = 10, 13 | UsbComVect = 11, 14 | WdtVect = 12, 15 | Reserved4Vect = 13, 16 | Reserved5Vect = 14, 17 | Reserved6Vect = 15, 18 | Timer1CaptVect = 16, 19 | Timer1CompAVect = 17, 20 | Timer1CompBVect = 18, 21 | Timer1CompCVect = 19, 22 | Timer1OvfVect = 20, 23 | Timer0CompAVect = 21, 24 | Timer0CompBVect = 22, 25 | Timer0OvfVect = 23, 26 | SpiStcVect = 24, 27 | Usart1RxVect = 25, 28 | Usart1UdreVect = 26, 29 | Usart1TxVect = 27, 30 | AnalogCompVect = 28, 31 | AdcVect = 29, 32 | EeReadyVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3CompCVect = 34, 37 | Timer3OvfVect = 35, 38 | TwiVect = 36, 39 | SpmReadyVect = 37, 40 | Timer4CompAVect = 38, 41 | Timer4CompBVect = 39, 42 | Timer4CompDVect = 40, 43 | Timer4OvfVect = 41, 44 | Timer4FpfVect = 42, 45 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega328pb.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | PCInt0Vect = 3, 6 | PCInt1Vect = 4, 7 | PCInt2Vect = 5, 8 | WdtVect = 6, 9 | Timer2CompAVect = 7, 10 | Timer2CompBVect = 8, 11 | Timer2OvfVect = 9, 12 | Timer1CaptVect = 10, 13 | Timer1CompAVect = 11, 14 | Timer1CompBVect = 12, 15 | Timer1OvfVect = 13, 16 | Timer0CompAVect = 14, 17 | Timer0CompBVect = 15, 18 | Timer0OvfVect = 16, 19 | Spi0StcVect = 17, 20 | Usart0RxVect = 18, 21 | Usart0UdreVect = 19, 22 | Usart0TxVect = 20, 23 | AdcVect = 21, 24 | EeReadyVect = 22, 25 | AnalogCompVect = 23, 26 | Twi0Vect = 24, 27 | SpmReadyVect = 25, 28 | Usart0StartVect = 26, 29 | PCInt3Vect = 27, 30 | Usart1RxVect = 28, 31 | Usart1UdreVect = 29, 32 | Usart1TxVect = 30, 33 | Usart1StartVect = 31, 34 | Timer3CaptVect = 32, 35 | Timer3CompAVect = 33, 36 | Timer3CompBVect = 34, 37 | Timer3OvfVect = 35, 38 | CfdVect = 36, 39 | PtcEocVect = 37, 40 | PtcWcompVect = 38, 41 | Spi1StcVect = 39, 42 | Twi1Vect = 40, 43 | Timer4CaptVect = 41, 44 | Timer4CompAVect = 42, 45 | Timer4CompBVect = 43, 46 | Timer4OvfVect = 44, 47 | -------------------------------------------------------------------------------- /examples/usart/README.md: -------------------------------------------------------------------------------- 1 | # progmem 2 | 3 | An example application showcasing how to interact the usart peripherals. 4 | This project actually includes two sub-application, one showcasing a basic 5 | way to use the Usart peripheral, and another showing it in 9-bit mode. 6 | 7 | ## Dependencies 8 | 9 | - ```avr-gcc``` 10 | - ```avr-libc``` 11 | - ```avrdude``` 12 | 13 | ## Building the project 14 | 15 | To build the project, just run: 16 | 17 | ```bash 18 | nimble build 19 | ``` 20 | 21 | Additional targets: 22 | 23 | ```bash 24 | nimble clear # cleans the artifacts from a previous build 25 | nimble flash # flashes the .hex file onto the Arduino Uno 26 | nimble flash_debug # flashes the .elf file onto the Arduino Uno 27 | ``` 28 | 29 | Notice that the specified port is the default one for an Arduino on Linux, 30 | change it accordingly to your system. 31 | 32 | Once you have flashed the sketch, you can verify that the Arduino Uno is 33 | sending the progmem data through the serial port. 34 | 35 | ## Check the results 36 | 37 | Once the application is uploaded onto the board, you can test it out using 38 | the `serial_read` python script included wihtin this example project 39 | `scripts` directory. 40 | 41 | ```bash 42 | nimble build 43 | nimble flash 44 | ./scripts/serial_test 45 | ``` 46 | 47 | Note that this requires a `python3` installation, together with the 48 | `pyserial` library. -------------------------------------------------------------------------------- /examples/progmem/scripts/serial_read: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | """ 4 | Simple python script to read from the data sent from the Arduino Uno to the 5 | serial port. 6 | 7 | Note that pyserial is required, and that this script uses /dev/ttyACM0 as the 8 | default port. Change it accordingly to your device/OS. 9 | """ 10 | 11 | import serial 12 | import struct 13 | import sys 14 | 15 | 16 | def num_to_str(data): 17 | try: 18 | dt, bitstr = data.split(b" ") 19 | dt_map = { 20 | b"float": ("f", 4), 21 | b"uint8": ("B", 1), 22 | b"uint16": ("H", 2), 23 | b"uint32": ("I", 4), 24 | } 25 | 26 | dt_pkstr = dt_map[dt][0] 27 | dt_width = dt_map[dt][1] 28 | 29 | # [:-1] to ignore the trailing newline 30 | b = int(bitstr[:-1], 2).to_bytes(dt_width, "little") 31 | return True, struct.unpack(dt_pkstr, b)[0] 32 | except Exception as e: 33 | return False, None 34 | 35 | 36 | def main(): 37 | if len(sys.argv) == 2: 38 | port = sys.argv[1] 39 | else: 40 | port = "/dev/ttyACM0" 41 | 42 | s = serial.Serial(port=port, baudrate=9600) 43 | 44 | reading = True 45 | 46 | while reading: 47 | try: 48 | d = s.readline() 49 | isNum, n = num_to_str(d) 50 | print(n if isNum else d) 51 | except KeyboardInterrupt: 52 | reading = False 53 | 54 | print("bye") 55 | s.close() 56 | 57 | if __name__ == "__main__": 58 | main() 59 | -------------------------------------------------------------------------------- /examples/timer/timer.nimble: -------------------------------------------------------------------------------- 1 | # Package 2 | 3 | version = "0.1.0" 4 | author = "mar" 5 | description = "Simple application showcasing the timer features." 6 | license = "BSD-3-Clause" 7 | srcDir = "src" 8 | bin = @["timer"] 9 | 10 | 11 | # Dependencies 12 | 13 | requires "nim >= 2.0.6" 14 | requires "avr_io >= 0.6.1" 15 | 16 | after build: 17 | when defined(windows): 18 | mvFile(bin[0] & ".exe", bin[0] & ".elf") 19 | else: 20 | mvFile(bin[0], bin[0] & ".elf") 21 | exec("avr-objcopy -O ihex " & bin[0] & ".elf " & bin[0] & ".hex") 22 | exec("avr-objcopy -O binary " & bin[0] & ".elf " & bin[0] & ".bin") 23 | 24 | task clear, "Deletes the previously built compiler artifacts": 25 | rmFile(bin[0] & ".elf") 26 | rmFile(bin[0] & ".hex") 27 | rmFile(bin[0] & ".bin") 28 | rmDir(".nimcache") 29 | 30 | task flash, "Loads the compiled binary onto the MCU": 31 | let (dev_port, code) = gorge_ex("avrman device -p UNO") 32 | if code != 0: 33 | echo dev_port 34 | return 35 | exec("avrdude -c arduino -p atmega328p -b 115200 -P " & dev_port & " -U flash:w:" & bin[0] & ".hex:i") 36 | 37 | task flash_debug, "Loads the elf binary onto the MCU": 38 | let (dev_port, code) = gorge_ex("avrman device -p UNO") 39 | if code != 0: 40 | echo dev_port 41 | return 42 | exec("avrdude -c arduino -p atmega328p -b 115200 -P " & dev_port & " -U flash:w:" & bin[0] & ".elf:e") 43 | -------------------------------------------------------------------------------- /examples/progmem/progmem.nimble: -------------------------------------------------------------------------------- 1 | # Package 2 | 3 | version = "0.1.0" 4 | author = "mar" 5 | description = "Simple application showcasing the progmem features." 6 | license = "BSD-3-Clause" 7 | srcDir = "src" 8 | bin = @["progmem"] 9 | 10 | 11 | # Dependencies 12 | 13 | requires "nim >= 2.0.6" 14 | requires "avr_io >= 0.6.1" 15 | 16 | after build: 17 | when defined(windows): 18 | mvFile(bin[0] & ".exe", bin[0] & ".elf") 19 | else: 20 | mvFile(bin[0], bin[0] & ".elf") 21 | exec("avr-objcopy -O ihex " & bin[0] & ".elf " & bin[0] & ".hex") 22 | exec("avr-objcopy -O binary " & bin[0] & ".elf " & bin[0] & ".bin") 23 | 24 | task clear, "Deletes the previously built compiler artifacts": 25 | rmFile(bin[0] & ".elf") 26 | rmFile(bin[0] & ".hex") 27 | rmFile(bin[0] & ".bin") 28 | rmDir(".nimcache") 29 | 30 | task flash, "Loads the compiled binary onto the MCU": 31 | let (dev_port, code) = gorge_ex("avrman device -p UNO") 32 | if code != 0: 33 | echo dev_port 34 | return 35 | exec("avrdude -c arduino -p atmega328p -b 115200 -P " & dev_port & " -U flash:w:" & bin[0] & ".hex:i") 36 | 37 | task flash_debug, "Loads the elf binary onto the MCU": 38 | let (dev_port, code) = gorge_ex("avrman device -p UNO") 39 | if code != 0: 40 | echo dev_port 41 | return 42 | exec("avrdude -c arduino -p atmega328p -b 115200 -P " & dev_port & " -U flash:w:" & bin[0] & ".elf:e") 43 | -------------------------------------------------------------------------------- /examples/arduino_uno_blink/arduino_uno_blink.nimble: -------------------------------------------------------------------------------- 1 | # Package 2 | 3 | version = "0.1.0" 4 | author = "mar" 5 | description = "Simple blink application running on an Arduino Uno." 6 | license = "BSD-3-Clause" 7 | srcDir = "src" 8 | bin = @["arduino_uno_blink"] 9 | 10 | 11 | # Dependencies 12 | 13 | requires "nim >= 2.0.6" 14 | requires "avr_io >= 0.6.1" 15 | 16 | after build: 17 | when defined(windows): 18 | mvFile(bin[0] & ".exe", bin[0] & ".elf") 19 | else: 20 | mvFile(bin[0], bin[0] & ".elf") 21 | exec("avr-objcopy -O ihex " & bin[0] & ".elf " & bin[0] & ".hex") 22 | exec("avr-objcopy -O binary " & bin[0] & ".elf " & bin[0] & ".bin") 23 | 24 | task clear, "Deletes the previously built compiler artifacts": 25 | rmFile(bin[0] & ".elf") 26 | rmFile(bin[0] & ".hex") 27 | rmFile(bin[0] & ".bin") 28 | rmDir(".nimcache") 29 | 30 | task flash, "Loads the compiled binary onto the MCU": 31 | let (dev_port, code) = gorge_ex("avrman device -p UNO") 32 | if code != 0: 33 | echo dev_port 34 | return 35 | exec("avrdude -c arduino -p atmega328p -b 115200 -P " & dev_port & " -U flash:w:" & bin[0] & ".hex:i") 36 | 37 | task flash_debug, "Loads the elf binary onto the MCU": 38 | let (dev_port, code) = gorge_ex("avrman device -p UNO") 39 | if code != 0: 40 | echo dev_port 41 | return 42 | exec("avrdude -c arduino -p atmega328p -b 115200 -P " & dev_port & " -U flash:w:" & bin[0] & ".elf:e") 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2022 - 2025 Gianmarco Marcello 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /examples/arduino_uno_blink/src/arduino_uno_blink.nim: -------------------------------------------------------------------------------- 1 | ## A simple blink application running on an ATMega328P-based Arduino Uno 2 | ## which uses some basic avr_io features. 3 | 4 | import avr_io 5 | import avr_io/interrupt 6 | 7 | import counter 8 | 9 | var 10 | ctr = newCounter(250) 11 | 12 | const 13 | builtinLed = 5'u8 14 | 15 | 16 | proc initTimer0() = 17 | # Timer0 in CTC mode, interrupt on compare match with OCR0A 18 | # Prescaling the clock of a factor of 256. 19 | # Considering: 20 | # f = 16 MHz; f_tim0 = f/256 = 16 MHz / 256 = 62,5 KHz 21 | # t_tim0 = 1/f_tim0 = 16 us; 22 | # t_int = t_tim0 * OCR0A = 16 us * 250 = 4 ms 23 | # This configuration raises an interrupt every 4 ms 24 | OCR0A[] = 250 25 | TCCR0A.setBit(1) 26 | TCCR0B.setBit(2) 27 | TIMSK0.setBit(1) 28 | 29 | 30 | # You can create an interrupt service routine for a specific interrupt signal 31 | # by just using the `isr` macro attribute, passing the specific interrupt 32 | # signal to it. The signals are of the `VectorInterrupt` type and are 33 | # device-specific. 34 | proc timer0_compa_isr() {.isr(Timer0CompAVect).} = 35 | inc ctr 36 | 37 | 38 | proc loop = 39 | sei() # Let us enable the interrupts 40 | initTimer0() 41 | portB.asOutputPin(builtinLed) # Pin 5 of PORTB is the Arduino Uno builtin led 42 | 43 | while true: 44 | if ctr.checkThreshold(): 45 | portB.togglePin(builtinLed) 46 | ctr.reset() 47 | 48 | 49 | when isMainModule: 50 | loop() 51 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega324pb.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | PCInt0Vect = 4, 7 | PCInt1Vect = 5, 8 | PCInt2Vect = 6, 9 | PCInt3Vect = 7, 10 | WdtVect = 8, 11 | Timer2CompAVect = 9, 12 | Timer2CompBVect = 10, 13 | Timer2OvfVect = 11, 14 | Timer1CaptVect = 12, 15 | Timer1CompAVect = 13, 16 | Timer1CompBVect = 14, 17 | Timer1OvfVect = 15, 18 | Timer0CompAVect = 16, 19 | Timer0CompBVect = 17, 20 | Timer0OvfVect = 18, 21 | Spi0StcVect = 19, 22 | Usart0RxVect = 20, 23 | Usart0UdreVect = 21, 24 | Usart0TxVect = 22, 25 | AnalogCompVect = 23, 26 | AdcVect = 24, 27 | EeReadyVect = 25, 28 | Twi0Vect = 26, 29 | SpmReadyVect = 27, 30 | Usart1RxVect = 28, 31 | Usart1UdreVect = 29, 32 | Usart1TxVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3OvfVect = 34, 37 | Usart0RxsVect = 35, 38 | Usart1RxsVect = 36, 39 | PCInt4Vect = 37, 40 | XoscfdVect = 38, 41 | PtcEocVect = 39, 42 | PtcWcompVect = 40, 43 | Spi1StcVect = 41, 44 | Twi1Vect = 42, 45 | Timer4CaptVect = 43, 46 | Timer4CompAVect = 44, 47 | Timer4CompBVect = 45, 48 | Timer4OvfVect = 46, 49 | Usart2RxVect = 47, 50 | Usart2UdreVect = 48, 51 | Usart2TxVect = 49, 52 | Usart2RxsVect = 50, 53 | -------------------------------------------------------------------------------- /scripts/supported.nims: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S nim e --hints:off --stackTrace:off 2 | 3 | import std/[algorithm, enumerate, os, sequtils, sets, strutils, strformat] 4 | 5 | 6 | proc parent(path: string): string = 7 | let splitted = path.split("/") 8 | splitted[0 .. ^2].join("/") 9 | 10 | 11 | proc extract_name(path: string): string = 12 | let splitted = path.split("/") 13 | splitted[^1].split(".")[0] 14 | 15 | 16 | proc patchNimsArgs(): seq[string] = 17 | # Needed pre-nim v2.2.2 18 | var nims = false 19 | for i in 0..paramCount(): 20 | if nims: result.add(paramStr(i)) 21 | if paramStr(i).endsWith(".nims"): nims = true 22 | 23 | 24 | let mcus = (proc(): OrderedSet[string] = 25 | let root = project_dir().parent 26 | let dir = fmt"{root}/src/avr_io/private/" 27 | for file_name in list_files(dir): 28 | var name = file_name.extract_name 29 | if name.starts_with("at"): 30 | if name.starts_with("atmegas"): 31 | name.delete(6..6) # deletes the "s" as the chips are similar 32 | result.incl name 33 | )() 34 | 35 | 36 | proc main() = 37 | let args = patchNimsArgs() 38 | case args.len: 39 | of 0: 40 | let max_len = mcus.to_seq.map(proc(s: string): int = s.len).max 41 | let sorted = mcus.to_seq.sorted() 42 | var str = "" 43 | for (ctr, chip) in enumerate(1, sorted): 44 | str &= fmt"{chip.alignLeft(max_len)} " 45 | if ctr mod 5 == 0: str &= "\n" 46 | echo str 47 | of 1: echo if args[0] in mcus: "supported" else: "not supported" 48 | else: echo "usage: ./scripts/supported [chip]" 49 | 50 | 51 | main() 52 | -------------------------------------------------------------------------------- /examples/bootloader/bootloader.nimble: -------------------------------------------------------------------------------- 1 | # Package 2 | 3 | version = "0.1.0" 4 | author = "mar" 5 | description = "A project showing how to write a bootloader + application for an ATMega chip using the avr_io nim library." 6 | license = "BSD-3-Clause" 7 | srcDir = "src" 8 | bin = @["bootloader", "application"] 9 | 10 | 11 | # Dependencies 12 | 13 | requires "nim >= 2.0.6" 14 | requires "avr_io >= 0.6.1" 15 | 16 | after build: 17 | for b in bin: 18 | when defined(windows): 19 | if not fileExists(b & ".exe"): 20 | continue 21 | mvFile(b & ".exe", b & ".elf") 22 | else: 23 | if not fileExists(b): 24 | continue 25 | mvFile(b, b & ".elf") 26 | exec("avr-objcopy -O ihex " & b & ".elf " & b & ".hex") 27 | exec("avr-objcopy -O binary " & b & ".elf " & b & ".bin") 28 | if b == "application": 29 | exec("harlock ./scripts/embed " & b) 30 | exec("srec_cat " & bin[0] & ".hex -I " & bin[1] & ".hex -I -o full_app.hex -I") 31 | exec("avr-objcopy -O binary -I ihex full_app.hex full_app.bin") 32 | 33 | 34 | task clear, "Deletes the previously built compiler artifacts": 35 | for b in bin: 36 | rmFile(b & ".elf") 37 | rmFile(b & ".hex") 38 | rmFile(b & ".bin") 39 | rmDir(".nimcache") 40 | rmFile("full_app.hex") 41 | rmFile("full_app.bin") 42 | 43 | task flash, "Loads the compiled binary onto the MCU": 44 | if fileExists("full_app.hex"): 45 | exec("avrdude -c atmelice -p m644 -U flash:w:full_app.hex:i") 46 | 47 | task fuse, "Initialize the correct fuses to run the application": 48 | exec("avrdude -c atmelice -p m644 -U lfuse:w:0xe2:m -U hfuse:w:0x18:m -U efuse:w:0xff:m") 49 | -------------------------------------------------------------------------------- /examples/usart/usart.nimble: -------------------------------------------------------------------------------- 1 | # Package 2 | 3 | version = "0.1.0" 4 | author = "mar" 5 | description = "Simple application showcasing the usart features." 6 | license = "BSD-3-Clause" 7 | srcDir = "src" 8 | bin = @["usart", "usart9bits"] 9 | 10 | 11 | # Dependencies 12 | 13 | requires "nim >= 2.0.6" 14 | requires "avr_io >= 0.6.1" 15 | 16 | after build: 17 | for b in bin: 18 | when defined(windows): 19 | if not fileExists(b & ".exe"): 20 | continue 21 | mvFile(b & ".exe", b & ".elf") 22 | else: 23 | if not fileExists(b): 24 | continue 25 | mvFile(b, b & ".elf") 26 | exec("avr-objcopy -O ihex " & b & ".elf " & b & ".hex") 27 | exec("avr-objcopy -O binary " & b & ".elf " & b & ".bin") 28 | 29 | task clear, "Deletes the previously built compiler artifacts": 30 | for b in bin: 31 | rmFile(b & ".elf") 32 | rmFile(b & ".hex") 33 | rmFile(b & ".bin") 34 | rmDir(".nimcache") 35 | 36 | task flash, "Loads the compiled binary onto the MCU": 37 | for b in bin: 38 | if fileExists(b & ".hex"): 39 | let (dev_port, code) = gorge_ex("avrman device -p UNO") 40 | if code != 0: 41 | echo dev_port 42 | return 43 | exec("avrdude -c arduino -b 115200 -p m328p -P " & dev_port & " -U flash:w:" & b & ".hex:i") 44 | break 45 | 46 | task flash_debug, "Loads the elf binary onto the MCU": 47 | for b in bin: 48 | if fileExists(b & ".elf"): 49 | let (dev_port, code) = gorge_ex("avrman device -p UNO") 50 | if code != 0: 51 | echo dev_port 52 | return 53 | exec("avrdude -c stk500v2 -D -b 115200 -p m328p " & dev_port & " -U flash:w:" & b & ".elf:e") 54 | break -------------------------------------------------------------------------------- /src/avr_io/private/attiny13.nim: -------------------------------------------------------------------------------- 1 | include mapped_io 2 | include usart 3 | include timer 4 | 5 | const 6 | ADCSRB* = MappedIoRegister[uint8](0x23) 7 | ADC* = MappedIoRegister[uint16](0x24) 8 | ADCL* = MappedIoRegister[uint8](0x24) 9 | ADCH* = MappedIoRegister[uint8](0x25) 10 | ADCSRA* = MappedIoRegister[uint8](0x26) 11 | ADMUX* = MappedIoRegister[uint8](0x27) 12 | ACSR* = MappedIoRegister[uint8](0x28) 13 | DIDR0* = MappedIoRegister[uint8](0x34) 14 | PCMSK* = MappedIoRegister[uint8](0x35) 15 | PINB* = MappedIoRegister[uint8](0x36) 16 | DDRB* = MappedIoRegister[uint8](0x37) 17 | PORTB* = MappedIoRegister[uint8](0x38) 18 | EECR* = MappedIoRegister[uint8](0x3C) 19 | EEDR* = MappedIoRegister[uint8](0x3D) 20 | EEAR* = MappedIoRegister[uint8](0x3E) 21 | WDTCR* = MappedIoRegister[uint8](0x41) 22 | CLKPR* = MappedIoRegister[uint8](0x46) 23 | GTCCR* = MappedIoRegister[uint8](0x48) 24 | OCR0B* = MappedIoRegister[uint8](0x49) 25 | DWDR* = MappedIoRegister[uint8](0x4E) 26 | TCCR0A* = MappedIoRegister[uint8](0x4F) 27 | OSCCAL* = MappedIoRegister[uint8](0x51) 28 | TCNT0* = MappedIoRegister[uint8](0x52) 29 | TCCR0B* = MappedIoRegister[uint8](0x53) 30 | MCUSR* = MappedIoRegister[uint8](0x54) 31 | MCUCR* = MappedIoRegister[uint8](0x55) 32 | OCR0A* = MappedIoRegister[uint8](0x56) 33 | SPMCSR* = MappedIoRegister[uint8](0x57) 34 | TIFR0* = MappedIoRegister[uint8](0x58) 35 | TIMSK0* = MappedIoRegister[uint8](0x59) 36 | GIFR* = MappedIoRegister[uint8](0x5A) 37 | GIMSK* = MappedIoRegister[uint8](0x5B) 38 | SPL* = MappedIoRegister[uint8](0x5D) 39 | SREG* = MappedIoRegister[uint8](0x5F) 40 | 41 | const 42 | portb* = Port(direction: DDRB, output: PORTB, input: PINB) 43 | 44 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega1280.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | PCInt1Vect = 10, 13 | PCInt2Vect = 11, 14 | WdtVect = 12, 15 | Timer2CompAVect = 13, 16 | Timer2CompBVect = 14, 17 | Timer2OvfVect = 15, 18 | Timer1CaptVect = 16, 19 | Timer1CompAVect = 17, 20 | Timer1CompBVect = 18, 21 | Timer1CompCVect = 19, 22 | Timer1OvfVect = 20, 23 | Timer0CompAVect = 21, 24 | Timer0CompBVect = 22, 25 | Timer0OvfVect = 23, 26 | SpiStcVect = 24, 27 | Usart0RxVect = 25, 28 | Usart0UdreVect = 26, 29 | Usart0TxVect = 27, 30 | AnalogCompVect = 28, 31 | AdcVect = 29, 32 | EeReadyVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3CompCVect = 34, 37 | Timer3OvfVect = 35, 38 | Usart1RxVect = 36, 39 | Usart1UdreVect = 37, 40 | Usart1TxVect = 38, 41 | TwiVect = 39, 42 | SpmReadyVect = 40, 43 | Timer4CaptVect = 41, 44 | Timer4CompAVect = 42, 45 | Timer4CompBVect = 43, 46 | Timer4CompCVect = 44, 47 | Timer4OvfVect = 45, 48 | Timer5CaptVect = 46, 49 | Timer5CompAVect = 47, 50 | Timer5CompBVect = 48, 51 | Timer5CompCVect = 49, 52 | Timer5OvfVect = 50, 53 | Usart2RxVect = 51, 54 | Usart2UdreVect = 52, 55 | Usart2TxVect = 53, 56 | Usart3RxVect = 54, 57 | Usart3UdreVect = 55, 58 | Usart3TxVect = 56, 59 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega1281.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | PCInt1Vect = 10, 13 | PCInt2Vect = 11, 14 | WdtVect = 12, 15 | Timer2CompAVect = 13, 16 | Timer2CompBVect = 14, 17 | Timer2OvfVect = 15, 18 | Timer1CaptVect = 16, 19 | Timer1CompAVect = 17, 20 | Timer1CompBVect = 18, 21 | Timer1CompCVect = 19, 22 | Timer1OvfVect = 20, 23 | Timer0CompAVect = 21, 24 | Timer0CompBVect = 22, 25 | Timer0OvfVect = 23, 26 | SpiStcVect = 24, 27 | Usart0RxVect = 25, 28 | Usart0UdreVect = 26, 29 | Usart0TxVect = 27, 30 | AnalogCompVect = 28, 31 | AdcVect = 29, 32 | EeReadyVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3CompCVect = 34, 37 | Timer3OvfVect = 35, 38 | Usart1RxVect = 36, 39 | Usart1UdreVect = 37, 40 | Usart1TxVect = 38, 41 | TwiVect = 39, 42 | SpmReadyVect = 40, 43 | Timer4CaptVect = 41, 44 | Timer4CompAVect = 42, 45 | Timer4CompBVect = 43, 46 | Timer4CompCVect = 44, 47 | Timer4OvfVect = 45, 48 | Timer5CaptVect = 46, 49 | Timer5CompAVect = 47, 50 | Timer5CompBVect = 48, 51 | Timer5CompCVect = 49, 52 | Timer5OvfVect = 50, 53 | Usart2RxVect = 51, 54 | Usart2UdreVect = 52, 55 | Usart2TxVect = 53, 56 | Usart3RxVect = 54, 57 | Usart3UdreVect = 55, 58 | Usart3TxVect = 56, 59 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega2560.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | PCInt1Vect = 10, 13 | PCInt2Vect = 11, 14 | WdtVect = 12, 15 | Timer2CompAVect = 13, 16 | Timer2CompBVect = 14, 17 | Timer2OvfVect = 15, 18 | Timer1CaptVect = 16, 19 | Timer1CompAVect = 17, 20 | Timer1CompBVect = 18, 21 | Timer1CompCVect = 19, 22 | Timer1OvfVect = 20, 23 | Timer0CompAVect = 21, 24 | Timer0CompBVect = 22, 25 | Timer0OvfVect = 23, 26 | SpiStcVect = 24, 27 | Usart0RxVect = 25, 28 | Usart0UdreVect = 26, 29 | Usart0TxVect = 27, 30 | AnalogCompVect = 28, 31 | AdcVect = 29, 32 | EeReadyVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3CompCVect = 34, 37 | Timer3OvfVect = 35, 38 | Usart1RxVect = 36, 39 | Usart1UdreVect = 37, 40 | Usart1TxVect = 38, 41 | TwiVect = 39, 42 | SpmReadyVect = 40, 43 | Timer4CaptVect = 41, 44 | Timer4CompAVect = 42, 45 | Timer4CompBVect = 43, 46 | Timer4CompCVect = 44, 47 | Timer4OvfVect = 45, 48 | Timer5CaptVect = 46, 49 | Timer5CompAVect = 47, 50 | Timer5CompBVect = 48, 51 | Timer5CompCVect = 49, 52 | Timer5OvfVect = 50, 53 | Usart2RxVect = 51, 54 | Usart2UdreVect = 52, 55 | Usart2TxVect = 53, 56 | Usart3RxVect = 54, 57 | Usart3UdreVect = 55, 58 | Usart3TxVect = 56, 59 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega2561.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | PCInt1Vect = 10, 13 | PCInt2Vect = 11, 14 | WdtVect = 12, 15 | Timer2CompAVect = 13, 16 | Timer2CompBVect = 14, 17 | Timer2OvfVect = 15, 18 | Timer1CaptVect = 16, 19 | Timer1CompAVect = 17, 20 | Timer1CompBVect = 18, 21 | Timer1CompCVect = 19, 22 | Timer1OvfVect = 20, 23 | Timer0CompAVect = 21, 24 | Timer0CompBVect = 22, 25 | Timer0OvfVect = 23, 26 | SpiStcVect = 24, 27 | Usart0RxVect = 25, 28 | Usart0UdreVect = 26, 29 | Usart0TxVect = 27, 30 | AnalogCompVect = 28, 31 | AdcVect = 29, 32 | EeReadyVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3CompCVect = 34, 37 | Timer3OvfVect = 35, 38 | Usart1RxVect = 36, 39 | Usart1UdreVect = 37, 40 | Usart1TxVect = 38, 41 | TwiVect = 39, 42 | SpmReadyVect = 40, 43 | Timer4CaptVect = 41, 44 | Timer4CompAVect = 42, 45 | Timer4CompBVect = 43, 46 | Timer4CompCVect = 44, 47 | Timer4OvfVect = 45, 48 | Timer5CaptVect = 46, 49 | Timer5CompAVect = 47, 50 | Timer5CompBVect = 48, 51 | Timer5CompCVect = 49, 52 | Timer5OvfVect = 50, 53 | Usart2RxVect = 51, 54 | Usart2UdreVect = 52, 55 | Usart2TxVect = 53, 56 | Usart3RxVect = 54, 57 | Usart3UdreVect = 55, 58 | Usart3TxVect = 56, 59 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega640.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | PCInt1Vect = 10, 13 | PCInt2Vect = 11, 14 | WdtVect = 12, 15 | Timer2CompAVect = 13, 16 | Timer2CompBVect = 14, 17 | Timer2OvfVect = 15, 18 | Timer1CaptVect = 16, 19 | Timer1CompAVect = 17, 20 | Timer1CompBVect = 18, 21 | Timer1CompCVect = 19, 22 | Timer1OvfVect = 20, 23 | Timer0CompAVect = 21, 24 | Timer0CompBVect = 22, 25 | Timer0OvfVect = 23, 26 | SpiStcVect = 24, 27 | Usart0RxVect = 25, 28 | Usart0UdreVect = 26, 29 | Usart0TxVect = 27, 30 | AnalogCompVect = 28, 31 | AdcVect = 29, 32 | EeReadyVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3CompCVect = 34, 37 | Timer3OvfVect = 35, 38 | Usart1RxVect = 36, 39 | Usart1UdreVect = 37, 40 | Usart1TxVect = 38, 41 | TwiVect = 39, 42 | SpmReadyVect = 40, 43 | Timer4CaptVect = 41, 44 | Timer4CompAVect = 42, 45 | Timer4CompBVect = 43, 46 | Timer4CompCVect = 44, 47 | Timer4OvfVect = 45, 48 | Timer5CaptVect = 46, 49 | Timer5CompAVect = 47, 50 | Timer5CompBVect = 48, 51 | Timer5CompCVect = 49, 52 | Timer5OvfVect = 50, 53 | Usart2RxVect = 51, 54 | Usart2UdreVect = 52, 55 | Usart2TxVect = 53, 56 | Usart3RxVect = 54, 57 | Usart3UdreVect = 55, 58 | Usart3TxVect = 56, 59 | -------------------------------------------------------------------------------- /src/avr_io/private/attiny13a.nim: -------------------------------------------------------------------------------- 1 | include mapped_io 2 | include usart 3 | include timer 4 | 5 | const 6 | ADCSRB* = MappedIoRegister[uint8](0x23) 7 | ADC* = MappedIoRegister[uint16](0x24) 8 | ADCL* = MappedIoRegister[uint8](0x24) 9 | ADCH* = MappedIoRegister[uint8](0x25) 10 | ADCSRA* = MappedIoRegister[uint8](0x26) 11 | ADMUX* = MappedIoRegister[uint8](0x27) 12 | ACSR* = MappedIoRegister[uint8](0x28) 13 | DIDR0* = MappedIoRegister[uint8](0x34) 14 | PCMSK* = MappedIoRegister[uint8](0x35) 15 | PINB* = MappedIoRegister[uint8](0x36) 16 | DDRB* = MappedIoRegister[uint8](0x37) 17 | PORTB* = MappedIoRegister[uint8](0x38) 18 | EECR* = MappedIoRegister[uint8](0x3C) 19 | EEDR* = MappedIoRegister[uint8](0x3D) 20 | EEAR* = MappedIoRegister[uint8](0x3E) 21 | WDTCR* = MappedIoRegister[uint8](0x41) 22 | PRR* = MappedIoRegister[uint8](0x45) 23 | CLKPR* = MappedIoRegister[uint8](0x46) 24 | GTCCR* = MappedIoRegister[uint8](0x48) 25 | OCR0B* = MappedIoRegister[uint8](0x49) 26 | DWDR* = MappedIoRegister[uint8](0x4E) 27 | TCCR0A* = MappedIoRegister[uint8](0x4F) 28 | BODCR* = MappedIoRegister[uint8](0x50) 29 | OSCCAL* = MappedIoRegister[uint8](0x51) 30 | TCNT0* = MappedIoRegister[uint8](0x52) 31 | TCCR0B* = MappedIoRegister[uint8](0x53) 32 | MCUSR* = MappedIoRegister[uint8](0x54) 33 | MCUCR* = MappedIoRegister[uint8](0x55) 34 | OCR0A* = MappedIoRegister[uint8](0x56) 35 | SPMCSR* = MappedIoRegister[uint8](0x57) 36 | TIFR0* = MappedIoRegister[uint8](0x58) 37 | TIMSK0* = MappedIoRegister[uint8](0x59) 38 | GIFR* = MappedIoRegister[uint8](0x5A) 39 | GIMSK* = MappedIoRegister[uint8](0x5B) 40 | SPL* = MappedIoRegister[uint8](0x5D) 41 | SREG* = MappedIoRegister[uint8](0x5F) 42 | 43 | const 44 | portb* = Port(direction: DDRB, output: PORTB, input: PINB) 45 | 46 | -------------------------------------------------------------------------------- /src/avr_io/private/attiny26.nim: -------------------------------------------------------------------------------- 1 | include mapped_io 2 | include usart 3 | include timer 4 | 5 | const 6 | ADC* = MappedIoRegister[uint16](0x24) 7 | ADCL* = MappedIoRegister[uint8](0x24) 8 | ADCH* = MappedIoRegister[uint8](0x25) 9 | ADCSR* = MappedIoRegister[uint8](0x26) 10 | ADMUX* = MappedIoRegister[uint8](0x27) 11 | ACSR* = MappedIoRegister[uint8](0x28) 12 | USICR* = MappedIoRegister[uint8](0x2D) 13 | USISR* = MappedIoRegister[uint8](0x2E) 14 | USIDR* = MappedIoRegister[uint8](0x2F) 15 | PINB* = MappedIoRegister[uint8](0x36) 16 | DDRB* = MappedIoRegister[uint8](0x37) 17 | PORTB* = MappedIoRegister[uint8](0x38) 18 | PINA* = MappedIoRegister[uint8](0x39) 19 | DDRA* = MappedIoRegister[uint8](0x3A) 20 | PORTA* = MappedIoRegister[uint8](0x3B) 21 | EECR* = MappedIoRegister[uint8](0x3C) 22 | EEDR* = MappedIoRegister[uint8](0x3D) 23 | EEAR* = MappedIoRegister[uint8](0x3E) 24 | WDTCR* = MappedIoRegister[uint8](0x41) 25 | PLLCSR* = MappedIoRegister[uint8](0x49) 26 | OCR1C* = MappedIoRegister[uint8](0x4B) 27 | OCR1B* = MappedIoRegister[uint8](0x4C) 28 | OCR1A* = MappedIoRegister[uint8](0x4D) 29 | TCNT1* = MappedIoRegister[uint8](0x4E) 30 | TCCR1B* = MappedIoRegister[uint8](0x4F) 31 | TCCR1A* = MappedIoRegister[uint8](0x50) 32 | OSCCAL* = MappedIoRegister[uint8](0x51) 33 | TCNT0* = MappedIoRegister[uint8](0x52) 34 | TCCR0* = MappedIoRegister[uint8](0x53) 35 | MCUSR* = MappedIoRegister[uint8](0x54) 36 | MCUCR* = MappedIoRegister[uint8](0x55) 37 | TIFR* = MappedIoRegister[uint8](0x58) 38 | TIMSK* = MappedIoRegister[uint8](0x59) 39 | GIFR* = MappedIoRegister[uint8](0x5A) 40 | GIMSK* = MappedIoRegister[uint8](0x5B) 41 | SP* = MappedIoRegister[uint8](0x5D) 42 | SREG* = MappedIoRegister[uint8](0x5F) 43 | 44 | const 45 | porta* = Port(direction: DDRA, output: PORTA, input: PINA) 46 | portb* = Port(direction: DDRB, output: PORTB, input: PINB) 47 | 48 | -------------------------------------------------------------------------------- /examples/bootloader/scripts/embed: -------------------------------------------------------------------------------- 1 | // Helper/builder that creates a header in one go 2 | var make_header = fun(text_addr, text_size, cks) { 3 | var word_size = 2 4 | var t_base_arr = try as_array(text_addr, word_size, "little") 5 | var t_base_size = try as_array(text_size, word_size, "little") 6 | ret t_base_arr + t_base_size + cks 7 | } 8 | 9 | // Get the project name 10 | var project = try args[1] 11 | 12 | // Default header section = '.metadata'; if the user passed a third argument, use that instead 13 | var text = ".text" 14 | var section = if len(args) == 3 { args[2] } else { ".metadata" } 15 | 16 | 17 | var hex_file = project + ".hex" 18 | var elf_file = project + ".elf" 19 | 20 | 21 | // Open the .elf file and extract section info from there 22 | var e = try open(elf_file, "elf") 23 | 24 | var text_addr = try e.section_address(text) 25 | var text_size = try e.section_size(text) 26 | 27 | var meta_addr = try e.section_address(section) 28 | var meta_size = try e.section_size(section) 29 | 30 | 31 | // Compute and write the application header 32 | var h = try open(hex_file, "hex") 33 | 34 | var text_hex = try h.read_at(text_addr, text_size) 35 | var cks_hex = try hash(text_hex, "sha1") 36 | 37 | var header = try make_header(text_addr, text_size, cks_hex) 38 | try h.write_at(meta_addr, header) 39 | try save(h) 40 | 41 | // Do the same for the elf binary 42 | var text_elf = try e.read_section(text) 43 | var cks_elf = try hash(text_elf, "sha1") 44 | 45 | var header2 = try make_header(text_addr, text_size, cks_elf) 46 | try e.write_section(section, header, 0) 47 | try save(e) 48 | 49 | // Print some info for the user 50 | print() 51 | print(text, " -- addr: ", hex(text_addr), " size: ", hex(text_size)) 52 | print(section, " -- addr: ", hex(meta_addr), "size: ", hex(meta_size)) 53 | 54 | print("Digest (.hex): ", hex(cks_hex), "Length: ", len(cks_hex)) 55 | print("Digest (.elf): ", hex(cks_elf), "Length: ", len(cks_elf)) 56 | print("Application section: @" + hex(meta_addr) + "\n") 57 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega64rfr2.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | PCInt1Vect = 10, 13 | PCInt2Vect = 11, 14 | WdtVect = 12, 15 | Timer2CompAVect = 13, 16 | Timer2CompBVect = 14, 17 | Timer2OvfVect = 15, 18 | Timer1CaptVect = 16, 19 | Timer1CompAVect = 17, 20 | Timer1CompBVect = 18, 21 | Timer1CompCVect = 19, 22 | Timer1OvfVect = 20, 23 | Timer0CompAVect = 21, 24 | Timer0CompBVect = 22, 25 | Timer0OvfVect = 23, 26 | SpiStcVect = 24, 27 | Usart0RxVect = 25, 28 | Usart0UdreVect = 26, 29 | Usart0TxVect = 27, 30 | AnalogCompVect = 28, 31 | AdcVect = 29, 32 | EeReadyVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3CompCVect = 34, 37 | Timer3OvfVect = 35, 38 | Usart1RxVect = 36, 39 | Usart1UdreVect = 37, 40 | Usart1TxVect = 38, 41 | TwiVect = 39, 42 | SpmReadyVect = 40, 43 | Timer4CaptVect = 41, 44 | Timer4CompAVect = 42, 45 | Timer4CompBVect = 43, 46 | Timer4CompCVect = 44, 47 | Timer4OvfVect = 45, 48 | Timer5CaptVect = 46, 49 | Timer5CompAVect = 47, 50 | Timer5CompBVect = 48, 51 | Timer5CompCVect = 49, 52 | Timer5OvfVect = 50, 53 | Trx24PllLockVect = 57, 54 | Trx24PllUnlockVect = 58, 55 | Trx24RxStartVect = 59, 56 | Trx24RxEndVect = 60, 57 | Trx24CcaEdDoneVect = 61, 58 | Trx24XahAmiVect = 62, 59 | Trx24TxEndVect = 63, 60 | Trx24AwakeVect = 64, 61 | ScntCmp1Vect = 65, 62 | ScntCmp2Vect = 66, 63 | ScntCmp3Vect = 67, 64 | ScntOvflVect = 68, 65 | ScntBackoffVect = 69, 66 | AesReadyVect = 70, 67 | BatLowVect = 71, 68 | Trx24TxStartVect = 72, 69 | Trx24Ami0Vect = 73, 70 | Trx24Ami1Vect = 74, 71 | Trx24Ami2Vect = 75, 72 | Trx24Ami3Vect = 76, 73 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega1284rfr2.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | PCInt1Vect = 10, 13 | PCInt2Vect = 11, 14 | WdtVect = 12, 15 | Timer2CompAVect = 13, 16 | Timer2CompBVect = 14, 17 | Timer2OvfVect = 15, 18 | Timer1CaptVect = 16, 19 | Timer1CompAVect = 17, 20 | Timer1CompBVect = 18, 21 | Timer1CompCVect = 19, 22 | Timer1OvfVect = 20, 23 | Timer0CompAVect = 21, 24 | Timer0CompBVect = 22, 25 | Timer0OvfVect = 23, 26 | SpiStcVect = 24, 27 | Usart0RxVect = 25, 28 | Usart0UdreVect = 26, 29 | Usart0TxVect = 27, 30 | AnalogCompVect = 28, 31 | AdcVect = 29, 32 | EeReadyVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3CompCVect = 34, 37 | Timer3OvfVect = 35, 38 | Usart1RxVect = 36, 39 | Usart1UdreVect = 37, 40 | Usart1TxVect = 38, 41 | TwiVect = 39, 42 | SpmReadyVect = 40, 43 | Timer4CaptVect = 41, 44 | Timer4CompAVect = 42, 45 | Timer4CompBVect = 43, 46 | Timer4CompCVect = 44, 47 | Timer4OvfVect = 45, 48 | Timer5CaptVect = 46, 49 | Timer5CompAVect = 47, 50 | Timer5CompBVect = 48, 51 | Timer5CompCVect = 49, 52 | Timer5OvfVect = 50, 53 | Trx24PllLockVect = 57, 54 | Trx24PllUnlockVect = 58, 55 | Trx24RxStartVect = 59, 56 | Trx24RxEndVect = 60, 57 | Trx24CcaEdDoneVect = 61, 58 | Trx24XahAmiVect = 62, 59 | Trx24TxEndVect = 63, 60 | Trx24AwakeVect = 64, 61 | ScntCmp1Vect = 65, 62 | ScntCmp2Vect = 66, 63 | ScntCmp3Vect = 67, 64 | ScntOvflVect = 68, 65 | ScntBackoffVect = 69, 66 | AesReadyVect = 70, 67 | BatLowVect = 71, 68 | Trx24TxStartVect = 72, 69 | Trx24Ami0Vect = 73, 70 | Trx24Ami1Vect = 74, 71 | Trx24Ami2Vect = 75, 72 | Trx24Ami3Vect = 76, 73 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega128rfr2.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | PCInt1Vect = 10, 13 | PCInt2Vect = 11, 14 | WdtVect = 12, 15 | Timer2CompAVect = 13, 16 | Timer2CompBVect = 14, 17 | Timer2OvfVect = 15, 18 | Timer1CaptVect = 16, 19 | Timer1CompAVect = 17, 20 | Timer1CompBVect = 18, 21 | Timer1CompCVect = 19, 22 | Timer1OvfVect = 20, 23 | Timer0CompAVect = 21, 24 | Timer0CompBVect = 22, 25 | Timer0OvfVect = 23, 26 | SpiStcVect = 24, 27 | Usart0RxVect = 25, 28 | Usart0UdreVect = 26, 29 | Usart0TxVect = 27, 30 | AnalogCompVect = 28, 31 | AdcVect = 29, 32 | EeReadyVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3CompCVect = 34, 37 | Timer3OvfVect = 35, 38 | Usart1RxVect = 36, 39 | Usart1UdreVect = 37, 40 | Usart1TxVect = 38, 41 | TwiVect = 39, 42 | SpmReadyVect = 40, 43 | Timer4CaptVect = 41, 44 | Timer4CompAVect = 42, 45 | Timer4CompBVect = 43, 46 | Timer4CompCVect = 44, 47 | Timer4OvfVect = 45, 48 | Timer5CaptVect = 46, 49 | Timer5CompAVect = 47, 50 | Timer5CompBVect = 48, 51 | Timer5CompCVect = 49, 52 | Timer5OvfVect = 50, 53 | Trx24PllLockVect = 57, 54 | Trx24PllUnlockVect = 58, 55 | Trx24RxStartVect = 59, 56 | Trx24RxEndVect = 60, 57 | Trx24CcaEdDoneVect = 61, 58 | Trx24XahAmiVect = 62, 59 | Trx24TxEndVect = 63, 60 | Trx24AwakeVect = 64, 61 | ScntCmp1Vect = 65, 62 | ScntCmp2Vect = 66, 63 | ScntCmp3Vect = 67, 64 | ScntOvflVect = 68, 65 | ScntBackoffVect = 69, 66 | AesReadyVect = 70, 67 | BatLowVect = 71, 68 | Trx24TxStartVect = 72, 69 | Trx24Ami0Vect = 73, 70 | Trx24Ami1Vect = 74, 71 | Trx24Ami2Vect = 75, 72 | Trx24Ami3Vect = 76, 73 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega2564rfr2.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | PCInt1Vect = 10, 13 | PCInt2Vect = 11, 14 | WdtVect = 12, 15 | Timer2CompAVect = 13, 16 | Timer2CompBVect = 14, 17 | Timer2OvfVect = 15, 18 | Timer1CaptVect = 16, 19 | Timer1CompAVect = 17, 20 | Timer1CompBVect = 18, 21 | Timer1CompCVect = 19, 22 | Timer1OvfVect = 20, 23 | Timer0CompAVect = 21, 24 | Timer0CompBVect = 22, 25 | Timer0OvfVect = 23, 26 | SpiStcVect = 24, 27 | Usart0RxVect = 25, 28 | Usart0UdreVect = 26, 29 | Usart0TxVect = 27, 30 | AnalogCompVect = 28, 31 | AdcVect = 29, 32 | EeReadyVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3CompCVect = 34, 37 | Timer3OvfVect = 35, 38 | Usart1RxVect = 36, 39 | Usart1UdreVect = 37, 40 | Usart1TxVect = 38, 41 | TwiVect = 39, 42 | SpmReadyVect = 40, 43 | Timer4CaptVect = 41, 44 | Timer4CompAVect = 42, 45 | Timer4CompBVect = 43, 46 | Timer4CompCVect = 44, 47 | Timer4OvfVect = 45, 48 | Timer5CaptVect = 46, 49 | Timer5CompAVect = 47, 50 | Timer5CompBVect = 48, 51 | Timer5CompCVect = 49, 52 | Timer5OvfVect = 50, 53 | Trx24PllLockVect = 57, 54 | Trx24PllUnlockVect = 58, 55 | Trx24RxStartVect = 59, 56 | Trx24RxEndVect = 60, 57 | Trx24CcaEdDoneVect = 61, 58 | Trx24XahAmiVect = 62, 59 | Trx24TxEndVect = 63, 60 | Trx24AwakeVect = 64, 61 | ScntCmp1Vect = 65, 62 | ScntCmp2Vect = 66, 63 | ScntCmp3Vect = 67, 64 | ScntOvflVect = 68, 65 | ScntBackoffVect = 69, 66 | AesReadyVect = 70, 67 | BatLowVect = 71, 68 | Trx24TxStartVect = 72, 69 | Trx24Ami0Vect = 73, 70 | Trx24Ami1Vect = 74, 71 | Trx24Ami2Vect = 75, 72 | Trx24Ami3Vect = 76, 73 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega256rfr2.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | PCInt1Vect = 10, 13 | PCInt2Vect = 11, 14 | WdtVect = 12, 15 | Timer2CompAVect = 13, 16 | Timer2CompBVect = 14, 17 | Timer2OvfVect = 15, 18 | Timer1CaptVect = 16, 19 | Timer1CompAVect = 17, 20 | Timer1CompBVect = 18, 21 | Timer1CompCVect = 19, 22 | Timer1OvfVect = 20, 23 | Timer0CompAVect = 21, 24 | Timer0CompBVect = 22, 25 | Timer0OvfVect = 23, 26 | SpiStcVect = 24, 27 | Usart0RxVect = 25, 28 | Usart0UdreVect = 26, 29 | Usart0TxVect = 27, 30 | AnalogCompVect = 28, 31 | AdcVect = 29, 32 | EeReadyVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3CompCVect = 34, 37 | Timer3OvfVect = 35, 38 | Usart1RxVect = 36, 39 | Usart1UdreVect = 37, 40 | Usart1TxVect = 38, 41 | TwiVect = 39, 42 | SpmReadyVect = 40, 43 | Timer4CaptVect = 41, 44 | Timer4CompAVect = 42, 45 | Timer4CompBVect = 43, 46 | Timer4CompCVect = 44, 47 | Timer4OvfVect = 45, 48 | Timer5CaptVect = 46, 49 | Timer5CompAVect = 47, 50 | Timer5CompBVect = 48, 51 | Timer5CompCVect = 49, 52 | Timer5OvfVect = 50, 53 | Trx24PllLockVect = 57, 54 | Trx24PllUnlockVect = 58, 55 | Trx24RxStartVect = 59, 56 | Trx24RxEndVect = 60, 57 | Trx24CcaEdDoneVect = 61, 58 | Trx24XahAmiVect = 62, 59 | Trx24TxEndVect = 63, 60 | Trx24AwakeVect = 64, 61 | ScntCmp1Vect = 65, 62 | ScntCmp2Vect = 66, 63 | ScntCmp3Vect = 67, 64 | ScntOvflVect = 68, 65 | ScntBackoffVect = 69, 66 | AesReadyVect = 70, 67 | BatLowVect = 71, 68 | Trx24TxStartVect = 72, 69 | Trx24Ami0Vect = 73, 70 | Trx24Ami1Vect = 74, 71 | Trx24Ami2Vect = 75, 72 | Trx24Ami3Vect = 76, 73 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega644rfr2.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | PCInt1Vect = 10, 13 | PCInt2Vect = 11, 14 | WdtVect = 12, 15 | Timer2CompAVect = 13, 16 | Timer2CompBVect = 14, 17 | Timer2OvfVect = 15, 18 | Timer1CaptVect = 16, 19 | Timer1CompAVect = 17, 20 | Timer1CompBVect = 18, 21 | Timer1CompCVect = 19, 22 | Timer1OvfVect = 20, 23 | Timer0CompAVect = 21, 24 | Timer0CompBVect = 22, 25 | Timer0OvfVect = 23, 26 | SpiStcVect = 24, 27 | Usart0RxVect = 25, 28 | Usart0UdreVect = 26, 29 | Usart0TxVect = 27, 30 | AnalogCompVect = 28, 31 | AdcVect = 29, 32 | EeReadyVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3CompCVect = 34, 37 | Timer3OvfVect = 35, 38 | Usart1RxVect = 36, 39 | Usart1UdreVect = 37, 40 | Usart1TxVect = 38, 41 | TwiVect = 39, 42 | SpmReadyVect = 40, 43 | Timer4CaptVect = 41, 44 | Timer4CompAVect = 42, 45 | Timer4CompBVect = 43, 46 | Timer4CompCVect = 44, 47 | Timer4OvfVect = 45, 48 | Timer5CaptVect = 46, 49 | Timer5CompAVect = 47, 50 | Timer5CompBVect = 48, 51 | Timer5CompCVect = 49, 52 | Timer5OvfVect = 50, 53 | Trx24PllLockVect = 57, 54 | Trx24PllUnlockVect = 58, 55 | Trx24RxStartVect = 59, 56 | Trx24RxEndVect = 60, 57 | Trx24CcaEdDoneVect = 61, 58 | Trx24XahAmiVect = 62, 59 | Trx24TxEndVect = 63, 60 | Trx24AwakeVect = 64, 61 | ScntCmp1Vect = 65, 62 | ScntCmp2Vect = 66, 63 | ScntCmp3Vect = 67, 64 | ScntOvflVect = 68, 65 | ScntBackoffVect = 69, 66 | AesReadyVect = 70, 67 | BatLowVect = 71, 68 | Trx24TxStartVect = 72, 69 | Trx24Ami0Vect = 73, 70 | Trx24Ami1Vect = 74, 71 | Trx24Ami2Vect = 75, 72 | Trx24Ami3Vect = 76, 73 | -------------------------------------------------------------------------------- /src/avr_io/interrupt/private/atmega128rfa1.nim: -------------------------------------------------------------------------------- 1 | type 2 | VectorInterrupt* = enum 3 | Int0Vect = 1, 4 | Int1Vect = 2, 5 | Int2Vect = 3, 6 | Int3Vect = 4, 7 | Int4Vect = 5, 8 | Int5Vect = 6, 9 | Int6Vect = 7, 10 | Int7Vect = 8, 11 | PCInt0Vect = 9, 12 | PCInt1Vect = 10, 13 | PCInt2Vect = 11, 14 | WdtVect = 12, 15 | Timer2CompAVect = 13, 16 | Timer2CompBVect = 14, 17 | Timer2OvfVect = 15, 18 | Timer1CaptVect = 16, 19 | Timer1CompAVect = 17, 20 | Timer1CompBVect = 18, 21 | Timer1CompCVect = 19, 22 | Timer1OvfVect = 20, 23 | Timer0CompAVect = 21, 24 | Timer0CompBVect = 22, 25 | Timer0OvfVect = 23, 26 | SpiStcVect = 24, 27 | Usart0RxVect = 25, 28 | Usart0UdreVect = 26, 29 | Usart0TxVect = 27, 30 | AnalogCompVect = 28, 31 | AdcVect = 29, 32 | EeReadyVect = 30, 33 | Timer3CaptVect = 31, 34 | Timer3CompAVect = 32, 35 | Timer3CompBVect = 33, 36 | Timer3CompCVect = 34, 37 | Timer3OvfVect = 35, 38 | Usart1RxVect = 36, 39 | Usart1UdreVect = 37, 40 | Usart1TxVect = 38, 41 | TwiVect = 39, 42 | SpmReadyVect = 40, 43 | Timer4CaptVect = 41, 44 | Timer4CompAVect = 42, 45 | Timer4CompBVect = 43, 46 | Timer4CompCVect = 44, 47 | Timer4OvfVect = 45, 48 | Timer5CaptVect = 46, 49 | Timer5CompAVect = 47, 50 | Timer5CompBVect = 48, 51 | Timer5CompCVect = 49, 52 | Timer5OvfVect = 50, 53 | Usart2RxVect = 51, 54 | Usart2UdreVect = 52, 55 | Usart2TxVect = 53, 56 | Usart3RxVect = 54, 57 | Usart3UdreVect = 55, 58 | Usart3TxVect = 56, 59 | Trx24PllLockVect = 57, 60 | Trx24PllUnlockVect = 58, 61 | Trx24RxStartVect = 59, 62 | Trx24RxEndVect = 60, 63 | Trx24CcaEdDoneVect = 61, 64 | Trx24XahAmiVect = 62, 65 | Trx24TxEndVect = 63, 66 | Trx24AwakeVect = 64, 67 | ScntCmp1Vect = 65, 68 | ScntCmp2Vect = 66, 69 | ScntCmp3Vect = 67, 70 | ScntOvflVect = 68, 71 | ScntBackoffVect = 69, 72 | AesReadyVect = 70, 73 | BatLowVect = 71, 74 | -------------------------------------------------------------------------------- /examples/bootloader/src/bootloader.nim: -------------------------------------------------------------------------------- 1 | ## A simple bootloader that verifies the integrity of an application before 2 | ## launching it. 3 | 4 | # We want to put this application in the boot section. 5 | {.passL: "-Wl,--section-start=.text=0xE000".} 6 | 7 | import volatile 8 | import avr_io 9 | import bitops 10 | import delay 11 | import sha1 12 | 13 | 14 | const 15 | ledPin = 0 16 | 17 | # The application stores a series of data in program memory, at a specific 18 | # offset, which in this example is known in advance. This is located at the 19 | # very end of the non-boot section. 20 | metadataBase = 0xdfe8'u16 21 | textAddrOffset = metadataBase + 0 22 | textSizeOffset = metadataBase + 2 23 | sha1HashOffset = metadataBase + 4 24 | sha1HashSize = 20'u8 25 | 26 | 27 | proc helloBlink() = 28 | # A 4 Hz blink used to signal that our bootloader started up. 29 | for _ in 0..7: 30 | portA.togglePin(ledPin) 31 | delayMs(250) 32 | portA.clearPin(ledPin) 33 | 34 | 35 | proc errorBlink() = 36 | # A 10 Hz blink used to signal that our verification has ended negatively. 37 | while true: 38 | portA.togglePin(ledPin) 39 | delayMs(100) 40 | portA.clearPin(ledPin) 41 | 42 | 43 | proc checkHash(d: array[digestByteSize, uint8]): bool = 44 | # Check that the computed hash is the same as the one included within the 45 | # program memory section. 46 | for i in 0'u16.. f = 2MHz 38 | pre = 256 39 | ocrval = ((mcuFreq div pre) div (1 / tInterrupt).uint32).uint16 40 | portB.asOutputPin(tim1Led) 41 | timer1.setTimerFlag({TimCtlB16Flag.wgm2, cs2}) 42 | timer1.setTimerFlag({Timsk16Flag.ociea}) 43 | timer1.ocra[] = ocrval 44 | 45 | 46 | proc initPwmTimer2 = 47 | ## This uses timer2 in Fast PWM mode with output on OC0B in non-inverting 48 | ## mode. The specific configuration used here allows for a PWM frequency to 49 | ## be controlled through OCRA, while its duty cycle is controller through 50 | ## OCRB. 51 | const 52 | pwmPre = 1'u32 # No prescaler in use 53 | pwmFreq = 1e6.uint32 # PWM frequency is 1MHz 54 | pwmDuty = 20'u32 # PWM duty cycle is 20% 55 | portD.asOutputPin(tim2Out) 56 | timer2.setTimerFlag({TimCtlAFlag.comb1, wgm1, wgm0}) 57 | timer2.setTimerFlag({TimCtlBFlag.wgm2, cs0}) 58 | timer2.actuatePwm(mcuFreq, pwmDuty, pwmFreq, pwmPre) 59 | 60 | 61 | proc timer1CompaIsr() {.isr(Timer1CompAVect).} = 62 | ## This proc right here implements the ISR for the Timer1 interrupt handling. 63 | portB.togglePin(tim1Led) 64 | 65 | 66 | proc loop = 67 | # Let us enable the interrupts and initialize all the timers. 68 | sei() 69 | initCompareMatchTimer0() 70 | initCtcInterruptTimer1() 71 | initPwmTimer2() 72 | while true: 73 | discard 74 | 75 | 76 | when isMainModule: 77 | loop() 78 | -------------------------------------------------------------------------------- /src/avr_io/private/attiny2313.nim: -------------------------------------------------------------------------------- 1 | include mapped_io 2 | include usart 3 | include timer 4 | 5 | const 6 | DIDR* = MappedIoRegister[uint8](0x21) 7 | UBRRH* = MappedIoRegister[uint8](0x22) 8 | UCSRC* = MappedIoRegister[uint8](0x23) 9 | ACSR* = MappedIoRegister[uint8](0x28) 10 | UBRRL* = MappedIoRegister[uint8](0x29) 11 | UCSRB* = MappedIoRegister[uint8](0x2A) 12 | UCSRA* = MappedIoRegister[uint8](0x2B) 13 | UDR* = MappedIoRegister[uint8](0x2C) 14 | USICR* = MappedIoRegister[uint8](0x2D) 15 | USISR* = MappedIoRegister[uint8](0x2E) 16 | USIDR* = MappedIoRegister[uint8](0x2F) 17 | PIND* = MappedIoRegister[uint8](0x30) 18 | DDRD* = MappedIoRegister[uint8](0x31) 19 | PORTD* = MappedIoRegister[uint8](0x32) 20 | GPIOR0* = MappedIoRegister[uint8](0x33) 21 | GPIOR1* = MappedIoRegister[uint8](0x34) 22 | GPIOR2* = MappedIoRegister[uint8](0x35) 23 | PINB* = MappedIoRegister[uint8](0x36) 24 | DDRB* = MappedIoRegister[uint8](0x37) 25 | PORTB* = MappedIoRegister[uint8](0x38) 26 | PINA* = MappedIoRegister[uint8](0x39) 27 | DDRA* = MappedIoRegister[uint8](0x3A) 28 | PORTA* = MappedIoRegister[uint8](0x3B) 29 | EECR* = MappedIoRegister[uint8](0x3C) 30 | EEDR* = MappedIoRegister[uint8](0x3D) 31 | EEAR* = MappedIoRegister[uint8](0x3E) 32 | PCMSK* = MappedIoRegister[uint8](0x40) 33 | WDTCR* = MappedIoRegister[uint8](0x41) 34 | TCCR1C* = MappedIoRegister[uint8](0x42) 35 | GTCCR* = MappedIoRegister[uint8](0x43) 36 | ICR1* = MappedIoRegister[uint16](0x44) 37 | ICR1L* = MappedIoRegister[uint8](0x44) 38 | ICR1H* = MappedIoRegister[uint8](0x45) 39 | CLKPR* = MappedIoRegister[uint8](0x46) 40 | OCR1B* = MappedIoRegister[uint16](0x48) 41 | OCR1BL* = MappedIoRegister[uint8](0x48) 42 | OCR1BH* = MappedIoRegister[uint8](0x49) 43 | OCR1A* = MappedIoRegister[uint16](0x4A) 44 | OCR1AL* = MappedIoRegister[uint8](0x4A) 45 | OCR1AH* = MappedIoRegister[uint8](0x4B) 46 | TCNT1* = MappedIoRegister[uint16](0x4C) 47 | TCNT1L* = MappedIoRegister[uint8](0x4C) 48 | TCNT1H* = MappedIoRegister[uint8](0x4D) 49 | TCCR1B* = MappedIoRegister[uint8](0x4E) 50 | TCCR1A* = MappedIoRegister[uint8](0x4F) 51 | TCCR0A* = MappedIoRegister[uint8](0x50) 52 | OSCCAL* = MappedIoRegister[uint8](0x51) 53 | TCNT0* = MappedIoRegister[uint8](0x52) 54 | TCCR0B* = MappedIoRegister[uint8](0x53) 55 | MCUSR* = MappedIoRegister[uint8](0x54) 56 | MCUCR* = MappedIoRegister[uint8](0x55) 57 | OCR0A* = MappedIoRegister[uint8](0x56) 58 | SPMCSR* = MappedIoRegister[uint8](0x57) 59 | TIFR* = MappedIoRegister[uint8](0x58) 60 | TIMSK* = MappedIoRegister[uint8](0x59) 61 | EIFR* = MappedIoRegister[uint8](0x5A) 62 | GIMSK* = MappedIoRegister[uint8](0x5B) 63 | OCR0B* = MappedIoRegister[uint8](0x5C) 64 | SPL* = MappedIoRegister[uint8](0x5D) 65 | SREG* = MappedIoRegister[uint8](0x5F) 66 | 67 | const 68 | porta* = Port(direction: DDRA, output: PORTA, input: PINA) 69 | portb* = Port(direction: DDRB, output: PORTB, input: PINB) 70 | portd* = Port(direction: DDRD, output: PORTD, input: PIND) 71 | 72 | --------------------------------------------------------------------------------