kopia lustrzana https://github.com/micropython/micropython
Timer: frequency keyword is "freq", 2 mandatory modes are PERIODIC and ONESHOT.
rodzic
890cfcba6c
commit
871ea46899
|
@ -370,7 +370,9 @@ The `Timer` class provide access to the hardware timers of the SoC. It allows to
|
|||
|
||||
Constructor:
|
||||
|
||||
`timer = Timer(id, mode=Timer.PERIODIC, *, frequency, period_ns, counter_config=(prescaler, period_counts))`
|
||||
`timer = Timer(id, mode=Timer.PERIODIC, *, freq, period_ns, counter_config=(prescaler, period_counts))`
|
||||
|
||||
* mode: mandatory values: Timer.PERIODIC, Timer.ONESHOT, other: hardware-specific, subject to further standardization.
|
||||
|
||||
Since timers are used for various applications, many of which require high accuracy, having 3 ways of setting the timer frequency (freq itself, period in us or ns, and period in timer counts together with the prescaler) it's important. Having period in time units also helps readability and ease of use.
|
||||
|
||||
|
@ -389,7 +391,7 @@ Timer methods:
|
|||
- `timer.init()` re-init.
|
||||
- `timer.deinit()` disables the Timer and all it's channels.
|
||||
- `timer.counter()` gets or sets the value of the timer counter.
|
||||
- `timer.time()` gets or sets the current timer time (in ns or us, TBD). Only makes sense in PERIODIC or ONE_SHOT_MODE.
|
||||
- `timer.time()` gets or sets the current timer time (in ns or us, TBD). Only makes sense in PERIODIC or ONESHOT.
|
||||
- `timer.period()` gets or sets the timer period in ns or us.
|
||||
- `timer.counter_config()` gets or sets the `(prescaler, period_counts)` tuple.
|
||||
- `timer.frequency()` gets or sets the timer frequency/frequencies.
|
||||
|
|
Ładowanie…
Reference in New Issue