Sigfox Communication library, allowing you to use any kind of UART able Sigfox Transmitter
sigfox.h@2:975b82a3cde0, 2016-03-12 (annotated)
- Committer:
- RB62680
- Date:
- Sat Mar 12 16:00:57 2016 +0000
- Revision:
- 2:975b82a3cde0
- Parent:
- 0:996eb84c895e
Added Sigfox_n Sigfox;;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
adrien3d | 0:996eb84c895e | 1 | #ifndef SIGFOX_H |
adrien3d | 0:996eb84c895e | 2 | #define SIGFOX_H |
adrien3d | 0:996eb84c895e | 3 | |
adrien3d | 0:996eb84c895e | 4 | #include "mbed.h" |
adrien3d | 0:996eb84c895e | 5 | |
adrien3d | 0:996eb84c895e | 6 | //Define your baudrate and pins here |
RB62680 | 2:975b82a3cde0 | 7 | #define BAUDRATE 9600 |
RB62680 | 2:975b82a3cde0 | 8 | #define PIN_RX p19 |
RB62680 | 2:975b82a3cde0 | 9 | #define PIN_TX p18 |
adrien3d | 0:996eb84c895e | 10 | |
adrien3d | 0:996eb84c895e | 11 | class Sigfox_ { |
adrien3d | 0:996eb84c895e | 12 | |
adrien3d | 0:996eb84c895e | 13 | public: |
adrien3d | 0:996eb84c895e | 14 | Sigfox_(); |
adrien3d | 0:996eb84c895e | 15 | //Sigfox_(PinMode TX, PinMode RX); |
adrien3d | 0:996eb84c895e | 16 | |
adrien3d | 0:996eb84c895e | 17 | void begin(); |
adrien3d | 0:996eb84c895e | 18 | bool isReady(); |
adrien3d | 0:996eb84c895e | 19 | bool send(const void* data, uint8_t len); |
adrien3d | 0:996eb84c895e | 20 | unsigned long getID(); |
adrien3d | 0:996eb84c895e | 21 | unsigned long getPAC(); |
adrien3d | 0:996eb84c895e | 22 | bool setPowerMode(uint8_t power); |
adrien3d | 0:996eb84c895e | 23 | |
adrien3d | 0:996eb84c895e | 24 | enum RETURN_CODE { |
adrien3d | 0:996eb84c895e | 25 | OK = 'O', |
adrien3d | 0:996eb84c895e | 26 | KO = 'K', |
adrien3d | 0:996eb84c895e | 27 | SENT = 'S' |
adrien3d | 0:996eb84c895e | 28 | }; |
adrien3d | 0:996eb84c895e | 29 | |
adrien3d | 0:996eb84c895e | 30 | private: |
adrien3d | 0:996eb84c895e | 31 | //Serial device(p9, p10); |
adrien3d | 0:996eb84c895e | 32 | //Serial _serial; |
adrien3d | 0:996eb84c895e | 33 | unsigned long _lastSend; |
adrien3d | 0:996eb84c895e | 34 | |
adrien3d | 0:996eb84c895e | 35 | uint8_t _nextReturn(); |
adrien3d | 0:996eb84c895e | 36 | }; |
adrien3d | 0:996eb84c895e | 37 | |
adrien3d | 0:996eb84c895e | 38 | extern Sigfox_ Sigfox; |
adrien3d | 0:996eb84c895e | 39 | #endif |