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

backwards compatible enhancements to some embot::core data structures. #53

Merged
merged 1 commit into from
Jan 31, 2022
Merged

backwards compatible enhancements to some embot::core data structures. #53

merged 1 commit into from
Jan 31, 2022

Conversation

marcoaccame
Copy link
Contributor

This PR does two small backwards compatible changes:

  • cleans up the API of embot::core::Data which is used inside embot as a ... generic data holder, so that now it can also manage constexpr data.
    static constexpr uint8_t bytes2write[8] {1, 2, 3, 4, 5, 6, 7, 8};
    constexpr embot::core::Data data2write {bytes2write, sizeof(bytes2write)};
    ...
    // step 03: write some data to EEPROM
    if(true == chipM95512DF->write(adr, data2write))
    ...
  • adds a comment on embot::core::Callback about how to construct it w/ a lambda
    uint32_t counter {0};
    void *arg = &val;
    embot::core::Callback cbk {[](void *p){ uint32_t *v = reinterpret_cast<uint32_t*>p); *p++; }, arg};
    cbk.execute();
    // now counter has value = 1;

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.

1 participant