-
Notifications
You must be signed in to change notification settings - Fork 120
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
Indexing of touch-sensing analog groups is inconsistent #447
Comments
I would suggest making the data/registers/tsc_v1.yaml
- name: IOGCR
description: I/O group x counter register.
array:
- len: 6
+ len: 7
stride: 4
- byte_offset: 52
+ byte_offset: 48 Might not be the cleanest though (it wouldn't yield an error on |
Actual indices (handled in the code as ST loves to use 1-based names, we already live with this inconsistency in many places. For example "DMA channel 1" is index 0, etc. In this particular case, it seems to me all the gX_ioY, gXe, gXs bits could (should!) be turned into arrays, making them 0-based, so there's no inconsistency anymore within the PAC. |
Smart. Indeed I don't mind too much the ST/PAC inconsistency. I do mind the inconsistency within the PAC though. I think I might be able figure out on my own how to convert the |
ah, indeed this is not supported in chiptool :( you can do it for registers by using blocks, but you can't do it for bits within a fieldset. we could add it, or we could arrayify only one dimension and just rename the fields in the other to be 0-based. |
Depending on the specific STM32 device, the Touch-Sensing Controller (TSC) supports up to 8 analog groups. These groups are labeled 1 through 8, in multiple places:
IOSCR
andIOCCR
registers, with thegX_ioY
bits (where X is the group number)IOGCSR
register, with thegXe
andgXs
bits (where X is the group number).IOGxCR
register, where x is the group numberIn the reference manual and in stm32-metapac, the convention is that groups are named 1 through 6 (or 8, depending on the device). However, stm32-metapac exposes an (otherwise convenient) function
iogcr(n)
to retrieve the IOGxCR register of a given group, and this specific function uses a 0-based index. This is very inconsistent. For example, to enable then read the first analog group, one would currently need to write:Notice how we have to use the value of
1
on the first block and0
in the second.The text was updated successfully, but these errors were encountered: