aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-12-04 16:05:30 +0100
committerGitHub <[email protected]>2023-12-04 16:05:30 +0100
commit85d5f42562ca9374e3200d652616af9533346c5e (patch)
tree95c661f909ec84635cc5c5a7d5bafead2f6fd17c
parent5f7cd821b55683f7773054a92ed4efa21c8abe19 (diff)
parent18e89d741062e23446f9b04db7bcf0ecc3a0775b (diff)
Merge pull request #2250 from embassy-rs/jamesmunns-patch-1
Add implementation note for embassy-stm32's time-driver
-rw-r--r--embassy-stm32/src/time_driver.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/embassy-stm32/src/time_driver.rs b/embassy-stm32/src/time_driver.rs
index 564c9d086..e2a4cc4da 100644
--- a/embassy-stm32/src/time_driver.rs
+++ b/embassy-stm32/src/time_driver.rs
@@ -18,6 +18,17 @@ use crate::rtc::Rtc;
18use crate::timer::sealed::{Basic16bitInstance as BasicInstance, GeneralPurpose16bitInstance as Instance}; 18use crate::timer::sealed::{Basic16bitInstance as BasicInstance, GeneralPurpose16bitInstance as Instance};
19use crate::{interrupt, peripherals}; 19use crate::{interrupt, peripherals};
20 20
21// NOTE regarding ALARM_COUNT:
22//
23// As of 2023-12-04, this driver is implemented using CC1 as the halfway rollover interrupt, and any
24// additional CC capabilities to provide timer alarms to embassy-time. embassy-time requires AT LEAST
25// one alarm to be allocatable, which means timers that only have CC1, such as TIM16/TIM17, are not
26// candidates for use as an embassy-time driver provider.
27//
28// The values of ALARM_COUNT below are not the TOTAL CC registers available, but rather the number
29// available after reserving CC1 for regular time keeping. For example, TIM2 has four CC registers:
30// CC1, CC2, CC3, and CC4, so it can provide ALARM_COUNT = 3.
31
21#[cfg(not(any(time_driver_tim12, time_driver_tim15)))] 32#[cfg(not(any(time_driver_tim12, time_driver_tim15)))]
22const ALARM_COUNT: usize = 3; 33const ALARM_COUNT: usize = 3;
23 34