Comments (5)
Putting naming aside though, it also seems strange to me that the API allows you to initialise the wrong timer group's interrupts.
Totally agree - if that would get cleaned up the naming should be as simple as timer0
, timer1
and wdt
from esp-hal.
Yeah the names are little confusing.
I suppose this might've been a little clearer?
let isr = TimerInterrupts {
group0_timer0: Some(handler0),
group0_timer1: Some(handler1),
..Default::default()
}
Putting naming aside though, it also seems strange to me that the API allows you to initialise the wrong timer group's interrupts.
let isr = TimerInterrupts {
group0_timer0: Some(handler0),
group0_timer1: Some(handler1),
..Default::default()
}
let timg1 = TimerGroup::new(
peripherals.TIMG1,
&clocks,
Some(isr),
);
The above code, I create a driver for timer group 1 but I initialised the isr for timer group 0.
The API should probably just look something like this.
let isr = TimerInterrupts {
timer0: Some(handler0),
timer1: Some(handler1),
}
let timg1 = TimerGroup::new(
peripherals.TIMG1,
&clocks,
Some(isr),
);
Then you can't specify the wrong group.
(Feel free to PR a name change if you like, though I'll probably do it this evening if no one else gets to it first)
from esp-hal.
Thanks for the quick reply! The thing is, that the ESP32 manual states, that there are T0 and T1 interrupts for EACH timer in each group. What does that even mean?
I agree with you that the API is probably not correct there. Your change to TimerInterrupts
is what I would have imagined. But I wouldnt want to change anything there unless the above documentation weirdness can be ignored
from esp-hal.
Ah yes I see what you're saying. If we expand n
and x
we get.
TIMG0_T0_INT_T1_INT
TIMG0_T0_INT_T0_INT
TIMG0_T1_INT_T1_INT
TIMG0_T1_INT_T0_INT
TIMG1_T0_INT_T1_INT
TIMG1_T0_INT_T0_INT
TIMG1_T1_INT_T1_INT
TIMG1_T1_INT_T0_INT
Which seems rather strange. I reckon it's a typo but I'll leave this to the espressif devs to clarify. At a glance I don't spot anything that justifies the two interrupts.
Even knowing this, T0 and T1, whatever their uses may be, they'll be handled by the same handler. So while there may be two interrupts per timer, there's only one handler per timer.
from esp-hal.
esp-idf seems to agree with me about the typo https://github.com/espressif/esp-idf/blob/0479494e7abe5aef71393fba2e184b3a78ea488f/components/soc/esp32/include/soc/timer_group_reg.h#L556
So that doc should say
- TIMGn_WDT_INT: Generated when a watchdog timer interrupt stage times out.
- TIMGn_Tx_INT: An alarm event on timer x generates this interrupt.
from esp-hal.
Related Issues (20)
- How to override the default post_init function? HOT 5
- can't declare type for esp_hal::lcd_cam::lcd::i8080::I8080 HOT 5
- UART AT character detection not working. HOT 2
- wifi example esp32 linkage error HOT 6
- H2: Enabling the IEEE802.15.4 peripheral causes the builtin JTAG peripheral to stop working HOT 1
- esp-wifi 0.6.0: cannot find type `va_list` in this scope
- SmartLedsAdapter::new does not have async impl for Rmt::new_async? HOT 5
- HIL tests sometimes experience transient failures HOT 1
- esp-storage hangs entire device on write HOT 4
- ESP-NOW / ESP-WIFI: `set_mode` is broken
- Add documentation checks back to our CI workflow (or, create a new workflow for this) HOT 2
- Crash on ESP32-S3 when configuring the clocks after a certain commit HOT 1
- Async Traits not Public HOT 5
- `Input` does not implement `RtcPin` HOT 3
- Add the `links` field to the Cargo manifest of `esp-println` and potentially other packages
- Wrong `regi2c_*` functions in `esp32h2` clocks.
- QOL: Do something about `regi2c_*` functions.
- `OneShotTimer` / `PeriodicTimer` should take the `Timer` via `PeripheralRef` pattern
- Make `OneShotTimer` / `PeriodicTimer` useable in `esp-wifi` and `esp-hal-embassy`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esp-hal.