Skip to content

Conversation

@rnd-ash
Copy link
Contributor

@rnd-ash rnd-ash commented Oct 18, 2025

Summary

The EIC Evctrl register works differently to intset/intclear. There is just one register, and the user must set the bit for each channel in it according to if the event system should be enabled or not per channel.

Before, this was done by writing to the register directly, rather than ORing it with whats already in it. This would cause the last value of the register to be overwritten, meaning, it would only ever be possible to have 1 event system channel output enabled at once.

For completion, I've also added a disable_event method, which turns off a channels Event system output.

Checklist

  • All new or modified code is well documented, especially public items
  • No new warnings or clippy suggestions have been introduced - CI will deny clippy warnings by default! You may #[allow] certain lints where reasonable, but ideally justify those with a short comment.

@sajattack
Copy link
Member

https://rust-training.ferrous-systems.com/latest/book/pac-svd2rust#the-svd2rust-generated-api-2

Any un-written Fields are left alone

My understanding was it sort of did an or by default? But I could be out of date or totally wrong.

@rnd-ash
Copy link
Contributor Author

rnd-ash commented Oct 19, 2025

The problem here is that all the EIC channels share 1 field with this register

Interestingly, on the D21/D11 version of the evctrl register, each channel has its own field, bit, there is no iterator method so it's impossible to do channel(n).set_bit, so for consistency, I have both versions write directly to the register using bit operations.

SAM5x

image

SAMD2/1 series

image

Looking at the samd21 PAC (https://atsamd-rs.github.io/atsamd/samd21g/thumbv6m-none-eabi/doc/atsamd21g/eic/evctrl/type.W.html), there is no iterator, so one would have to manually select which extinteo field in a switch statement based on ChId.

@jbeaurivage jbeaurivage merged commit 6f6ff68 into atsamd-rs:master Nov 5, 2025
109 checks passed
@github-actions github-actions bot mentioned this pull request Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants