|
Files | |
file | lego-temp.h |
RobotC New Temperature Sensor Driver. | |
Defines | |
#define | LEGOTMP_I2C_ADDR 0x98 |
#define | LEGOTMP_TEMP 0x00 |
#define | LEGOTMP_CONFIG 0x01 |
Enumerations | |
enum | tLEGOTMPAccuracy { A_MIN = 8, A_MEAN1 = 4, A_MEAN2 = 2, A_MAX = 1 } |
Functions | |
bool | LEGOTMPreadTemp (tSensors link, float &temp) |
bool | LEGOTMPreadAccuracy (tSensors link, tLEGOTMPAccuracy &accuracy) |
bool | LEGOTMPsetAccuracy (tSensors link, tLEGOTMPAccuracy accuracy) |
bool | LEGOTMPsetSingleShot (tSensors link) |
bool | LEGOTMPsetContinuous (tSensors link) |
bool | _LEGOTMPreadConfig (tSensors link, ubyte &config) |
tLEGOTMPAccuracy | _LEGOTMPconvertAccuracy (ubyte config) |
bool | _LEGOTMPsetConfig (tSensors link, ubyte &config) |
Variables | |
tByteArray | LEGOTMP_I2CRequest |
tByteArray | LEGOTMP_I2CReply |
Temperature Sensor
#define LEGOTMP_CONFIG 0x01 |
Configuration registry (see http://focus.ti.com/lit/ds/symlink/tmp275.pdf)
Definition at line 52 of file lego-temp.h.
#define LEGOTMP_I2C_ADDR 0x98 |
New LEGO Temperature Sensor I2C device address
Definition at line 50 of file lego-temp.h.
#define LEGOTMP_TEMP 0x00 |
Temperature value (return on 2 bytes, 1rst : most significant byte, 2nd byte only half used)
Definition at line 51 of file lego-temp.h.
enum tLEGOTMPAccuracy |
< Command modes definition
Definition at line 58 of file lego-temp.h.
tLEGOTMPAccuracy _LEGOTMPconvertAccuracy | ( | ubyte | config ) |
Retrieve the accuracy level from the config bytes
Note: this is an internal function and should not be called directly.
config | the contents of the register |
Definition at line 135 of file lego-temp.h.
bool _LEGOTMPreadConfig | ( | tSensors | link, |
ubyte & | config | ||
) |
Read the current configuration register
Note: this is an internal function and should not be called directly.
link | the LEGO Temp Sensor port number |
config | the contents of the register |
Definition at line 92 of file lego-temp.h.
bool _LEGOTMPsetConfig | ( | tSensors | link, |
ubyte & | config | ||
) |
Set the configuration register
Note: this is an internal function and should not be called directly.
link | the LEGO Temp Sensor port number |
config | the contents of the register |
Definition at line 116 of file lego-temp.h.
bool LEGOTMPreadAccuracy | ( | tSensors | link, |
tLEGOTMPAccuracy & | accuracy | ||
) |
Read the temperature sensor's accuracy
link | the LEGO Temp Sensor port number, |
accuracy | the accuracy value to be read |
Definition at line 257 of file lego-temp.h.
bool LEGOTMPreadTemp | ( | tSensors | link, |
float & | temp | ||
) |
Read the temperature.
link | the LEGO Temp Sensor port number |
temp | the temperature value, |
128 to have only the most significant bit (9 bits accuracy - 8 (b1) = 1 bit to keep)
64 to have only the 2 most significant bits
32 to have only the 3 most significant bits
16 to have only the 4 most significant bits
Definition at line 173 of file lego-temp.h.
bool LEGOTMPsetAccuracy | ( | tSensors | link, |
tLEGOTMPAccuracy | accuracy | ||
) |
Set the temperature sensor's accuracy
link | the LEGO Temp Sensor port number |
accuracy | the accuracy value to be set |
Definition at line 276 of file lego-temp.h.
bool LEGOTMPsetContinuous | ( | tSensors | link ) |
Configure the sensor for Continuous mode
link | the New LEGO Sensor port number |
Definition at line 353 of file lego-temp.h.
bool LEGOTMPsetSingleShot | ( | tSensors | link ) |
Configure the sensor for Single Shot mode
link | the New LEGO Sensor port number |
Definition at line 324 of file lego-temp.h.
Array to hold I2C reply data
Definition at line 79 of file lego-temp.h.
Array to hold I2C command data
Definition at line 78 of file lego-temp.h.