- 
                Notifications
    You must be signed in to change notification settings 
- Fork 959
Added ina228 example #705
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: develop
Are you sure you want to change the base?
Added ina228 example #705
Conversation
| And if you could squash your commits to get rid of all the unrelated churn, that'd be great 👍 EDIT: Thanks 😃 | 
f8325f3    to
    4287146      
    Compare
  
            
          
                i2c/ina228_i2c/ina228_i2c.c
              
                Outdated
          
        
      | #define FLATTEN2(a2) ((a2[0] << 8) + a2[1]) | ||
| #define FLATTEN3(a3) ((a3[0] << 16) | (a3[1] << 8) | a3[2]) | ||
| #define FLATTEN3_RESERVED(a3) ((a3[0] << 12) | (a3[1] << 4) | (a3[2] >> 4)) | ||
| #define FLATTEN5(a5) (((uint64_t) a5[0] << 32) | (a5[1] << 24) | (a5[2] << 16) | (a5[3] << 8) | a5[4]) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peterharperuk I'm not a "native C programmer" - does my suggestion of these macros make sense? Is there perhaps a better name for them? 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comment disappeared...
I'm not a big fan of the names as they don't really say what they're doing. Maybe inline functions would be better - and type safe (FLATTEN5 takes a uint64_t?). But I'm not sure it's worth more changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peterharperuk  Perhaps e.g. FLATTEN2 could be renamed to COALESCE_2_BYTES ?
@Louis31423142 If you wanted to use inline functions, I think you could do something like:
static uint16_t coalesce_2_bytes(uint8_t* bytes) {
    return (bytes[0] << 8) + bytes[1];
}(but I agree that it's probably not worth it)
4287146    to
    7c4e0e7      
    Compare
  
    7c4e0e7    to
    1e9b346      
    Compare
  
    | |=== | ||
| | *Item* | *Quantity* | Details | ||
| | Breadboard | 1 | generic part | ||
| | Raspberry Pi Pico (any) | 1 | https://www.raspberrypi.com/products/raspberry-pi-pico-2/ | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably makes sense to update this URL too. https://www.raspberrypi.com/products/raspberry-pi-pico/
Although thinking about it, I wonder if something like this works, or if it's too wordy?
| | Raspberry Pi Pico (any) | 1 | https://www.raspberrypi.com/products/raspberry-pi-pico-2/ | |
| | Raspberry Pi Pico or Pico 2 (any model) | 1 | https://www.raspberrypi.com/products/raspberry-pi-pico/ | 
WDYT @peterharperuk ?
No description provided.