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.
Dependents: projet_embarque1 projet_embarque1
Revision 1:11f6ddd8fdbe, committed 2019-09-30
- Comitter:
- 3874313
- Date:
- Mon Sep 30 09:29:59 2019 +0000
- Parent:
- 0:8172b6cb4020
- Child:
- 2:fd9cadc78239
- Commit message:
- 2e
Changed in this revision
| Sigfox.cpp | Show annotated file Show diff for this revision Revisions of this file |
| Sigfox.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/Sigfox.cpp Mon Sep 30 08:27:52 2019 +0000
+++ b/Sigfox.cpp Mon Sep 30 09:29:59 2019 +0000
@@ -1,7 +1,7 @@
#include "Sigfox.h"
-Sigfox::Sigfox(Serial *at) {
- _at = at;
+Sigfox::Sigfox(PinName tx, PinName rx): Serial(tx, rx) {
+
}
/**
@@ -10,8 +10,8 @@
* @retval 1 si OK, 0 sinon
*/
bool Sigfox::ready() {
- _at->printf("AT");
- char c = _at->getc();
+ printf("AT");
+ char c = getc();
if(c == 'O')
return 1;
else
@@ -24,5 +24,5 @@
* @retval
*/
void Sigfox::send(s16 temp_air, u16 hum_air, s16 temp_sol, u16 hum_sol, u8 lum, u8 val_r, u8 val_g, u8 val_b) {
- _at->printf("AT$SF=%04x%04x%04x%04x%02x%02x%02x%02x\r", temp_air, hum_air, temp_sol, hum_sol, lum, val_r, val_g, val_b);
+ printf("AT$SF=%04x%04x%04x%04x%02x%02x%02x%02x\r", temp_air, hum_air, temp_sol, hum_sol, lum, val_r, val_g, val_b);
}
\ No newline at end of file
--- a/Sigfox.h Mon Sep 30 08:27:52 2019 +0000
+++ b/Sigfox.h Mon Sep 30 09:29:59 2019 +0000
@@ -7,11 +7,9 @@
typedef uint16_t u16;
typedef int16_t s16;
-class Sigfox{
- private:
- Serial *_at;
+class Sigfox: public Serial{
public:
- Sigfox(Serial *at);
+ Sigfox(PinName tx, PinName rx);
/**
* @brief Tester si le module sigfox est pret