Despite the ongoing discussion of how cpu/sam* should be configured
I am continuing with my effort to port RIOT to SODAQ Autonomo.

The changes are available in my add-sodaq-autonomo branch
at g...@github.com:keestux/RIOT.git

UART and I2C are working now, and so is xtimer. Next on my list is SPI.

For I2C there are a few changes in gpio that make the code simpler
and configuration easier to understand. (At least, that's what I think :-)

Coding.
While going through the code I notice that there are too many "magic"
constants. Hard coded numbers that are obvious for some, but not obvious
for others. My advise: always try to use defines and add a comment about
what constants mean. Or point to datasheet sections explaining the constants.

One example (not to blame, but to hopefully improve in the future).

cpu/samd21/cpu.c:
/* redirect all peripherals to a disabled clock generator (7) by default */
    for (int i = 0x3; i <= 0x22; i++) {
What is that 0x22? It probably is SAMR21's GCLK_PTC, the last non-reserved
Generic Clock Selection ID. BTW, the last non-reserved ID for SAMD21 is 0x24
which is GCLK_I2S_1.
This particular should probable disable all peripherals, even the reserved ones.
But the point is, the number 0x22 should explained.

--
Kees Bakker
Founder
SODAQ
M. 0031617737165
www.sodaq.com

_______________________________________________
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel

Reply via email to