Part 3:
I've gone throught the EFM32 tutorials
Road Test 3: the EMF32 tutorial
------------------------------------
The tutorials are integrated in Simplicity Studio. When you select a lesson, you can open the pdf with instructions, and you can generate the template project in the IDE.
The template project has indicators in the source that hint where you should place your code.
The lessons explain how to interprete the Reference Manual, how to use the registers - and how the API works.
The first lessons go into setting and clearing single bits and a range of bits within the registers. This may be common knowledge for lots of us, but it is a nice way to introduce the API's constants, masks and macros that make the code readable.
void initTimer() {
/* Enable clock for TIMER0 */
CMU->HFPERCLKEN0 |= CMU_HFPERCLKEN0_TIMER0;
/* set prescaler to slow down clock by factor 1024, multiple bits so mask needed */
TIMER0->CTRL = (TIMER0->CTRL & ~_TIMER_CTRL_PRESC_MASK) | TIMER_CTRL_PRESC_DIV1024;
}
The first lessons cover timers and GPIO,
the second set handles interrupts and energy modes.
The third lesson iterates over two of the existing application note examples, and drives you through further refinement of their energy profile.