atsam-rs / atsam4-hal

Apache License 2.0
5 stars 3 forks source link

Add support for Real-time Timer (RTT) #19

Closed haata closed 3 years ago

haata commented 3 years ago

Should be similar to #18

Has the same functionality between atsam4s and atsam4e.

Has two different types of interrupts:

RTTINC can only use SLCK and has a 16-bit prescaler available

ALMS can be set using the 1HZ or SLCK clocks and has a 32-bit counter. When using the SLCK, the 16-bit prescaler can also be used.

The advantage of this timer is that it can handle very long durations (2^32 or about 136 years). I'm interested in using this timer because it frees up TC channels on atsam4s_a and atsam4s_b which only have 3 TC channels.

atsamd Mode 0 looks similar to RTT with the 32-bit counter: https://github.com/atsamd-rs/atsamd/blob/master/hal/src/common/rtc.rs

haata commented 3 years ago

Fixed with https://github.com/atsam4-rs/atsam4-hal/commit/811cd4d5a74dea297c306d3bb4eedc8354ee4a3c