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

Why the move to "fully const layouts"? #88

Open
riskable opened this issue May 11, 2022 · 1 comment
Open

Why the move to "fully const layouts"? #88

riskable opened this issue May 11, 2022 · 1 comment

Comments

@riskable
Copy link
Contributor

This change has been a nightmare for me so I'm curious what benefit it provides? My code used to be able to take simple arguments like:

pub fn event_scanner(
    config: &mut Config,
    layout: &mut Layout<CustomActions>,
    states: &mut PeripheralStates,
    now: Instant<u64, 1, 1000000>,
) { do_stuff_here() }

Now I have to change all my functions that deal with layout to be like this:

pub fn event_scanner<const C: usize, const R: usize, const L: usize>(
    config: &mut Config,
    layout: &mut Layout<C, R, L, CustomActions>,
    states: &mut PeripheralStates,
    now: Instant<u64, 1, 1000000>,
) { do_stuff_here() }

Also, whenever an end user implementing my firmware for a specific board wants to call one of these functions they have to make a complicated call like this:

action.execute::<16, 3, 4>(config, layout, states, now);

...and know ahead of time (somehow) how many layers their end users will have configured (they'll know how many rows/columns since that'll be specific to their hardware). It's super unergonomic and rather inflexible.

@TeXitoi
Copy link
Owner

TeXitoi commented May 11, 2022

@Skelebot ?

For reference, the corresponding PR: #67

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