stageIFREMER/GEOLOC/main.c
2017-08-30 10:48:11 +04:00

51 lines
1.5 KiB
C

#include "lib/dragino.h"
#include "lib/config.h"
#include "app/frame.h"
#if TARGET == ANCHOR
#include "app/anchor/app.h"
#else
#include "app/mobile/app.h"
#endif
#include <stdio.h>
#include "lib/gps.h"
// NMEA_GGA Frame
struct NMEA_GGA NmeaGgaFrame;
int main(){
// Init dragino pins
initPins();
// Init sx1276
reset();
// Init configuration
Config config;
config.mod=MOD_FSK; // Choose modulation
config.mode=MODE_SLEEP; // Standby mode at startup
config.cFreq=868100000; // Choose carrier frequency
config.fsk.preambleSize=1; // Choose preamble size
config.fsk.crcOn=CRC_OFF; // ON/OFF CRC check
config.fsk.freqDev=5002; // Choose frequency deviation
config.fsk.preambleDetection=PREAMBLE_DETECTION_ON; // ON/OFF preamble detection
config.lnaGain=LNA_GAIN_G1; // Choose LNA GAIN
config.fsk.crcAutoClearOff=CRC_AUTOCLEAR_OFF_OFF; // ON/OFF CRC autoclean
config.fsk.bitrate=4800; // Choose bitrate
config.fsk.fixedPayloadLength=FIXED_PAYLOAD_LENGTH_OFF; // ON/OFF Fixed payload length
config.fsk.payloadLength=FRAME_SIZE; // Choose payload length
config.fsk.fifoThreshold=FRAME_SIZE-1; // Choose fifo threshold
config.paSelect=PA_SELECT_ON; // Toggle PA BOOST
config.maxPower=15; // Define max power
config.outputPower=17; // Set the output power
config.fsk.rssiSmoothing=RSSI_SAMPLE_256; // Set rssi sample
// Fetch GPS position
NmeaGgaFrame=getNMEA_GGAFrame();
// Run ANCHOR or MOBILE application according to Makefile TARGET definition
runApp(config);
return(0);
}