Skip to content

Commit

Permalink
Examples adapted for Arduino IDE 1.6.11
Browse files Browse the repository at this point in the history
  • Loading branch information
dberenguer committed Aug 18, 2016
1 parent 69dceaa commit 61c6144
Show file tree
Hide file tree
Showing 23 changed files with 161 additions and 48 deletions.
7 changes: 7 additions & 0 deletions examples/bininps/regtable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
#include "product.h"
#include "regtable.h"

/**
* Declaration of custom functions
*/
const void updtVoltSupply(byte rId);
const void updtBinInputs(byte rId);
const void updtCounters(byte rId);

/**
* Definition of common registers
*/
Expand Down
5 changes: 5 additions & 0 deletions examples/bininps2/regtable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
#include "product.h"
#include "regtable.h"

/**
* Declaration of custom functions
*/
const void updtVoltSupply(byte rId);

/**
* Definition of common registers
*/
Expand Down
9 changes: 6 additions & 3 deletions examples/binouts/regtable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@
#include "regtable.h"

/**
* Definition of common registers
* Declaration of custom functions
*/
DEFINE_COMMON_REGISTERS()

const void setBinOutputs(byte rId, byte *states);
const void setPwmOutputs(byte rId, byte *levels);

/**
* Definition of common registers
*/
DEFINE_COMMON_REGISTERS()

/*
* Definition of custom registers
*/
Expand Down
6 changes: 6 additions & 0 deletions examples/binouts2/regtable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
#include "product.h"
#include "regtable.h"

/**
* Declaration of custom functions
*/
const void setBinOutput(byte rId, byte *state);
const void setPwmOutput(byte rId, byte *level);

/**
* Definition of common registers
*/
Expand Down
7 changes: 6 additions & 1 deletion examples/bmpsensor/regtable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
#include "product.h"
#include "regtable.h"

/**
* Declaration of custom functions
*/
const void updtVoltSupply(byte rId);
const void updtSensor(byte rId);

/**
* Definition of common registers
*/
Expand All @@ -36,7 +42,6 @@ DEFINE_COMMON_REGISTERS()
* Definition of custom registers
*/
// Voltage supply
static uint32_t voltageSupply = 3300;
static uint8_t dtVoltSupply[2];
REGISTER regVoltSupply(dtVoltSupply, sizeof(dtVoltSupply), &updtVoltSupply, NULL);
// Sensor value register
Expand Down
82 changes: 42 additions & 40 deletions examples/co2meter/co2meter.ino
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,48 @@ bool zeroCalibrate = false; // If true, start zero calibration
// Humidity and temperature sensor
HTU21D htu;


/**
* readCO2
*
* Read CO2 level
*
* @return Current CO2 level
*/
uint16_t readCO2(void)
{
uint8_t co2Buffer[25];
uint8_t co2Index = 0;
uint8_t ch;
bool start = false, stop = false;

while(!stop)
{
if(Serial.available())
{
ch = Serial.read();
switch (ch)
{
case 'Z':
start = true;
break;
case 'z':
stop = true;
break;
default:
if (start)
{
if(ch != 0x20)
co2Buffer[co2Index++] = ch;
}
break;
}
}
}

return (uint16_t) atoi((char*)co2Buffer);
}

/**
* zeroCalibration
*
Expand Down Expand Up @@ -172,43 +214,3 @@ void loop()
swap.goToSleep();
}

/**
* readCO2
*
* Read CO2 level
*
* @return Current CO2 level
*/
uint16_t readCO2(void)
{
uint8_t co2Buffer[25];
uint8_t co2Index = 0;
uint8_t ch;
bool start = false, stop = false;

while(!stop)
{
if(Serial.available())
{
ch = Serial.read();
switch (ch)
{
case 'Z':
start = true;
break;
case 'z':
stop = true;
break;
default:
if (start)
{
if(ch != 0x20)
co2Buffer[co2Index++] = ch;
}
break;
}
}
}

return (uint16_t) atoi((char*)co2Buffer);
}
8 changes: 8 additions & 0 deletions examples/co2meter/regtable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
#include "product.h"
#include "regtable.h"

/**
* Declaration of custom functions
*/
const void updtVoltSupply(byte rId);
const void updtCo2Sensor(byte rId);
const void updtHtuSensor(byte rId);
const void setCo2Calib(byte rId, byte *calib);

/**
* Definition of common registers
*/
Expand Down
7 changes: 7 additions & 0 deletions examples/current-meter/regtable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
#include "panstamp.h"
#include "regtable.h"

/**
* Declaration of custom functions
*/
const void updtVoltSupply(byte rId);
const void updtTemperature(byte rId);
const void updtCurrent(byte rId);

/**
* Definition of common registers
*/
Expand Down
6 changes: 6 additions & 0 deletions examples/dhtsensor/regtable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
#include "product.h"
#include "regtable.h"

/**
* Declaration of custom functions
*/
const void updtVoltSupply(byte rId);
const void updtSensor(byte rId);

/**
* Definition of common registers
*/
Expand Down
6 changes: 6 additions & 0 deletions examples/htusensor/regtable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
#include "product.h"
#include "regtable.h"

/**
* Declaration of custom functions
*/
const void updtVoltSupply(byte rId);
const void updtSensor(byte rId);

/**
* Definition of common registers
*/
Expand Down
5 changes: 5 additions & 0 deletions examples/idtag/regtable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
#include "panstamp.h"
#include "regtable.h"

/**
* Declaration of custom functions
*/
const void updtVoltSupply(byte rId);

/**
* Definition of common registers
*/
Expand Down
5 changes: 5 additions & 0 deletions examples/mmamotion/regtable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
#include "product.h"
#include "regtable.h"

/**
* Declaration of custom functions
*/
const void updtSensor(byte rId);

/**
* Definition of common registers
*/
Expand Down
4 changes: 4 additions & 0 deletions examples/nfc/regtable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
#include "product.h"
#include "regtable.h"

/**
* Declaration of custom functions
*/

/**
* Definition of common registers
*/
Expand Down
6 changes: 6 additions & 0 deletions examples/ntc/regtable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
#include "panstamp.h"
#include "regtable.h"

/**
* Declaration of custom functions
*/
const void updtVoltSupply(byte rId);
const void updtSensor(byte rId);

/**
* Definition of common registers
*/
Expand Down
8 changes: 7 additions & 1 deletion examples/pulsecounter/regtable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
#include "product.h"
#include "regtable.h"

/**
* Declaration of custom functions
*/
const void updtVoltSupply(byte rId);
const void updtCounter(byte rId);

/**
* Definition of common registers
*/
Expand Down Expand Up @@ -84,7 +90,7 @@ const void updtVoltSupply(byte rId)
*/
const void updtCounter(byte rId)
{
byte i, j;
byte i;

// Update register
for(i=0 ; i<4 ; i++)
Expand Down
7 changes: 7 additions & 0 deletions examples/respira/regtable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
#include "regtable.h"
#include "sensor.h"

/**
* Declaration of custom functions
*/
const void updtVoltSupply(byte rId);
const void updtHtSensor(byte rId);
const void updtAirSensor(byte rId);

/**
* Definition of common registers
*/
Expand Down
7 changes: 5 additions & 2 deletions examples/rgbdriver/regtable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@
#include "product.h"
#include "regtable.h"

/**
* Declaration of custom functions
*/
const void setRGBlevel(byte rId, byte *levels);

/**
* Definition of common registers
*/
DEFINE_COMMON_REGISTERS();

const void setRGBlevel(byte rId, byte *levels);

/*
* Definition of custom registers
*/
Expand Down
6 changes: 6 additions & 0 deletions examples/soilmoisture/regtable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
#include "product.h"
#include "regtable.h"

/**
* Declaration of custom functions
*/
const void updtVoltSupply(byte rId);
const void updtSensor(byte rId);

/**
* Definition of common registers
*/
Expand Down
6 changes: 6 additions & 0 deletions examples/temphumpress/regtable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
#include "regtable.h"
#include "sensor.h"

/**
* Declaration of custom functions
*/
const void updtVoltSupply(byte rId);
const void updtSensor(byte rId);

/**
* Definition of common registers
*/
Expand Down
5 changes: 5 additions & 0 deletions examples/temphumpress/sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,10 @@
#define tempSensorOFF(); digitalWrite(PIN_PWRTEMP, LOW);
#endif

int sensor_ReadTempHum(void);
int sensor_ReadTemp(void);
int sensor_ReadTempPress(void);
void initSensor(void);

#endif

1 change: 1 addition & 0 deletions examples/temphumpress/temphumpress.ino
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@

#include "regtable.h"
#include "swap.h"
#include "sensor.h"

/**
* Uncomment if you are reading Vcc from A7. All battery-boards do this
Expand Down
4 changes: 4 additions & 0 deletions examples/template/regtable.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
#include "product.h"
#include "regtable.h"

/**
* Declaration of custom functions
*/

/**
* Definition of common registers
*/
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=SWAP
version=1.0.7
version=1.0.8
author=panStamp
maintainer=panStamp <[email protected]>
sentence=Simple Wireless Abstract Protocol (SWAP) library for ISM radios
Expand Down

0 comments on commit 61c6144

Please sign in to comment.