Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Sigfox by
Diff: Sigfox.cpp
- Revision:
- 2:d07e3b39ff74
- Parent:
- 1:93450d8b2540
- Child:
- 3:279bed56f354
diff -r 93450d8b2540 -r d07e3b39ff74 Sigfox.cpp
--- a/Sigfox.cpp Tue Apr 18 15:05:57 2017 +0000
+++ b/Sigfox.cpp Wed Apr 19 20:57:38 2017 +0000
@@ -11,17 +11,38 @@
return _at->recv("OK");
}
+bool Sigfox::setPower(uint8_t power) {
+ _at->send("ATS302=%d", power);
+ return _at->recv("OK");
+}
+
bool Sigfox::setPowerMode(uint8_t power) {
_at->send("AT$P=%d", power);
return _at->recv("OK");
}
-void Sigfox::getID() {
- _at->send("AT$I=10");
- // TODO add return value
+void Sigfox::wakeup(DigitalInOut sig_rst, float time) {
+ // Wake up sigfox
+ sig_rst.output();
+ sig_rst = 0;
+ wait(time);
+ // Set high impendance the sigfox reset pin
+ sig_rst.input();
+ wait(time);
}
-void Sigfox::getPAC() {
+char *Sigfox::getID() {
+ char buff[8+2];
+ _at->send("AT$I=10");
+ _at->read(buff, 8+2);
+ memcpy(&ID[0],&buff[2],8);
+ return &ID[0];
+}
+
+char *Sigfox::getPAC() {
+ char buff[16+2];
_at->send("AT$I=11");
- // TODO add return value
+ _at->read(buff, 16+2);
+ memcpy(&PAC[0],&buff[2],16);
+ return &PAC[0];
}
\ No newline at end of file
