Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MAX30205_Human_Body_Temperature_Sensor
MAX30205 Class Reference
Digital thermometer, thermostat, temperature sensor. More...
#include <max30205_cpp.h>
Public Member Functions | |
| MAX30205 (I2C &i2c_bus, uint8_t slave_address) | |
| Constructor for MAX30205 Class. | |
| ~MAX30205 () | |
| Default destructor for MAX30205 Class. | |
| int | read_cfg_reg (uint8_t *value) |
| Read register of device at slave address. | |
| int | read_reg16 (int16_t *value, char reg) |
| Read register of device at slave address. | |
| float | read_reg_as_temperature (uint8_t reg) |
| Reads the temperature registers. | |
| int | write_cfg_reg (uint8_t cfg) |
| Writes to the configuration register. | |
| int | write_trip_low_thyst (float temperature) |
| Writes to the THYST register. | |
| int | write_trip_high_tos (float temperature) |
| Writes to the TOS register. | |
| float | celsius_to_fahrenheit (float temp_c) |
| Converts Celsius degrees to Fahrenheit. | |
Protected Member Functions | |
| int | write_reg16 (int16_t value, char reg) |
| Write a value to a register. | |
Detailed Description
Digital thermometer, thermostat, temperature sensor.
- Version:
- 1.0001.0000
The MAX30205 temperature sensors provides accurate temperature measurements of +-0.1°C over the range of 37°C to 39°C (98.6°F to 102.2°F) The MAX30205 can operate in a low powered mode by utilizing the shutdown and one-shot mode. 8-pin TQDFN 3x3 mm package Operating temperature: 0°C to 50°C (+32°F to +122°). VDD: 2.7V to 3.7V.
#include "mbed.h" #include "max32630fthr.h" #include "max30205.h" #include "max30205_cpp.h" #include "max30205_c.h" #include "USBSerial.h" Serial pc(USBTX, USBRX); // Use USB debug probe for serial link Serial uart(P2_1, P2_0); void wait_sec_prompt(uint8_t time) { // Ports and serial connections uint32_t i; for (i = 0; i < time; i++) { pc.printf("."); wait(1); } pc.printf("\r\n"); } MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); DigitalOut rLED(LED1); DigitalOut gLED(LED2); DigitalOut bLED(LED3); I2C i2cBus(P3_4, P3_5) int main() { uint8_t i2c_addr = MAX30205_I2C_SLAVE_ADR_00; float temperature; DigitalOut rLED(LED1, LED_OFF); DigitalOut gLED(LED2, LED_OFF); DigitalOut bLED(LED3, LED_OFF); gLED = LED_ON; MAX30205 temp_sensor(i2cBus, i2c_addr); i2cBus.frequency(400000); temperature = temp_sensor.read_reg_as_temperature(MAX30205_REG_TEMPERATURE); pc.printf("Temperature = %3.4f Celsius, %3.4f Fahrenheit\r\n", temperature, temp_sensor.celsius_to_fahrenheit(temperature)); }
Definition at line 95 of file max30205_cpp.h.
Constructor & Destructor Documentation
| MAX30205 | ( | I2C & | i2c_bus, |
| uint8_t | slave_address | ||
| ) |
Constructor for MAX30205 Class.
Allows user to use existing I2C object
On Entry:
- Parameters:
-
[in] i2c_bus - pointer to existing I2C object [in] i2c_adrs - 7-bit slave address of MAX30205
On Exit:
- Returns:
- None
Definition at line 44 of file max30205_cpp.cpp.
| ~MAX30205 | ( | void | ) |
Default destructor for MAX30205 Class.
Destroys I2C object if owner
On Entry:
On Exit:
- Returns:
- None
empty block
Definition at line 53 of file max30205_cpp.cpp.
Member Function Documentation
| float celsius_to_fahrenheit | ( | float | temp_c ) |
Converts Celsius degrees to Fahrenheit.
- Parameters:
-
temp_c - the temperature in Celsius degrees
- Returns:
- temperature in Celsius degrees
Definition at line 203 of file max30205_cpp.cpp.
| int read_cfg_reg | ( | uint8_t * | value ) |
Read register of device at slave address.
- Parameters:
-
[out] value - Read data on success
- Returns:
- 0 on success, negative number on failure
Definition at line 59 of file max30205_cpp.cpp.
| int read_reg16 | ( | int16_t * | value, |
| char | reg | ||
| ) |
Read register of device at slave address.
- Parameters:
-
[out] value - Read data on success reg - Register address
- Returns:
- 0 on success, negative number on failure
Definition at line 84 of file max30205_cpp.cpp.
| float read_reg_as_temperature | ( | uint8_t | reg ) |
Reads the temperature registers.
- Parameters:
-
reg - the address of the temperature register
- Returns:
- temperature in degrees Celsius
Definition at line 118 of file max30205_cpp.cpp.
| int write_cfg_reg | ( | uint8_t | cfg ) |
Writes to the configuration register.
- Parameters:
-
cfg - configurate word
- Returns:
- 0 on success, negative number on failure
Definition at line 164 of file max30205_cpp.cpp.
| int write_reg16 | ( | int16_t | value, |
| char | reg | ||
| ) | [protected] |
Write a value to a register.
- Parameters:
-
value - value to write to the register reg - register address
- Returns:
- 0 on success, negative number on failure
Definition at line 138 of file max30205_cpp.cpp.
| int write_trip_high_tos | ( | float | temperature ) |
Writes to the TOS register.
- Parameters:
-
temperature - the temperature in Celsius degrees
- Returns:
- 0 on success, negative number on failure
Definition at line 194 of file max30205_cpp.cpp.
| int write_trip_low_thyst | ( | float | temperature ) |
Writes to the THYST register.
- Parameters:
-
temperature - the temperature in Celsius degrees
- Returns:
- 0 on success, negative number on failure
Definition at line 185 of file max30205_cpp.cpp.
Generated on Thu Jul 14 2022 23:17:13 by
1.7.2