bmp280 changes
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
#include "writepin.h"
|
#include "writepin.h"
|
||||||
#include <util/delay.h>
|
#include <util/delay.h>
|
||||||
|
|
||||||
BMP280::BMP280(SpiMaster* spi, volatile uint8_t *port, const uint8_t pin): _port(port), _pin(pin), _spi(spi)
|
BMP280::BMP280(SpiMaster * const spi, volatile uint8_t * const port, const uint8_t pin): _port(port), _pin(pin), _spi(spi)
|
||||||
{
|
{
|
||||||
writePin(_port, _pin, true);
|
writePin(_port, _pin, true);
|
||||||
}
|
}
|
||||||
|
8
BMP280.h
8
BMP280.h
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "softspim.h"
|
#include "softspim.h"
|
||||||
|
|
||||||
//#define PRECOMP_COMPENSATION
|
#define PRECOMP_COMPENSATION
|
||||||
|
|
||||||
class BMP280
|
class BMP280
|
||||||
{
|
{
|
||||||
@ -51,10 +51,10 @@ private:
|
|||||||
static constexpr int32_t var3 = 52;
|
static constexpr int32_t var3 = 52;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
volatile uint8_t *_port;
|
volatile uint8_t * const _port;
|
||||||
const uint8_t _pin;
|
const uint8_t _pin;
|
||||||
|
|
||||||
SpiMaster *_spi;
|
SpiMaster * const _spi;
|
||||||
|
|
||||||
void write(const uint8_t address, const uint8_t data);
|
void write(const uint8_t address, const uint8_t data);
|
||||||
uint16_t read16b(const uint8_t address);
|
uint16_t read16b(const uint8_t address);
|
||||||
@ -63,6 +63,6 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
BMP280(SpiMaster* spi, volatile uint8_t *port, const uint8_t pin);
|
BMP280(SpiMaster * const spi, volatile uint8_t * const port, const uint8_t pin);
|
||||||
uint16_t getPressure();
|
uint16_t getPressure();
|
||||||
};
|
};
|
||||||
|
2
dht11.h
2
dht11.h
@ -8,7 +8,7 @@ class Dht11
|
|||||||
static constexpr uint16_t LOOP_TIMEOUT_COUNT = (10000.0 / 16000000.0)*F_CPU;
|
static constexpr uint16_t LOOP_TIMEOUT_COUNT = (10000.0 / 16000000.0)*F_CPU;
|
||||||
static constexpr uint8_t LOOP_TIMEOUT_SMALL_COUNT = (100.0 / 16000000.0)*F_CPU;
|
static constexpr uint8_t LOOP_TIMEOUT_SMALL_COUNT = (100.0 / 16000000.0)*F_CPU;
|
||||||
static constexpr uint8_t BIT_COUNT = 6;//(8.0 / 16000000.0)*F_CPU;
|
static constexpr uint8_t BIT_COUNT = 6;//(8.0 / 16000000.0)*F_CPU;
|
||||||
static constexpr bool DHT22 = true;
|
static constexpr bool DHT22 = false;
|
||||||
|
|
||||||
volatile unsigned char * const _port;
|
volatile unsigned char * const _port;
|
||||||
volatile unsigned char * const _port_ctl;
|
volatile unsigned char * const _port_ctl;
|
||||||
|
7
main.cpp
7
main.cpp
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
EMPTY_INTERRUPT(WDT_OVERFLOW_vect);
|
EMPTY_INTERRUPT(WDT_OVERFLOW_vect);
|
||||||
|
|
||||||
static constexpr uint8_t id = 3;
|
static constexpr uint8_t id = 4;
|
||||||
static constexpr bool WATCH_DOOR = false;
|
static constexpr bool WATCH_DOOR = false;
|
||||||
static constexpr bool BMP_280 = false;
|
static constexpr bool BMP_280 = false;
|
||||||
static constexpr bool DHT22 = true;
|
static constexpr bool DHT22 = true;
|
||||||
@ -93,8 +93,7 @@ int main()
|
|||||||
if constexpr (DHT22)
|
if constexpr (DHT22)
|
||||||
{
|
{
|
||||||
debugBlink(false);
|
debugBlink(false);
|
||||||
uint8_t readret;
|
tempSensor.read();
|
||||||
readret = tempSensor.read();
|
|
||||||
paket[0] = 1;
|
paket[0] = 1;
|
||||||
paket[2] = tempSensor.temperature >> 8;
|
paket[2] = tempSensor.temperature >> 8;
|
||||||
paket[3] = tempSensor.temperature;
|
paket[3] = tempSensor.temperature;
|
||||||
@ -117,7 +116,7 @@ int main()
|
|||||||
debugBlink(false);
|
debugBlink(false);
|
||||||
paket[0] = 128;
|
paket[0] = 128;
|
||||||
paket[2] = 0;
|
paket[2] = 0;
|
||||||
paket[3] = 1;
|
paket[3] = id;
|
||||||
transmiter.sendPacket(paketUint);
|
transmiter.sendPacket(paketUint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user