This is an example application based on Mbed-OS LoRaWAN protocol APIs. The Mbed-OS LoRaWAN stack implementation is compliant with LoRaWAN v1.0.2 specification.
Dependencies: Lorawan_Version_0_1
Dependents: Lorawan_Version_0_1
main.cpp
- Committer:
- jacktractive
- Date:
- 2020-01-11
- Revision:
- 65:3061ea235a0c
- Parent:
- 64:85fa08519e1e
- Child:
- 66:a11c79073f1f
File content as of revision 65:3061ea235a0c:
/** * Copyright (c) 2017, Arm Limited and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "mbed.h" #include "Lora.h" #include "Fahrrad.h" #include "trace_helper.h" #include <stdio.h> #include "mbed_stats.h" float Home_Longitude; float Home_Latitude; float Home_Distance; float Home_Distance_max; bool GPS_activ,LORA_activ,AtHome; int LiveTick; bool IsLoading; AnalogIn LadeSpannung(PB_0); // 1/11 der gleichgerichteten Spannung am Dynamo struct TX_Position { uint8_t TX_Precode; uint8_t TX_Zeitstempel[sizeof(float)]; uint8_t TX_Longitude[sizeof(float)]; uint8_t TX_Latitude[sizeof(float)]; }; DigitalOut led(LED2); //Livetick Warteschlange Events static EventQueue ev_queue(10 *EVENTS_EVENT_SIZE); static void LifeTicker() { LiveTick=LiveTick+1; printf("\n\t\t---LiveTick--- [%i]\n\n", LiveTick); printf("Ladewert: %3.3f%%\n", LadeSpannung.read()*100.0f); //if(LadeSpannung.read() > 0.05f) { // if (not IsLoading) {Licht_hell();} // IsLoading = 1; // } else { // if (IsLoading) {ev_queue.call_in(3000, Licht_dunkel);} // IsLoading = 0; // } if(LORA_activ) { printf("\n\tLORA Connected\n"); } else { printf("\n\tKein LORA Signal\n"); } ev_queue.call(GPS_aktiv); // ev_queue.call_in(5000, LifeTicker); mbed_stats_cpu_t stats; mbed_stats_cpu_get(&stats); printf("Uptime: %llu ", stats.uptime / 1000); printf("Sleep time: %llu ", stats.sleep_time / 1000); printf("Deep Sleep: %llu\n", stats.deep_sleep_time / 1000); } int main(void) { printf("----- MAIN() ------"); // setup tracing setup_trace(); Lora_init(); ev_queue.call_every(5000,LifeTicker); //Starte_Fahrrad_Eventmanager(); //schonmal die Fahrrad Events Initialisieren falls wir hier auch ohne lorawan empfang was machen wollen return 0; }