2843 |
kaklik |
1 |
#include <stdint.h> |
|
|
2 |
#include <avr/io.h> |
|
|
3 |
#include <util/delay.h> |
|
|
4 |
|
|
|
5 |
// SHT11 hum/temp sensor |
|
|
6 |
#define SHT11_PORT D |
|
|
7 |
#define SHT11_SCL (1<<PD4) |
|
|
8 |
#define SHT11_SDA (1<<PD7) |
|
|
9 |
#define SHT11_LOWRES 1 // 0: 12/14bit (SHT11), 1: 8/12bit (SHT11+FOST02) |
|
|
10 |
|
|
|
11 |
#define GLUE(a, b) a##b |
|
|
12 |
#define PORT(x) GLUE(PORT, x) |
|
|
13 |
#define PIN(x) GLUE(PIN, x) |
|
|
14 |
#define DDR(x) GLUE(DDR, x) |
|
|
15 |
|
|
|
16 |
#define setBits(port,mask) do{ (port) |= (mask); }while(0) |
|
|
17 |
#define clrBits(port,mask) do{ (port) &= ~(mask); }while(0) |
|
|
18 |
#define tstBits(port,mask) ((port) & (mask)) |
|
|
19 |
|