Skip to content

Commit 2e00bf6

Browse files
tekka007gioblu
andauthored
Add PJON transport layer (#1278)
* Add PJON transport layer * Update PJON 13.0 * PJON transport now non-blocking, fixed polling Co-authored-by: Giovanni Blu Mitolo <[email protected]>
1 parent dc562a2 commit 2e00bf6

File tree

134 files changed

+16414
-4
lines changed

Some content is hidden

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

134 files changed

+16414
-4
lines changed

.ci/doxygen.groovy

+1-1
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/.*,.*/hal/architecture/AVR/drivers/.*,.*/drivers/TinyGSM/.*''',
9+
excludePattern: '''.*/hal/architecture/Linux/drivers/.*,.*/hal/transport/PJON/driver/.*,.*/hal/architecture/AVR/drivers/.*,.*/drivers/TinyGSM/.*''',
1010
failedTotalAll: '', healthy: '', includePattern: '', messagesPattern: '',
1111
parserConfigurations: [[parserName: 'Doxygen', pattern: config.repository_root+'doxygen.log']],
1212
unHealthy: '', unstableTotalAll: '0'

.mystools/cppcheck/config/suppressions.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
// 3rd party
55
*:hal/architecture/Linux/*
66
*:drivers/*
7+
*:hal/transport/PJON/driver/*

MyConfig.h

+53-1
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,55 @@
204204
* @{
205205
*/
206206

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

208257
/**
209258
* @defgroup RS485SettingGrpPub RS485
@@ -2226,7 +2275,7 @@
22262275
#endif
22272276

22282277
// Enable sensor network "feature" if one of the transport types was enabled
2229-
#if defined(MY_RADIO_RF24) || defined(MY_RADIO_NRF5_ESB) || defined(MY_RADIO_RFM69) || defined(MY_RADIO_RFM95) || defined(MY_RS485)
2278+
#if defined(MY_RADIO_RF24) || defined(MY_RADIO_NRF5_ESB) || defined(MY_RADIO_RFM69) || defined(MY_RADIO_RFM95) || defined(MY_RS485) || defined(MY_PJON)
22302279
#define MY_SENSOR_NETWORK
22312280
#endif
22322281

@@ -2391,6 +2440,9 @@
23912440
#define MY_RS485_DE_PIN
23922441
#define MY_RS485_DE_INVERSE
23932442
#define MY_RS485_HWSERIAL
2443+
// PJON
2444+
#define MY_PJON
2445+
#define MY_DEBUG_VERBOSE_PJON
23942446
// RF24
23952447
#define MY_RADIO_RF24
23962448
#define MY_RADIO_NRF24 //deprecated

MySensors.h

+14-2
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,13 @@ MY_DEFAULT_RX_LED_PIN in your sketch instead to enable LEDs
285285
#else
286286
#define __RS485CNT 0 //!< __RS485CNT
287287
#endif
288+
#if defined(MY_PJON)
289+
#define _PJONCNT 1 //!< _PJONCNT
290+
#else
291+
#define _PJONCNT 0 //!< _PJONCNT
292+
#endif
288293

289-
#if (__RF24CNT + __NRF5ESBCNT + __RFM69CNT + __RFM95CNT + __RS485CNT > 1)
294+
#if (__RF24CNT + __NRF5ESBCNT + __RFM69CNT + __RFM95CNT + __RS485CNT + _PJONCNT > 1)
290295
#error Only one forward link driver can be activated
291296
#endif
292297
#endif //DOXYGEN
@@ -297,7 +302,7 @@ MY_DEFAULT_RX_LED_PIN in your sketch instead to enable LEDs
297302
#endif
298303

299304
// TRANSPORT INCLUDES
300-
#if defined(MY_RADIO_RF24) || defined(MY_RADIO_NRF5_ESB) || defined(MY_RADIO_RFM69) || defined(MY_RADIO_RFM95) || defined(MY_RS485)
305+
#if defined(MY_RADIO_RF24) || defined(MY_RADIO_NRF5_ESB) || defined(MY_RADIO_RFM69) || defined(MY_RADIO_RFM95) || defined(MY_RS485) || defined (MY_PJON)
301306
#include "hal/transport/MyTransportHAL.h"
302307
#include "core/MyTransport.h"
303308

@@ -381,6 +386,13 @@ 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+
#include "hal/transport/PJON/driver/PJONSoftwareBitBang.h"
392+
#if (PJON_BROADCAST == 0)
393+
#error "You must change PJON_BROADCAST to BROADCAST_ADDRESS (255u) and PJON_NOT_ASSIGNED to other one."
394+
#endif
395+
#include "hal/transport/PJON/MyTransportPJON.cpp"
384396
#endif
385397

386398
#if (defined(MY_RF24_ENABLE_ENCRYPTION) && defined(MY_RADIO_RF24)) || (defined(MY_NRF5_ESB_ENABLE_ENCRYPTION) && defined(MY_RADIO_NRF5_ESB)) || (defined(MY_RFM69_ENABLE_ENCRYPTION) && defined(MY_RADIO_RFM69)) || (defined(MY_RFM95_ENABLE_ENCRYPTION) && defined(MY_RADIO_RFM95))

examples/AirQualitySensor/AirQualitySensor.ino

+1
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

+1
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

+1
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

+1
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

+1
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

+1
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

+1
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/GatewaySerial/GatewaySerial.ino

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
//#define MY_RADIO_NRF5_ESB
4646
//#define MY_RADIO_RFM69
4747
//#define MY_RADIO_RFM95
48+
//#define MY_PJON
49+
50+
// Set pin for PJON wired communication.
51+
//#define MY_PJON_PIN 12
4852

4953
// Set LOW transmit power level as default, if you have an amplified NRF-module and
5054
// power your radio separately with a good regulator you can turn up PA level.

examples/GatewayW5100/GatewayW5100.ino

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
//#define MY_RADIO_NRF5_ESB
5050
//#define MY_RADIO_RFM69
5151
//#define MY_RADIO_RFM95
52+
//#define MY_PJON
5253

5354
// Enable gateway ethernet module type
5455
#define MY_GATEWAY_W5100

examples/GatewayW5100MQTTClient/GatewayW5100MQTTClient.ino

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
#define MY_RADIO_RF24
6666
//#define MY_RADIO_RFM69
6767
//#define MY_RADIO_RFM95
68+
//#define MY_PJON
6869

6970
#define MY_GATEWAY_MQTT_CLIENT
7071

examples/MockMySensors/MockMySensors.ino

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
//#define MY_RADIO_NRF5_ESB
3535
//#define MY_RADIO_RFM69
3636
//#define MY_RADIO_RFM95
37+
//#define MY_PJON
3738

3839
#define MY_NODE_ID 254
3940

examples/MotionSensor/MotionSensor.ino

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
//#define MY_RADIO_NRF5_ESB
3636
//#define MY_RADIO_RFM69
3737
//#define MY_RADIO_RFM95
38+
//#define MY_PJON
3839

3940
#include <MySensors.h>
4041

examples/PHSensor/PHSensor.ino

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
//#define MY_RADIO_NRF5_ESB
3434
//#define MY_RADIO_RFM69
3535
//#define MY_RADIO_RFM95
36+
//#define MY_PJON
3637

3738
#include <MySensors.h>
3839

examples/PassiveNode/PassiveNode.ino

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
//#define MY_RADIO_NRF5_ESB
4141
//#define MY_RADIO_RFM69
4242
//#define MY_RADIO_RFM95
43+
//#define MY_PJON
4344

4445
#include <MySensors.h>
4546

examples/PingPongSensor/PingPongSensor.ino

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
//#define MY_RADIO_NRF5_ESB
3636
//#define MY_RADIO_RFM69
3737
//#define MY_RADIO_RFM95
38+
//#define MY_PJON
3839

3940
#include <MySensors.h>
4041
#include "MYSLog.h"

examples/RelayActuator/RelayActuator.ino

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
//#define MY_RADIO_NRF5_ESB
3636
//#define MY_RADIO_RFM69
3737
//#define MY_RADIO_RFM95
38+
//#define MY_PJON
3839

3940
// Enable repeater functionality for this node
4041
#define MY_REPEATER_FEATURE

examples/RepeaterNode/RepeaterNode.ino

+1
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
// Enabled repeater feature for this node
4142
#define MY_REPEATER_FEATURE

examples/SecretKnockSensor/SecretKnockSensor.ino

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
//#define MY_RADIO_NRF5_ESB
6060
//#define MY_RADIO_RFM69
6161
//#define MY_RADIO_RFM95
62+
//#define MY_PJON
6263

6364
#include <MySensors.h>
6465

examples/SensebenderGatewaySerial/SensebenderGatewaySerial.ino

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
//#define MY_RADIO_NRF5_ESB
4646
//#define MY_RADIO_RFM69
4747
//#define MY_RADIO_RFM95
48+
//#define MY_PJON
4849

4950
// Set LOW transmit power level as default, if you have an amplified NRF-module and
5051
// power your radio separately with a good regulator you can turn up PA level.

examples/SoilMoistSensor/SoilMoistSensor.ino

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
//#define MY_RADIO_NRF5_ESB
6969
//#define MY_RADIO_RFM69
7070
//#define MY_RADIO_RFM95
71+
//#define MY_PJON
7172

7273
#include <math.h> // Conversion equation from resistance to %
7374
#include <MySensors.h>

examples/UVSensor/UVSensor.ino

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
//#define MY_RADIO_NRF5_ESB
4545
//#define MY_RADIO_RFM69
4646
//#define MY_RADIO_RFM95
47+
//#define MY_PJON
4748

4849
#include <MySensors.h>
4950

examples/VibrationSensor/VibrationSensor.ino

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
//#define MY_RADIO_NRF5_ESB
4141
//#define MY_RADIO_RFM69
4242
//#define MY_RADIO_RFM95
43+
//#define MY_PJON
4344

4445
#include <MySensors.h>
4546
#include <Wire.h>

examples/WaterMeterPulseSensor/WaterMeterPulseSensor.ino

+1
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

0 commit comments

Comments
 (0)