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

Fixed Mode #83

Open
Oleg-Perevyshin opened this issue Aug 4, 2024 · 0 comments
Open

Fixed Mode #83

Oleg-Perevyshin opened this issue Aug 4, 2024 · 0 comments

Comments

@Oleg-Perevyshin
Copy link

Hello!
Very cool library, thank you!
I want to send data in Fixed mode.
To do this I need to set OPT_FMENABLE and create a function that will accept addresses and a channel.

I created a function in the library to send a structure.
But I don't know how to do it correctly.
Can you help me add functionality to the library?

bool EBYTE::SendStructFixed(const void *TheStructure, uint16_t size_, const uint8_t ADDH, const uint8_t ADDL, const uint8_t CHAN) {
  const uint8_t addh_old = GetAddressH();
  const uint8_t addl_old = GetAddressL();
  const uint8_t chan_old = GetChannel();
  SetAddressH(ADDH);
  SetAddressL(ADDL);
  SetChannel(CHAN);
  SaveParameters(TEMPORARY);
  
  _buf = _s->write((uint8_t *)TheStructure, size_);
  CompleteTask(1000);

  SetAddressH(addh_old);
  SetAddressL(addl_old);
  SetChannel(chan_old);
  SaveParameters(TEMPORARY);

  return (_buf == size_);
}
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

1 participant