-
Notifications
You must be signed in to change notification settings - Fork 3
support for other chips from st25r39xxx family #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
support for other chips from st25r39xxx family #5
Conversation
See PR comment (or below), for different and probably better approaches This way has been chosen for this WIP commit - to show clearly how many places'd need to be cluttered with feature flags. 1. approach no 1: - ./ci.sh indicates, that "st25r3916" is first class impl, and all others impls need to remove defaults and provide their own impl, when incompatible/different. + Cumbersome, however requires the least changes in the current codebase - slight relocations and some feature flags. Separate code for `s25r3911b` lives in nested module. * I don't prefer this solution, but it's 1st choice in PR - to show how many changes are needed to code, for them to be compatible. Minimal (?) changes to original, and st25r3911b modified only to get the code even to complile, but unlikely to work. 2. approach no 2: - "st25r3916", "st25r3911b" and any future others, are treated equally. Needs facade in `lib.rs` to detect chip? Needs moving lib.rs code to lib_st25r3916 (or sth like it). Possibly - if desired, have mocks to allow building with empty feature set, `default = []` without "Commands" and "Regs" specific to chip Might be the best approach, however would require substantial changes to current code. 3. approach no 3: - impls live in separate crates (maybe using some sort of common `st25r39`) - reduces burden of feature-cfg-disables. Signed-off-by: Krzysztof Królczyk <[email protected]>
Signed-off-by: Krzysztof Królczyk <[email protected]>
thanks for the PR! Option 2 sounds good to me, it makes sense to treat all chips equal and force the user to choose one. Some feedback:
|
Signed-off-by: Krzysztof Królczyk <[email protected]>
while it is deterministic, it might be less readable if anyone reads Yaml/Regs file, to verify correctness with datasheet (in case no automatic conversion like svd to yaml is possible). It also seems that formatting strips 'access' field from Regs. Signed-off-by: Krzysztof Królczyk <[email protected]>
@Dirbaio thanks for the review! Sure, i'll apply the changes, cleanup the commits a bit and ping you back when it's done. It might be a couple days though, as i'll have a quick holidays. PS.
|
yes |
- remove stubs - compact Commands together, cfg's when diffrences - update ci (no chip selection is a compile error) - update st25r39-disco to use feature Signed-off-by: Krzysztof Królczyk <[email protected]>
b812d11
to
6a86ff4
Compare
There's still a lot of code duplication in Also could you not include the |
- combined the implementation back to one file, different/not supported features on the older chip are guarded by feature gates. - IRQs adjusted to handle differences between chips. - dropped unrelated changes Signed-off-by: Krzysztof Królczyk <[email protected]>
6a86ff4
to
8d1ce6f
Compare
Manually adjusted register names in generated regs file to match names other chip (thus avoiding feature gate) Merge 2 interrupts files back to one Signed-off-by: Krzysztof Królczyk <[email protected]>
Summary of the changes - so far.
Somehow GH didn't want to treat @Dirbaio not sure what's your preference, so i could make this least possible burden to review?
|
Signed-off-by: Krzysztof Królczyk <[email protected]>
This structure has been chosen for this WIP commit only - to show clearly how many places would need to be cluttered with feature flags.
I guess approach no 2 makes more sense, hopefully it wins ;)
EDIT: second commit is approach 2 from below. As expected - would require slightly more changes, and some methods to be pub, but also bring 2 benefits: stubs, to see structure at first glance, and relative ease to add new chips (st25r3916b ;))
lib.rs
, while others as modules.Separate code for
s25r3911b
lives in nested module.lib.rs
to detect chip? Needs moving lib.rs code to lib_st25r3916 (or sth like it). Possibly - if desired, have mocks to allow building with empty feature set,default = []
without "Commands" and "Regs" specific to chip Might be the best approach, however would require substantial changes to current code.st25r39
)@Dirbaio - discussion was here
https://matrix.to/#/!YoLPkieCYHGzdjUhOK:matrix.org/$jLJeWLyptxa4kbQcl-j2hKoha9DeI_Ta6m_X0t2wmhw