#include "globals.h"
Go to the source code of this file.
Defines | |
#define | DS1621_ADDR 0x9e |
The i2c device address of the ds1621. | |
#define | DS1621_FLAG_DONE 7 |
Bit in status register that indicates the end of the temperature conversion progress. | |
#define | DS1621_FLAG_1SHOT 0 |
Bit in status register. | |
#define | DS1621_CMD_START_CONVERT 0xee |
Command to start the temperature conversion. | |
#define | DS1621_CMD_STOP_CONVERT 0x22 |
Command to stop the temperature conversion when in continuous mode. | |
#define | DS1621_CMD_READ_TEMP 0xaa |
Command to read the temperature from the ds1621 device. | |
#define | DS1621_CMD_ACCESS_CONFIG 0xac |
Command to read the configuration register. | |
#define | DS1621_CMD_READ_COUNTER 0xa8 |
Command to read the temperature counter. | |
#define | DS1621_CMD_READ_SLOPE 0xa9 |
Command to read the slope counter. | |
Typedefs | |
typedef signed char | temp_t |
Typedef for temperature data. | |
typedef u16 | hires_temp_t |
Typedef for high resolution temperature data. | |
Functions | |
void | ds1621_do_conversion (void) |
Start the temperature conversion inside the DS1621 device. | |
temp_t | ds1621_gettemp (void) |
Read the temperature data and return it. | |
u08 | ds1621_getreg (u08 cmd) |
Read a one-byte register from ds1621. | |
hires_temp_t | ds1621_hires_gettemp (void) |
Read the temperature of the ds1621 with high resolution. |
The device address is currently hardcoded in the implementation file and supports only one DS1621 attached to the bus.
|
Command to read the configuration register. Returns a one-byte-value, so you can use ds1621_retreg(). |
|
Command to read the temperature counter. Returns a one-byte-value, so you can use ds1621_retreg(). |
|
Command to read the slope counter. Returns a one-byte-value, so you can use ds1621_retreg(). |
|
Command to read the temperature from the ds1621 device. After executing this command, you can read out a two-byte-value. |
|
Bit in status register. Indicates if the ds1621 is in 1shot-mode. |
|
Typedef for high resolution temperature data. The high byte (msb) is the temperature in degree celsius. The low byte (lsb) can be interpreted as a fixed point number with its point before the first digit, i.e. 0x80 is 0.5°C, 0x40 is 0.25°C or 0xb0 is 0.75°C. |
|
Typedef for temperature data. This has no special meaning or funciton, it only makes the code more readable by showing which function parameter or return value is coded as 8 bit temperature data, i.e as a fixed point number with the lsb making the 0.5°C bit. |
|
Start the temperature conversion inside the DS1621 device. This has to be done before each call to ds1621_gettemp() or ds1621_hires_gettemp(). |
|
Read a one-byte register from ds1621.
|
|
Read the temperature data and return it. You need to call ds1621_do_conversion() before you can get valid temperature data if the DS1621 is in one-shot mode. |
|
Read the temperature of the ds1621 with high resolution. You need to call ds1621_do_conversion() before you can get valid temperature data if the DS1621 is in one-shot mode. See the datasheet for an explanation how the temperature is calculated.
|