rust-embedded / svd2rust

Generate Rust register maps (`struct`s) from SVD files
Apache License 2.0
697 stars 150 forks source link

Different enumerations for different functions #744

Closed kossnikita closed 1 year ago

kossnikita commented 1 year ago

I have fields in registers whose purpose changes depending on other fields. The offset and size of the fields do not change. I can't just list all the options because duplication is not allowed in cmsis. In another case, the manufacturer in svd split the register into two "CM1_INPUT" and "CM1_OUTPUT" with the same address and different fields. Is this the only solution? What is the best way to solve such problems? Also a question. How to merge and is it worth the cfghr and cfglr registers?

image

kossnikita commented 1 year ago

At the moment I decided not to use enumerations for this field, but to implement it in the HAL. It seems CMSIS does not support such a feature. About alternative registers, see #16