greenhousino/sensor433/src/sensor433.h

71 lines
1.2 KiB
C

/**
* Sensor Header lib.
* Definitions and testable functions.
*
**/
#ifndef __SENSOR433_H__
#define __SENSOR433_H__
#include <Arduino.h>
// DHT22 lib
// not using the current adafruit dht library, because it's too memory intensive
#include "dht22.h"
#include "config.h"
// pin with the transistor base (And LED) is connected
#define TRANSISTOR_BASE_PIN 4
// blink time for the LED
#define LED_TIME 200
// pin of the DHT22 sensor
#define DHT_PIN 1
// pin of the soil sensor
#define SOIL_PIN A1
#define RH_BUF_LEN 11
// RadioHead bitrate in bit/s
#define RH_SPEED 1000
// pins for the radio hardware
#define RH_RX_PIN 6 // not used, set to a non-existent pin
#define RH_TX_PIN 3 // Transmit Pin
#define RH_PTT_PIN 6 // not used, set to a non-existent pin
// Message Headers:
#define MSG_START 0x10
#define MSG_BAT 0x20
#define MSG_TEMPHUM 0x30
#define MSG_ERR 0x40
// for watchdog wakeup
// https://gist.github.com/dwhacks/8055287
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
// function prototypes:
void blink(uint8_t num);
uint8_t add_device_id(uint8_t value, uint8_t device_id);
#endif