Skip to content
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

case label value exceeds maximum value #3

Open
vincentfenet opened this issue Mar 20, 2024 · 5 comments
Open

case label value exceeds maximum value #3

vincentfenet opened this issue Mar 20, 2024 · 5 comments
Assignees

Comments

@vincentfenet
Copy link

In lis2dux12_mode_get, looks like the last lines of this case are useless:

     case LIS2DUX12_TRIG_PIN:
     ^~~~
src/libs/LIS2DUX12/lis2dux12_reg.c:491:5: warning: case label value exceeds maximum value for type
     case LIS2DUX12_TRIG_SW:
     ^~~~```
@avisconti avisconti self-assigned this Mar 21, 2024
@avisconti
Copy link
Contributor

@vincentfenet Yes, it's a bug, thx. I'm going to do something like this:

    case 0xe:
      val->odr = LIS2DUX12_TRIG_PIN;
      break;
    case 0xf:
      val->odr = LIS2DUX12_TRIG_SW;
      break;

or the other possibility is to get rid of the extra nibble, which in this case it is useless (it is only usefule to distinguish same odr in LP and HP mode:

  LIS2DUX12_TRIG_PIN          = 0xE, /* Single-shot high latency by INT2 */
  LIS2DUX12_TRIG_SW           = 0xF, /* Single-shot high latency by IF */

what do you think?

@vincentfenet
Copy link
Author

vincentfenet commented Mar 25, 2024

in the sourcecode:

switch (ctrl5.odr) 

with:

uint8_t odr : 4;

So I don't understand the point of LIS2DUX12_TRIG_PIN and LIS2DUX12_TRIG_SW. for me, this is dead code that need to be removed.

@avisconti
Copy link
Contributor

in the sourcecode:

switch (ctrl5.odr) 

with:

uint8_t odr : 4;

So I don't understand the point of LIS2DUX12_TRIG_PIN and LIS2DUX12_TRIG_SW. for me, this is dead code that need to be removed.

Not sure I got your point. It's not dead code, but just possible values of

uint8_t odr : 4;

And they are 0xE (1110b) and 0xF (1111b).

Can you argument a bit more?

@vincentfenet
Copy link
Author

yeah, sorry, it's not dead code.

1110 One-shot using the INT2 pin
1111 One-shot using the interface

so it looks like it's ok !

@avisconti
Copy link
Contributor

yeah, sorry, it's not dead code.

1110 One-shot using the INT2 pin 1111 One-shot using the interface

so it looks like it's ok !

OK, thx for confirming. I just need to wait a bit before putting this change on GH, but I will.

avisconti added a commit that referenced this issue Apr 11, 2024
The ctrl5.odr switch is testing two wrong values
(6 bits instead of 4 bits). Fix issue #3

Signed-off-by: Armando Visconti <armando.visconti@st.com>
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

No branches or pull requests

2 participants