You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.1 KiB
58 lines
1.1 KiB
17 years ago
|
#ifndef DS1624_H
|
||
|
#define DS1624_H
|
||
|
|
||
|
// include types & constants of Wiring core API
|
||
|
#include <WConstants.h>
|
||
|
#include <inttypes.h>
|
||
|
|
||
|
// include types & constants of Wire ic2 lib
|
||
|
#include <Wire/Wire.h>
|
||
|
|
||
|
/**
|
||
|
* Comment this out if you don't want the
|
||
|
* init function to account for the ~1S startup
|
||
|
* delay for the first temperature sample!
|
||
|
**/
|
||
|
#define DS1624_HANDLE_BOOT_DELAY
|
||
|
|
||
|
/**
|
||
|
* Address byte selection
|
||
|
* Select 0 for low and 1 for high
|
||
|
**/
|
||
|
#define DS1624_A0 0
|
||
|
#define DS1624_A1 0
|
||
|
#define DS1624_A2 0
|
||
|
|
||
|
#define DS1624_BASE_ADDR B01001000
|
||
|
#define DS1624_ADDR DS1624_BASE_ADDR | (DS1624_A0 * B00000001) | (DS1624_A1 * B00000010) | (DS1624_A2 * B00000100)
|
||
|
|
||
|
/**
|
||
|
* Registers and bit mask definition
|
||
|
**/
|
||
|
#define DS1624_CONFIG 0xAC
|
||
|
#define DS1624_CONFIG_DONE B10000000
|
||
|
#define DS1624_CONFIG_1SHOT B00000001
|
||
|
#define DS1624_CONFIG_CONT B00000000
|
||
|
|
||
|
// Select your config here!
|
||
|
#define DS1624_CONFIGS DS1624_CONFIG_CONT
|
||
|
|
||
|
#define DS1624_READ_TEMP 0xAA
|
||
|
#define DS1624_SMPL_START 0xEE
|
||
|
#define DS1624_SMPL_STOP 0x22
|
||
|
#define DS1624_ACCESS_MEM 0x17
|
||
|
|
||
|
class DS1624
|
||
|
{
|
||
|
public:
|
||
|
DS1624();
|
||
|
void Init(void);
|
||
|
uint16_t readTemp(void);
|
||
|
private:
|
||
|
|
||
|
};
|
||
|
|
||
|
extern DS1624 TEMP;
|
||
|
|
||
|
#endif
|