Hi everyone! avr_io v0.3.0 has just been released, adding support for more AVR MCUs and for timer peripherals.
During these months I also started thinking about a simple way to initialize (and possibly handle in the future) AVR projects automatically, since there's a fair bit of files and configurations that are needed or are just nice to have when working in nim. Thus, I decided to write a simple utility in nim, called `avrman` (got the pun? ;) ), that allows for easy initialization of nim and c projects for AVR targets. It integrates with nimble for nim ones, and make or CMake for C ones. This will handle your .nimble files, config.nims, panicoverride, etc.. It will also generate flash targets for both nimble and make/CMake automatically, if a progstirng is provided. **Links** * [v0.3.0 release notes](https://github.com/Abathargh/avr_io/releases/tag/v0.3.0) * [avr_io](https://github.com/Abathargh/avr_io) * [avrman](https://github.com/Abathargh/avrman) * [Timer examples](https://github.com/Abathargh/avr_io/tree/master/examples/timer) The following is a simple example showcasing the timer facilities of this release on an arduino uno. Notice that the combination of const + templates make it so that, even if using objects, the code footprint of these library is very small inside the library. import avr_io const tim2Out = 3 # PORTD[3] - Pin 3 mcuFreq = 16e6.uint32 # The arduino clock frequency, 16MHz proc initPwmTimer2 = const pwmPre = 1'u32 # No prescaler in use pwmFreq = 1e6.uint32 # PWM frequency is 1MHz pwmDuty = 20'u32 # PWM duty cycle is 20% portD.asOutputPin(tim2Out) timer2.setTimerFlag({TimCtlAFlag.comb1, wgm1, wgm0}) timer2.setTimerFlag({TimCtlBFlag.wgm2, cs0}) timer2.actuatePwm(mcuFreq, pwmDuty, pwmFreq, pwmPre) proc loop = initPwmTimer2() while true: discard when isMainModule: loop() Run Any feedback is incredibly welcome!