Skip to content

Commit 29016cd

Browse files
committed
Add PJON transport layer
1 parent 7d907d1 commit 29016cd

File tree

116 files changed

+15143
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+15143
-5
lines changed

.ci/doxygen.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def call(config) {
66
Documentation/doxygen.sh"""
77
warnings canComputeNew: false, canResolveRelativePaths: false,
88
defaultEncoding: '',
9-
excludePattern: '''.*/hal/architecture/Linux/drivers/.*,.*/drivers/TinyGSM/.*''',
9+
excludePattern: '''.*/hal/architecture/Linux/drivers/.*,.*/hal/transport/PJON/driver/.*,.*/drivers/TinyGSM/.*''',
1010
failedTotalAll: '', healthy: '', includePattern: '', messagesPattern: '',
1111
parserConfigurations: [[parserName: 'Doxygen', pattern: config.repository_root+'doxygen.log']],
1212
unHealthy: '', unstableTotalAll: '0'

MyConfig.h

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,53 @@
199199
* @{
200200
*/
201201

202+
/**
203+
* @defgroup PJONSettingGrpPub PJON
204+
* @ingroup RadioSettingGrpPub
205+
* @brief These options are specific to the PJON wired transport.
206+
* @{
207+
*/
208+
209+
/**
210+
* @def MY_PJON
211+
* @brief Define this to use the PJON wired transport for sensor network communication.
212+
*/
213+
//#define MY_PJON
214+
215+
/**
216+
* @def MY_PJON_PIN
217+
* @brief Define this to change pin for PJON communication
218+
*/
219+
#ifndef MY_PJON_PIN
220+
#define MY_PJON_PIN 12
221+
#endif
222+
223+
/**
224+
* @def MY_DEBUG_VERBOSE_PJON
225+
* @brief Define this for verbose debug prints related to the %PJON driver.
226+
*/
227+
//#define MY_DEBUG_VERBOSE_PJON
228+
229+
/**
230+
* @def MY_PJON_MAX_RETRIES
231+
* @brief Define this to change max send retry in PJON communication
232+
*/
233+
#ifndef MY_PJON_MAX_RETRIES
234+
#define MY_PJON_MAX_RETRIES 5
235+
#endif
236+
237+
#ifdef MY_PJON
238+
239+
#ifndef PJON_STRATEGY_ALL
240+
#define PJON_STRATEGY_BITBANG
241+
#endif
242+
243+
#define PJON_NOT_ASSIGNED 253
244+
#define PJON_BROADCAST 255
245+
246+
#define SWBB_MAX_ATTEMPTS 50
247+
#define PJON_INCLUDE_SWBB
248+
#endif
202249

203250
/**
204251
* @defgroup RS485SettingGrpPub RS485
@@ -2104,7 +2151,7 @@
21042151
#endif
21052152

21062153
// Enable sensor network "feature" if one of the transport types was enabled
2107-
#if defined(MY_RADIO_RF24) || defined(MY_RADIO_NRF5_ESB) || defined(MY_RADIO_RFM69) || defined(MY_RADIO_RFM95) || defined(MY_RS485)
2154+
#if defined(MY_RADIO_RF24) || defined(MY_RADIO_NRF5_ESB) || defined(MY_RADIO_RFM69) || defined(MY_RADIO_RFM95) || defined(MY_RS485) || defined(MY_PJON)
21082155
#define MY_SENSOR_NETWORK
21092156
#endif
21102157

@@ -2297,6 +2344,9 @@
22972344
// RS485
22982345
#define MY_RS485
22992346
#define MY_RS485_HWSERIAL
2347+
// PJON
2348+
#define MY_PJON
2349+
#define MY_DEBUG_VERBOSE_PJON
23002350
// RF24
23012351
#define MY_RADIO_RF24
23022352
#define MY_RADIO_NRF24 //deprecated

MySensors.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,13 @@ MY_DEFAULT_RX_LED_PIN in your sketch instead to enable LEDs
284284
#else
285285
#define __RS485CNT 0 //!< __RS485CNT
286286
#endif
287+
#if defined(MY_PJON)
288+
#define _PJONCNT 1 //!< _PJONCNT
289+
#else
290+
#define _PJONCNT 0 //!< _PJONCNT
291+
#endif
287292

288-
#if (__RF24CNT + __NRF5ESBCNT + __RFM69CNT + __RFM95CNT + __RS485CNT > 1)
293+
#if (__RF24CNT + __NRF5ESBCNT + __RFM69CNT + __RFM95CNT + __RS485CNT + _PJONCNT > 1)
289294
#error Only one forward link driver can be activated
290295
#endif
291296
#endif //DOXYGEN
@@ -296,7 +301,7 @@ MY_DEFAULT_RX_LED_PIN in your sketch instead to enable LEDs
296301
#endif
297302

298303
// TRANSPORT INCLUDES
299-
#if defined(MY_RADIO_RF24) || defined(MY_RADIO_NRF5_ESB) || defined(MY_RADIO_RFM69) || defined(MY_RADIO_RFM95) || defined(MY_RS485)
304+
#if defined(MY_RADIO_RF24) || defined(MY_RADIO_NRF5_ESB) || defined(MY_RADIO_RFM69) || defined(MY_RADIO_RFM95) || defined(MY_RS485) || defined (MY_PJON)
300305
#include "hal/transport/MyTransportHAL.h"
301306
#include "core/MyTransport.h"
302307

@@ -381,6 +386,12 @@ MY_DEFAULT_RX_LED_PIN in your sketch instead to enable LEDs
381386
#elif defined(MY_RADIO_RFM95)
382387
#include "hal/transport/RFM95/driver/RFM95.cpp"
383388
#include "hal/transport/RFM95/MyTransportRFM95.cpp"
389+
#elif defined(MY_PJON)
390+
#include "hal/transport/PJON/driver/PJON.h"
391+
#if (PJON_BROADCAST == 0)
392+
#error "You must change PJON_BROADCAST to BROADCAST_ADDRESS (255u) and PJON_NOT_ASSIGNED to other one."
393+
#endif
394+
#include "hal/transport/PJON/MyTransportPJON.cpp"
384395
#endif
385396

386397
// PASSIVE MODE

examples/AirQualitySensor/AirQualitySensor.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
//#define MY_RADIO_NRF5_ESB
4343
//#define MY_RADIO_RFM69
4444
//#define MY_RADIO_RFM95
45+
//#define MY_PJON
4546

4647
#include <MySensors.h>
4748

examples/BatteryPoweredSensor/BatteryPoweredSensor.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
//#define MY_RADIO_NRF5_ESB
3737
//#define MY_RADIO_RFM69
3838
//#define MY_RADIO_RFM95
39+
//#define MY_PJON
3940

4041
#include <MySensors.h>
4142

examples/BinarySwitchSleepSensor/BinarySwitchSleepSensor.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
//#define MY_RADIO_NRF5_ESB
3939
//#define MY_RADIO_RFM69
4040
//#define MY_RADIO_RFM95
41+
//#define MY_PJON
4142

4243
#include <MySensors.h>
4344

examples/CO2Sensor/CO2Sensor.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
//#define MY_RADIO_NRF5_ESB
4747
//#define MY_RADIO_RFM69
4848
//#define MY_RADIO_RFM95
49+
//#define MY_PJON
4950

5051
#include <MySensors.h>
5152

examples/DimmableLEDActuator/DimmableLEDActuator.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
//#define MY_RADIO_NRF5_ESB
4444
//#define MY_RADIO_RFM69
4545
//#define MY_RADIO_RFM95
46+
//#define MY_PJON
4647

4748
#include <MySensors.h>
4849

examples/DimmableLight/DimmableLight.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
//#define MY_RADIO_NRF5_ESB
3838
//#define MY_RADIO_RFM69
3939
//#define MY_RADIO_RFM95
40+
//#define MY_PJON
4041

4142
#include <MySensors.h>
4243

examples/DustSensor/DustSensor.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
//#define MY_RADIO_NRF5_ESB
4747
//#define MY_RADIO_RFM69
4848
//#define MY_RADIO_RFM95
49+
//#define MY_PJON
4950

5051
#include <MySensors.h>
5152

0 commit comments

Comments
 (0)