Library SX1272, initially created by C.Pham, University of Pau, France for Arduino. Suitable for MBED / NUCLEO / STM32
Dependents: LOW_COAST_LORA_NODE
Revision 2:a5a72d30cb18, committed 2018-02-06
- Comitter:
- cdupaty
- Date:
- Tue Feb 06 09:58:17 2018 +0000
- Parent:
- 1:5d57c6a92509
- Commit message:
- Version of C.Pham project (university of Pau, France) ; Originally for Arduino. Ported on NUCLEO L073RZ; Please read main.cpp
Changed in this revision
diff -r 5d57c6a92509 -r a5a72d30cb18 Arduino.cpp --- a/Arduino.cpp Sun Nov 05 17:02:01 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - -#include "mbed.h" - -unsigned long micros(void) -{ - return us_ticker_read(); -} - -unsigned long millis(void) -{ - return micros()/1000; -} \ No newline at end of file
diff -r 5d57c6a92509 -r a5a72d30cb18 Arduino.h --- a/Arduino.h Sun Nov 05 17:02:01 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -#ifndef Arduino_h -#define Arduino_h - -typedef uint8_t byte; -typedef bool boolean; -unsigned long millis(void); -unsigned long micros(void); - -#endif \ No newline at end of file
diff -r 5d57c6a92509 -r a5a72d30cb18 ArduinoLike.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ArduinoLike.cpp Tue Feb 06 09:58:17 2018 +0000 @@ -0,0 +1,13 @@ +// added by C.Dupaty +// for Arduino compatibility +#include "mbed.h" + +unsigned long micros(void) +{ + return us_ticker_read(); +} + +unsigned long millis(void) +{ + return micros()/1000; +} \ No newline at end of file
diff -r 5d57c6a92509 -r a5a72d30cb18 ArduinoLike.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ArduinoLike.h Tue Feb 06 09:58:17 2018 +0000 @@ -0,0 +1,11 @@ +// added by C.Dupaty +// for Arduino compatibility +#ifndef Arduino_h +#define Arduino_h + +typedef uint8_t byte; +typedef bool boolean; +unsigned long millis(void); +unsigned long micros(void); + +#endif \ No newline at end of file
diff -r 5d57c6a92509 -r a5a72d30cb18 SX1272.cpp --- a/SX1272.cpp Sun Nov 05 17:02:01 2017 +0000 +++ b/SX1272.cpp Tue Feb 06 09:58:17 2018 +0000 @@ -119,7 +119,6 @@ us_ticker_init(); srand(time(NULL)); // ajoute parC.Dupaty -// A VERIFIER !!!!!!!!!!!!!!!!!!!!!!! spi.format(8,0); // spi 8 bits mode 0 spi.frequency(2000000); // spi clock 200KHz a l origine @@ -886,7 +885,6 @@ } else { - printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> verifications \n"); state = 1; config1 = readRegister(REG_MODEM_CONFIG1); switch (mode)
diff -r 5d57c6a92509 -r a5a72d30cb18 SX1272.h --- a/SX1272.h Sun Nov 05 17:02:01 2017 +0000 +++ b/SX1272.h Tue Feb 06 09:58:17 2018 +0000 @@ -22,6 +22,12 @@ * Implementation: Covadonga Albiñana & Victor Boria */ +//Adaptation for NUCLEO STM32 by C.Dupaty. According to a program by C.Pham +// Tested on NUCLEO L073RZ with SX1272 MB2xAS Arduino shield +// please visit http://cpham.perso.univ-pau.fr/LORA/LoRaDevices.html +// for original version for ARDUINO + + #ifndef SX1272_h #define SX1272_h @@ -31,9 +37,8 @@ #include <stdlib.h> #include <stdint.h> -#include <Arduino.h> +#include <ArduinoLike.h> #include "mbed.h" -#include <SPI.h> #ifndef inttypes_h #include <inttypes.h> @@ -48,23 +53,9 @@ #define W_REQUESTED_ACK //#define W_NET_KEY //#define W_INITIALIZATION -#define SX1272_RST 3 - -#if defined ARDUINO_AVR_PRO || defined ARDUINO_AVR_NANO || defined ARDUINO_AVR_MICRO || defined ARDUINO_AVR_MINI \ -|| defined __MK20DX256__ || defined __MKL26Z64__ -#define SX1272_SS 10 -#elif defined ARDUINO_AVR_FEATHER32U4 || defined ARDUINO_SAMD_FEATHER_M0 -// on the Adafruit Feather, the RFM95W is embeded and CS pin is normally on pin 8 -#define SX1272_SS 8 -#undef SX1272_RST -#define SX1272_RST 4 -#else -#define SX1272_SS 2 -#endif #define SX1272Chip 0 #define SX1276Chip 1 -// end #define SX1272_debug_mode 0 // 0 1 2 //#define DEBUG_CAD //