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.
Dependencies: MAX31723_Digital_Temperature_Sensor max32630fthr USBDevice
Revision 13:052296efd9e3, committed 2019-02-12
- Comitter:
- phonemacro
- Date:
- Tue Feb 12 22:57:39 2019 +0000
- Parent:
- 12:f2ef711f40ef
- Child:
- 14:a976a6a00f7f
- Commit message:
- Add Tlow, Thigh APIs
Changed in this revision
| MAX31723_Digital_Temperature_Sensor.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/MAX31723_Digital_Temperature_Sensor.lib Wed Jan 30 02:14:35 2019 +0000 +++ b/MAX31723_Digital_Temperature_Sensor.lib Tue Feb 12 22:57:39 2019 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/teams/MaximIntegrated/code/MAX31723_Digital_Temperature_Sensor/#8e70ec0923e2 +https://os.mbed.com/teams/MaximIntegrated/code/MAX31723_Digital_Temperature_Sensor/#2e49aa7fa091
--- a/main.cpp Wed Jan 30 02:14:35 2019 +0000
+++ b/main.cpp Tue Feb 12 22:57:39 2019 +0000
@@ -66,35 +66,49 @@
int main()
{
- int ret, i;
+ int i, ret;
float temperature;
- uint8_t value;
DigitalOut rLED(LED1, LED_OFF);
DigitalOut gLED(LED2, LED_OFF);
DigitalOut bLED(LED3, LED_OFF);
+ printf("MAX31723 Temperature Sensor example code.\r\n");
+ printf("\r\n");
gLED = LED_ON;
- MAX31723 max31723_temp(spi, selectPin);
+ MAX31723 temp_sensor(spi, selectPin);
spi.format(8,3); /* 8-bit, SPI mode 3 */
spi.frequency(5000000); /* Use 5 MHz SPI bus */
/* Jumpers (JP1) on MAX31723PMB should be set to SPI mode configuration
* or SERMODE pin should be set to VDD for SPI mode
*/
- ret = max31723_temp.perform_one_shot_int(MAX31723_CFG_RESOLUTION_12BIT);
+ ret = temp_sensor.perform_one_shot_int(MAX31723_CFG_RESOLUTION_12BIT);
for (i = 0; i < 5; i++) {
- ret = max31723_temp.perform_one_shot_int(MAX31723_CFG_RESOLUTION_12BIT);
+ ret = temp_sensor.perform_one_shot_int(MAX31723_CFG_RESOLUTION_12BIT);
wait(MAX31723_CONV_TIME_MSEC_12BIT);
- temperature = max31723_temp.read_reg_as_temperature(MAX31723_REG_TEMP_LSB);
+ temperature = temp_sensor.read_temperature();
printf("Temperature = %4.4f Celsius, %4.4f Fahrenheit\r\n",
- temperature, max31723_temp.celsius_to_fahrenheit(temperature));
+ temperature, temp_sensor.celsius_to_fahrenheit(temperature));
wait(2);
}
- printf("Configuration Register = 0x%02Xh \r\n", max31723_temp.read_cfg());
+ printf("Configuration Register = 0x%02Xh \r\n", temp_sensor.read_cfg());
printf("\r\n");
+
+// temp_sensor.write_trip_low(-25.0625f);
+ temperature = temp_sensor.read_trip_low();
+ printf("Tlow Temperature = %3.4f Celsius, %3.4f Fahrenheit\r\n",
+ temperature, temp_sensor.celsius_to_fahrenheit(temperature));
+
+// temp_sensor.write_trip_high(25.5625f);
+ temperature = temp_sensor.read_trip_high();
+ printf("Thigh Temperature = %3.4f Celsius, %3.4f Fahrenheit\r\n",
+ temperature, temp_sensor.celsius_to_fahrenheit(temperature));
+ printf("\r\n\r\n");
+
+
while (true) { // Blink the green LED
gLED = !gLED;
wait(1.0);