Skip to content

Commit

Permalink
Remove Constants of LoRaWAN definitions from ADB922S.h
Browse files Browse the repository at this point in the history
Add ST_LORAWAN_DISCOVERY libraly to the git repository


Signed-off-by: tomoaki <tomoaki@tomy-tech.com>
  • Loading branch information
ty4tw committed Sep 3, 2018
1 parent 7d969a1 commit 79f49b1
Show file tree
Hide file tree
Showing 12 changed files with 144 additions and 70 deletions.
4 changes: 4 additions & 0 deletions ADB922S.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ extern PortList_t thePortList[];
const char* loraTxUnconfirmCmd = "lorawan tx ucnf";
const char* loraTxConfirmCmd = "lorawan tx cnf";

#define LoRa_Rx_PIN 11
#define LoRa_Tx_PIN 12
#define LoRa_WAKEUP_PIN 7

//
//
// Class ADB922S
Expand Down
67 changes: 1 addition & 66 deletions ADB922S.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,77 +27,12 @@
#ifndef ADB922S_H_
#define ADB922S_H_
#include <Application.h>
#include <LoRaWANDef.h>
#include <Payload.h>
#include <SoftwareSerial.h>
namespace tomyApplication
{

//
// LoRaWAN defines
//
#define LoRa_DEFAULT_PAYLOAD_SIZE 11

#define LoRa_INIT_WAIT_TIME 1000
#define LoRa_SERIAL_WAIT_TIME 2000
#define LoRa_RECEIVE_DELAY2 5000
#define JOIN__WAIT_TIME 30000

#define LORA_RC_SUCCESS 0
#define LORA_RC_DATA_TOO_LONG -1
#define LORA_RC_NOT_JOINED -2
#define LORA_RC_NO_FREE_CH -3
#define LORA_RC_BUSY -4
#define LORA_RC_ERROR -5
#define LoRa_Rx_PIN 11
#define LoRa_Tx_PIN 12
#define LoRa_WAKEUP_PIN 7

#define ADR_ACK_LIMIT 5
#define ADR_ACK_DELAY 2

#ifdef LORA_DEBUG
#define LoRaDebug(...) DebugPrint( __VA_ARGS__)
#define ECHOFLAG true
#else
#define LoRaDebug(...)
#define ECHOFLAG false
#endif

#ifdef TEST_ADR
#define ADRDebug(...) DebugPrint( __VA_ARGS__)
#else
#define ADRDebug(...)
#endif

#define MAX_NO_FREE_CH_CNT 5
#ifndef PORT_LIST
#define PORT_LIST PortList_t thePortList[]
#define PORT(...) {__VA_ARGS__}
#define END_OF_PORT_LIST {0, 0}

typedef enum
{
DR0, DR1, DR2, DR3, DR4, DR5
}LoRaDR;

typedef enum
{
CH0, CH1, CH2, CH3, CH4, CH5, CH6, CH7, CH8, CH9, CH10, CH11, CH12, CH13, CH14, CH15, CH16
}CHID;

typedef enum {
joined, not_joined
}JoineStatus;

typedef struct PortList
{
uint8_t port;
void (*callback)(void);
} PortList_t;
#endif

#define LORA_TYPES

class ADB922S
{
public:
Expand Down
2 changes: 1 addition & 1 deletion AppDefine.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
/*
* Version
*/
#define KGS_VERSION F("\n_/_/_/ KashiwaGeeks 0.10.2 _/_/_/\r\n\n")
#define KGS_VERSION F("\n_/_/_/ KashiwaGeeks 0.10.3 _/_/_/\r\n\n")

#endif /* LIBRARIES_KASHIWAGEEKS_APPDEFINE_H_ */
97 changes: 97 additions & 0 deletions LoRaWANDef.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* LoRaWANDef.h
*
* The MIT License
*
* Copyright (c) 2017-2018 Tomoaki Yamaguchi tomoaki@tomy-tech.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#ifndef LORAWANDEF_H_
#define LORAWANDEF_H_
namespace tomyApplication
{

//
// LoRaWAN defines
//
#define LoRa_DEFAULT_PAYLOAD_SIZE 11

#define LoRa_INIT_WAIT_TIME 1000
#define LoRa_SERIAL_WAIT_TIME 2000
#define LoRa_RECEIVE_DELAY2 5000
#define JOIN__WAIT_TIME 30000

#define LORA_RC_SUCCESS 0
#define LORA_RC_DATA_TOO_LONG -1
#define LORA_RC_NOT_JOINED -2
#define LORA_RC_NO_FREE_CH -3
#define LORA_RC_BUSY -4
#define LORA_RC_ERROR -5

#define ADR_ACK_LIMIT 5
#define ADR_ACK_DELAY 2

#ifdef LORA_DEBUG
#define LoRaDebug(...) DebugPrint( __VA_ARGS__)
#define ECHOFLAG true
#else
#define LoRaDebug(...)
#define ECHOFLAG false
#endif

#ifdef TEST_ADR
#define ADRDebug(...) DebugPrint( __VA_ARGS__)
#else
#define ADRDebug(...)
#endif

#define MAX_NO_FREE_CH_CNT 5
#ifndef PORT_LIST
#define PORT_LIST PortList_t thePortList[]
#define PORT(...) {__VA_ARGS__}
#define END_OF_PORT_LIST {0, 0}

typedef enum
{
DR0, DR1, DR2, DR3, DR4, DR5
}LoRaDR;

typedef enum
{
CH0, CH1, CH2, CH3, CH4, CH5, CH6, CH7, CH8, CH9, CH10, CH11, CH12, CH13, CH14, CH15, CH16
}CHID;

typedef enum {
joined, not_joined
}JoineStatus;

typedef struct PortList
{
uint8_t port;
void (*callback)(void);
} PortList_t;
#endif

#define LORA_TYPES

}

#endif /* LORAWANDEF_H_ */
4 changes: 4 additions & 0 deletions examples/ADR_Sample/ADR_Sample.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/****************************************************************
*
* The MIT License
*
* Copyright (c) 2017-2018 tomoaki@tomy-tech.com
*
* I M P O R T A N T N O T I C E
*
Expand Down
7 changes: 7 additions & 0 deletions examples/Basic_Sample/Basic_Sample.ino
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/****************************************************************
*
* The MIT License
*
* Copyright (c) 2017-2018 tomoaki@tomy-tech.com
*
***************************************************************/
#include <KashiwaGeeks.h>

void start(void)
Expand Down
8 changes: 7 additions & 1 deletion examples/Downlink_Sample/Downlink_Sample.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

/****************************************************************
*
* The MIT License
*
* Copyright (c) 2017-2018 tomoaki@tomy-tech.com
*
***************************************************************/
#include <KashiwaGeeks.h>

#define ECHO true
Expand Down
7 changes: 7 additions & 0 deletions examples/End-node_Sample/End-node_Sample.ino
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/****************************************************************
*
* The MIT License
*
* Copyright (c) 2017-2018 tomoaki@tomy-tech.com
*
***************************************************************/
#include <KashiwaGeeks.h>

#define ECHO true
Expand Down
7 changes: 7 additions & 0 deletions examples/GPS_Sample/GPS_Sample.ino
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/****************************************************************
*
* The MIT License
*
* Copyright (c) 2017-2018 tomoaki@tomy-tech.com
*
***************************************************************/
#include <KashiwaGeeks.h>
#include <TinyGPS++.h>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/****************************************************************
*
* The MIT License
*
* Copyright (c) 2017-2018 tomoaki@tomy-tech.com
*
***************************************************************/
#include <KashiwaGeeks.h>
#include <Wire.h>
#include "KGPS.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/I2C_Temp_Sensor_and_GPS_Sample/KGPS.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* KGPS.cpp
* KGPS.cpp The MIT license
*
* COPYRIGHT(c) 2018 tomoaki < tomoaki@tomy-tech.com >
*
Expand Down
2 changes: 1 addition & 1 deletion examples/I2C_Temp_Sensor_and_GPS_Sample/KGPS.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* KGPS.h
* KGPS.h The MIT license
*
* COPYRIGHT(c) 2018 tomoaki < tomoaki@tomy-tech.com >
*
Expand Down

0 comments on commit 79f49b1

Please sign in to comment.