Some small updates

This commit is contained in:
Ziver Koc 2016-05-18 17:06:34 +02:00
parent df6feb5597
commit 5f0800897c
5 changed files with 22 additions and 14 deletions

View file

@ -51,7 +51,7 @@ based on Christopher Laws, March, 2013 code.
void SensorBH1750::setup() {
Wire.begin();
configure(BH1750_CONTINUOUS_HIGH_RES_MODE);
configure(BH1750_ONE_TIME_HIGH_RES_MODE);
}

View file

@ -1,18 +1,20 @@
#include "SensorPhotocell.h"
#include <Arduino.h>
void SensorPhotocell::interruptHandler()
{
++pulse;
}
void SensorPhotocell::setup()
{
Interrupt::setCallback(SensorPhotocell::interruptHandler);
Interrupt::setupPinInterrupt(PC2); //PC3
}
void SensorPhotocell::read(PowerData& data)
{
data.consumption = pulse;
}
void SensorPhotocell::reset()
{
pulse = 0;
}
}

View file

@ -10,10 +10,11 @@ class SensorPhotocell : public SensorPowerConsumption
public:
virtual void setup();
virtual void read(PowerData& data);
virtual void reset();
private:
unsigned int pulse;
static unsigned int pulse;
static void interruptHandler();
};
#endif // SensorPhotocell_H