-
Notifications
You must be signed in to change notification settings - Fork 24
Add function to send a single bit (true | false) over the Sigfox network #2
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
Conversation
Related to #1
This uses a different SPI transaction (`0x0B`), and allows to send empty frames for basic applications such as buttons, door opening systems, ... Added a simple example called _SendBoolean_ Let me know if I need to structure this differently to fit with the lib architecture :)
|
Hi Nicolas 😉 ! What do you think about it? |
|
The point of this single bit message is to send empty messages (bit switch in the protocol headers), instead of using a full byte of payload. Would it be OK to add a private method |
|
Oh, I totally missed it, sorry, I was only looking at the "boilerplate" code and missed the different "opcode". I'll write down a stub tomorrow but sing 0xB under the hood is totally feasible 😉 |
|
Could we use something like this? diff --git a/src/SigFox.cpp b/src/SigFox.cpp
index 5cf54b5..7c2d21d 100644
--- a/src/SigFox.cpp
+++ b/src/SigFox.cpp
@@ -130,7 +130,13 @@ int SIGFOXClass::send(unsigned char mess[], int len, bool rx)
if (len > 12) len = 12;
int i = 0;
+ if (rx == false && len == 1 && mess[0] < 2) {
+ //we can use send_bit command
+ return sendBit(mess[0]);
+ }
+
spi_port.transfer(0x07);
spi_port.transfer(len);
spi_port.transfer(mess, len);
spi_port.endTransaction();and make EDIT: the datasheet states is it true? Can we use it in "production"? |
|
No problem in using it, especially in a development kit. I'll try to know why there this is indication in Atmel's spec sheet Regarding your code sample, when sending a single bit, you don't need to send the message length with |
|
Manually merged with #2 |
This uses a different SPI transaction (
0x0B), and allows to send empty frames for basic applications such as buttons, door opening systems, ...Added a simple example called SendBoolean
@facchinm : Let me know if I need to structure this differently to fit with the lib architecture :)