Skip to content

Conversation

Louis31423142
Copy link
Collaborator

No description provided.

@lurch
Copy link
Contributor

lurch commented Sep 1, 2025

And if you could squash your commits to get rid of all the unrelated churn, that'd be great 👍

EDIT: Thanks 😃

@Louis31423142 Louis31423142 force-pushed the ina228 branch 2 times, most recently from f8325f3 to 4287146 Compare September 2, 2025 10:58
Comment on lines 17 to 20
#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])
Copy link
Contributor

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? 🤷‍♂️

Copy link
Contributor

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.

Copy link
Contributor

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)

|===
| *Item* | *Quantity* | Details
| Breadboard | 1 | generic part
| Raspberry Pi Pico (any) | 1 | https://www.raspberrypi.com/products/raspberry-pi-pico-2/
Copy link
Contributor

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?

Suggested change
| 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 ?

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

Successfully merging this pull request may close these issues.

3 participants