diff options
author | Sylvain Miermont <smiermont@semtech.com> | 2013-09-19 15:46:06 +0200 |
---|---|---|
committer | Sylvain Miermont <smiermont@semtech.com> | 2013-10-23 14:03:05 +0200 |
commit | b922932d1c9869d82042b600db2382d8c15f63dc (patch) | |
tree | b97b83a74f5b3faadb674867f6cc004b8426a8a9 /libloragw/src/loragw_aux.c | |
parent | 68b8b7a70d9104888997174506fbbaa0abb12a4c (diff) | |
download | lora_gateway-b922932d1c9869d82042b600db2382d8c15f63dc.tar.gz lora_gateway-b922932d1c9869d82042b600db2382d8c15f63dc.tar.bz2 lora_gateway-b922932d1c9869d82042b600db2382d8c15f63dc.zip |
Beta 7 (beta6 skipped)v1.b7
- API: change memory allocation for payload, they are now part of the struct for TX/RX, no need to malloc/free
- reduced number of SPI transactions to fetch a packet (improved number a packets par second that can be downloaded from gateway)
- streamlined build process, main target is now a static library: libloragw.a
- All RX chains can use any of the two radios now
- FSK is available and working in TX and RX (variable length mode)
- Calibrated RSSI for FSK
- lgw_connect now check the CHIP_ID
- Added a license file and a changelog
- Added a function returning a version string to allow identification of the version/options once compiled
Diffstat (limited to 'libloragw/src/loragw_aux.c')
-rw-r--r-- | libloragw/src/loragw_aux.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/libloragw/src/loragw_aux.c b/libloragw/src/loragw_aux.c new file mode 100644 index 0000000..1c7e354 --- /dev/null +++ b/libloragw/src/loragw_aux.c @@ -0,0 +1,51 @@ +/* + / _____) _ | | +( (____ _____ ____ _| |_ _____ ____| |__ + \____ \| ___ | (_ _) ___ |/ ___) _ \ + _____) ) ____| | | || |_| ____( (___| | | | +(______/|_____)_|_|_| \__)_____)\____)_| |_| + ©2013 Semtech-Cycleo + +Description: + Lora gateway auxiliary functions +*/ + + +/* -------------------------------------------------------------------------- */ +/* --- DEPENDANCIES --------------------------------------------------------- */ + +#include <stdio.h> /* printf fprintf */ +#include <time.h> /* clock_nanosleep */ + +/* -------------------------------------------------------------------------- */ +/* --- PRIVATE MACROS ------------------------------------------------------- */ + +#if DEBUG_AUX == 1 + #define DEBUG_MSG(str) fprintf(stderr, str) + #define DEBUG_PRINTF(fmt, args...) fprintf(stderr,"%s:%d: "fmt, __FUNCTION__, __LINE__, args) +#else + #define DEBUG_MSG(str) + #define DEBUG_PRINTF(fmt, args...) +#endif + +/* -------------------------------------------------------------------------- */ +/* --- PUBLIC FUNCTIONS DEFINITION ------------------------------------------ */ + +/* This implementation is POSIX-pecific and require a fix to be compatible with C99 */ +void wait_ms(unsigned long a) { + struct timespec dly; + struct timespec rem; + + dly.tv_sec = a / 1000; + dly.tv_nsec = ((long)a % 1000) * 1000000; + + DEBUG_PRINTF("NOTE dly: %ld sec %ld ns\n", dly.tv_sec, dly.tv_nsec); + + if((dly.tv_sec > 0) || ((dly.tv_sec == 0) && (dly.tv_nsec > 100000))) { + clock_nanosleep(CLOCK_MONOTONIC, 0, &dly, &rem); + DEBUG_PRINTF("NOTE remain: %ld sec %ld ns\n", rem.tv_sec, rem.tv_nsec); + } + return; +} + +/* --- EOF ------------------------------------------------------------------ */ |