Permalink
Browse files

added possibility to reduce memory footprint by turning off including…

… unused strategies
  • Loading branch information...
4ib3r committed Jan 23, 2017
1 parent 19e756f commit b5e6f34ebb39971926dabdf64def99571e05250c
Showing with 35 additions and 6 deletions.
  1. +20 −5 PJON.h
  2. +2 −1 README.md
  3. +13 −0 strategies/README.md
25 PJON.h
@@ -70,13 +70,28 @@ limitations under the License. */
#define PJON_h
#include <Arduino.h>
#include <PJONDefines.h>
#include "strategies/OverSampling/OverSampling.h"
#include "strategies/SoftwareBitBang/SoftwareBitBang.h"
#include "strategies/ThroughSerial/ThroughSerial.h"
/* Avoid ATtiny 45/85 error missing inclusion error */
#if !defined(__AVR_ATtiny45__) && !defined(__AVR_ATtiny85__)
/** Include customisations for memory optimisation */
#if defined(PJON_STRATEGY_ETHERNET)
#include "strategies/EthernetTCP/EthernetTCP.h"
#elif defined(PJON_STRATEGY_LOCALUDP)
#include "strategies/LocalUDP/LocalUDP.h"
#elif defined(PJON_STRATEGY_OVERSAMPLING)
#include "strategies/OverSampling/OverSampling.h"
#elif defined(PJON_STRATEGY_BITBANG)
#include "strategies/SoftwareBitBang/SoftwareBitBang.h"
#elif defined(PJON_STRATEGY_SERIAL)
#include "strategies/ThroughSerial/ThroughSerial.h"
#elif defined(PJON_STRATEGY_NONE)
/* None for custom strategy include */
#else
#include "strategies/OverSampling/OverSampling.h"
#include "strategies/SoftwareBitBang/SoftwareBitBang.h"
#include "strategies/ThroughSerial/ThroughSerial.h"
/* Avoid ATtiny 45/85 error missing inclusion error */
#if !defined(__AVR_ATtiny45__) && !defined(__AVR_ATtiny85__)
#include "strategies/EthernetTCP/EthernetTCP.h"
#include "strategies/LocalUDP/LocalUDP.h"
#endif
#endif
template<typename Strategy = SoftwareBitBang>
@@ -9,7 +9,8 @@ PJON™ (Padded Jittering Operative Network) is an Arduino compatible, multi-mas
####Features
- Configurable 2 level addressing (device and bus id) for scalable applications
- Multi-media support with the data link layer abstraction or [Strategy](https://github.com/gioblu/PJON/tree/master/strategies) framework
- Multi-media support with the data link layer abstraction or [Strategy](https://github.com/gioblu/PJON/tree/master/strategies) framework
- Configurable strategies inclusion (for memory optimisation)
- Configurable 1 or 2 bytes packet length (max 255 or 65535 bytes)
- Master-slave or multi-master [dynamic addressing](https://github.com/gioblu/PJON/blob/master/specification/PJON-dynamic-addressing-specification-v0.1.md)
- Configurable synchronous and/or asynchronous [acknowledgement](https://github.com/gioblu/PJON/blob/master/specification/PJON-protocol-acknowledge-specification-v0.1.md) of correct packet sending
@@ -76,3 +76,16 @@ class YourStrategyName {
Simply add your code in the functions declaration shown above and instantiate PJON using the strategy type you
have created: `PJON<YourStrategyName> bus();`.
### Memory optimisation
By default all strategies files are included.
To reduce memory footprint simply add for example `#define PJON_STRATEGY_BITBANG` before PJON include.
Supported definitions:
- `PJON_STRATEGY_ETHERNET` - EthernetTCP.h
- `PJON_STRATEGY_LOCALUDP` - LocalUDP.h
- `PJON_STRATEGY_OVERSAMPLING` - OverSampling.h
- `PJON_STRATEGY_BITBANG` - SoftwareBitBang.h
- `PJON_STRATEGY_SERIAL` - ThroughSerial.h
- `PJON_STRATEGY_NONE` - don't include any strategy file

0 comments on commit b5e6f34

Please sign in to comment.