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.
Dependencies: BufferedSerial SX1276GenericLib USBDeviceHT mbed Crypto X_NUCLEO_IKS01A2
Fork of STM32L0_LoRa by
Revision 29:04e1489f8fe2, committed 2018-09-17
- Comitter:
- marcozecchini
- Date:
- Mon Sep 17 20:37:51 2018 +0000
- Parent:
- 28:9d7be893610d
- Child:
- 30:d43802606136
- Commit message:
- Bug fixed
Changed in this revision
--- a/HCSR04.lib Thu May 31 22:50:54 2018 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://os.mbed.com/users/antoniolinux/code/HCSR04/#86b2086be101
--- a/PinMap.h Thu May 31 22:50:54 2018 +0000 +++ b/PinMap.h Mon Sep 17 20:37:51 2018 +0000 @@ -1,23 +1,7 @@ -/* - * Copyright (c) 2018 Helmut Tschemernjak - * 30826 Garbsen (Hannover) Germany - * Licensed under the Apache License, Version 2.0); - */ - - - -#ifdef TARGET_NUCLEO_L476RG +/* Here are defined the GPIO ports and those other pins necessary to manage the lora connection. +*/ +#ifdef TARGET_DISCO_L072CZ_LRWAN1 #define FEATURE_LORA - -#elif TARGET_DISCO_L072CZ_LRWAN1 - #define FEATURE_LORA - -#elif TARGET_STM32L432KC - #define HELTEC_STM32L4 - #define FEATURE_LORA - #define FEATURE_USBSERIAL -#endif - #if defined(TARGET_DISCO_L072CZ_LRWAN1) @@ -39,64 +23,6 @@ #define LORA_ANT_BOOST PC_1 #define LORA_TCXO PA_12 // 32 MHz - - -#elif defined(TARGET_NUCLEO_L476RG) // using the RFM95 board - -#define LORA_SPI_MOSI PC_12 -#define LORA_SPI_MISO PC_11 -#define LORA_SPI_SCLK PC_10 -#define LORA_CS PA_0 -#define LORA_RESET PA_1 -#define LORA_DIO0 PD_2 // DIO0=TxDone/RXDone -#define LORA_DIO1 PB_7 // -#define LORA_DIO2 PC_14 // DIO2=FhssChangeChannel -#define LORA_DIO3 PC_15 // DIO3=CADDone -#define LORA_DIO4 PH_0 // ???? -#define LORA_DIO5 NC // unused? - -#elif defined (HELTEC_STM32L4) - -#define USER_BUTTON PH_3 // boot pin -#define LED PB_0 // red -#define LED2 PB_1 // green -#define LED1 LED - -#define POWER_VEXT PA_3 -#define POWER_VEXT_ON 0 -#define POWER_VEXT_OFF 1 - - -#define LORA_SPI_MOSI PA_7 -#define LORA_SPI_MISO PA_6 -#define LORA_SPI_SCLK PA_5 -#define LORA_CS PA_4 -#define LORA_RESET PA_1 -#define LORA_DIO0 PA_0 // DIO0=TxDone/RXDone/CADDone -#define LORA_DIO1 NC // -#define LORA_DIO2 NC // -#define LORA_DIO3 NC // -#define LORA_DIO4 NC // -#define LORA_DIO5 NC // - -#elif defined(TARGET_NUCLEO_L432KC) // using the RFM95 board - -// #define LED PB_3 // green -#define LED PB_5 // green - -#define LORA_SPI_MOSI PA_7 -#define LORA_SPI_MISO PA_6 -#define LORA_SPI_SCLK PB_5 -#define LORA_CS PA_4 -#define LORA_RESET PA_1 -#define LORA_DIO0 PA_0 // DIO0=TxDone/RXDone/CADDone -#define LORA_DIO1 NC // -#define LORA_DIO2 NC // -#define LORA_DIO3 NC // -#define LORA_DIO4 NC // -#define LORA_DIO5 NC // - - #else #error "unknown board"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hcsr04.cpp Mon Sep 17 20:37:51 2018 +0000
@@ -0,0 +1,22 @@
+#include "hcsr04.h"
+#include "mbed.h"
+/*
+*HCSR04.cpp
+*/
+HCSR04::HCSR04(PinName t, PinName e) : trig(t), echo(e) {}
+ long HCSR04::echo_duration() {
+
+ timer.reset(); //reset timer
+ trig=0; // trigger low
+ wait_us(2); // wait
+ trig=1; // trigger high
+ wait_us(10);
+ trig=0; // trigger low
+ while(!echo); // start pulseIN
+ timer.start();
+ while(echo);
+ timer.stop();
+ return timer.read_us();
+
+}
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hcsr04.h Mon Sep 17 20:37:51 2018 +0000
@@ -0,0 +1,20 @@
+#ifndef hcsr04_H
+#define hcsr04_H
+#include "mbed.h"
+
+
+
+class HCSR04 {
+ public:
+ HCSR04(PinName t, PinName e);
+ long echo_duration();
+ long distance();
+
+ private:
+ DigitalOut trig;
+ DigitalIn echo;
+ Timer timer;
+ long duration,distance_cm;
+};
+
+#endif
\ No newline at end of file
--- a/main.cpp Thu May 31 22:50:54 2018 +0000
+++ b/main.cpp Mon Sep 17 20:37:51 2018 +0000
@@ -1,10 +1,4 @@
-/*
- * Copyright (c) 2018 HELIOS Software GmbH
- * 30826 Garbsen (Hannover) Germany
- * Licensed under the Apache License, Version 2.0);
- */
- #include "main.h"
-
+#include "main.h"
DigitalOut myled(LED);
//D12 TRIGGER D11 ECHO
@@ -40,7 +34,7 @@
print_stuff();
bool empty = true;
//WAIT
- wait(7.5f);
+ wait(30.0f);
while(1){
char distance[4], empty_distance[4], temperature[4];//Message to be sent
--- a/main.h Thu May 31 22:50:54 2018 +0000 +++ b/main.h Mon Sep 17 20:37:51 2018 +0000 @@ -1,9 +1,3 @@ -/* - * Copyright (c) 2018 Helmut Tschemernjak - * 30826 Garbsen (Hannover) Germany - * Licensed under the Apache License, Version 2.0); -*/ - #include "mbed.h" #include "PinMap.h" #include "BufferedSerial.h"
--- a/smartage/smartage.cpp Thu May 31 22:50:54 2018 +0000 +++ b/smartage/smartage.cpp Mon Sep 17 20:37:51 2018 +0000 @@ -1,10 +1,3 @@ -/* - * This file contains a copy of the master content sx1276PingPong - * with adaption for the SX1276Generic environment - * (c) 2017 Helmut Tschemernjak - * 30826 Garbsen (Hannover) Germany - */ - #include "mbed.h" #include "PinMap.h" #include "smartage.h"
--- a/utils.cpp Thu May 31 22:50:54 2018 +0000 +++ b/utils.cpp Mon Sep 17 20:37:51 2018 +0000 @@ -1,8 +1,4 @@ -/* - * Copyright (c) 2018 Helmut Tschemernjak - * 30826 Garbsen (Hannover) Germany - */ - #include "main.h" +#include "main.h" time_t cvt_date(char const *date, char const *time);
