modm API documentation
|
modm (pronounced like dial-up "modem") is a toolbox for building custom C++23 libraries tailored to your embedded device. modm generates startup code, HALs and their implementations, communication protocols, drivers for external devices, and BSPs in a modular, customizable process that you can fine-tune to your needs.
This project also has a forum for discussions and a technical blog to document larger design concepts.
modm is optimized for the harsh requirements of the Eurobot competition, where our robots need to run reliably and completely autonomously for the game's 100 second duration. Our robots contain a lot of different microcontrollers, some without a lot of resources, so modm needs to fulfill a diverse set of objectives, like small code size with small memory consumption, predictable program flow, extreme portability.
The library source code is licensed as MPLv2 with any external source code under compatible licenses (BSD, Apache2, MIT). So feel free to fork this project and adapt it to your needs. The only thing we ask of you is to contribute your changes back so everyone can benefit.
Please clone modm recursively, you need all the submodules:
modm can create a HAL for 3839devices of these vendors:
Here is a table with all device families and the peripheral drivers they support:
Note that this is a summary overview and your specific device may not have all the peripherals in this table. Please discover modm's peripheral drivers for your specific device.
STM32 | SAM | RP | AT | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Peripheral | C0 | F0 | F1 | F2 | F3 | F4 | F7 | G0 | G4 | H7 | L0 | L1 | L4 | L5 | U5 | D1x D2x DAx | D5x E5x | E7x S7x V7x | G5x | 20 | 90 | Mega | Tiny |
ADC | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ | ✅ | ✅ | ✅ | ○ | ○ | ○ | ✅ | ✅ | ✅ | ○ | ✅ | ✅ |
CAN | ✕ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✕ | ✕ | ✅ | ✅ | ✅ | ✕ | ○ | ✅ | ✕ | ✕ | ○ | ○ | ✕ |
Comparator | ✕ | ○ | ✕ | ✕ | ✅ | ✕ | ✕ | ✅ | ✅ | ○ | ○ | ○ | ✅ | ○ | ○ | ○ | ○ | ○ | ✕ | ✕ | ○ | ○ | ○ |
DAC | ✕ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ | ○ | ✅ | ✕ | ✕ | ✕ | ○ | ✕ |
DMA | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ | ○ | ○ | ✅ | ✕ | ✅ | ✕ | ✕ | ✕ |
Ethernet | ✕ | ✕ | ○ | ○ | ✕ | ✅ | ✅ | ✕ | ✕ | ○ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ | ○ | ○ | ✕ | ✕ | ✕ | ✕ | ✕ |
External Interrupt | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ | ○ | ○ | ✅ | ✅ | ✅ | ✅ |
External Memory | ✕ | ✕ | ✅ | ✅ | ✕ | ✅ | ○ | ✕ | ○ | ○ | ✕ | ✕ | ○ | ○ | ○ | ✕ | ✕ | ○ | ✕ | ✕ | ✕ | ✕ | ✕ |
GPIO | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
I2C | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ | ○ | ✅ | ○ | ✅ | ✅ | ✅ | ✅ |
Internal Flash | ○ | ○ | ✅ | ○ | ○ | ✅ | ○ | ✅ | ✅ | ○ | ○ | ○ | ○ | ○ | ○ | ○ | ○ | ○ | ○ | ✕ | ✕ | ✕ | ✕ |
IWDG | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ |
Random Generator | ✕ | ✕ | ✕ | ✅ | ✕ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✕ | ✅ | ✅ | ✅ | ✕ | ○ | ○ | ✕ | ✕ | ✕ | ✕ | ✕ |
SPI | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ | ○ | ○ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
System Clock | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✕ | ✕ | ✕ |
Timer | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ | ○ | ✅ | ✅ | ○ | ○ | ○ | ○ |
UART | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ |
Unique ID | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ |
USB | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✕ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ | ✅ | ✅ | ✕ | ✕ | ✕ |
We are only a small team of developers and are limited in the amount of devices we can support and test in hardware. Open a discussion to ask if your specific device is supported out-of-the-box and how you can add it otherwise.
We have out-of-box support for many development boards including documentation.
We also have a number of completely target-independent drivers for external devices connected via I2C, SPI, UART, BitBang, etc. Most of these also give you access to the entire device so you can easily configure them for your specific needs.
Please see our examples for a complete list of tested targets and drivers.
The easiest way for you and the best way for us to see if something is unclear or missing, is if you use the library and give us some feedback by filing a bug report or if you have a fix already opening a pull request.
See CONTRIBUTING.md for our contribution guidelines.
The modm project is maintained by Niklas Hauser (@salkinium), Raphael Lehmann (@rleh), and Christopher Durand (@chris-durand) with significant contributions from Sascha Schade (@strongly-typed), Fabian Greif (@dergraaf), Kevin Läufer (@ekiwi), Martin Rosekeit (@thundernail), Daniel Krebs (@daniel-k), Georgi Grinshpun (@georgi-g), David Hebbeker (@dhebbeker), Thorsten Lajewski (@TheTh0r), Mike Wolfram (@mikewolfram), and many more contributors.