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: DS7505_Low_Voltage_Temperature_Sensor max32630fthr USBDevice
Revision 2:2236f57e3547, committed 2019-04-27
- Comitter:
- phonemacro
- Date:
- Sat Apr 27 19:45:57 2019 +0000
- Parent:
- 1:0efc9f52dfdf
- Commit message:
- Updated for shutdown mode
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Apr 27 09:58:16 2019 +0000
+++ b/main.cpp Sat Apr 27 19:45:57 2019 +0000
@@ -97,7 +97,7 @@
uint8_t i2c_addr = DS7505_I2C_SLAVE_ADR_00;
DS7505 temp_sensor(i2cBus, i2c_addr);
i2cBus.frequency(400000);
- /* Configure for time out enabled, normal format, fault filter 6,
+ /* Configure for 9 bit, fault filter 6,
active low polarity, comparator mode, continuous
*/
temp_sensor.write_cfg_reg(uint8_t(
@@ -128,19 +128,20 @@
#endif
pc.printf("\r\n");
- temp_sensor.write_cfg_reg(uint8_t(
- DS7505_CFG_RESOLUTION_12BIT | DS7505_CFG_FAULT_FILTER_4 |
- DS7505_CFG_OS_POLARITY_ACT_LOW | DS7505_CFG_INTERRUPT_MODE |
- DS7505_CFG_SHUTDOWN));
for (i = 0; i < 8; i++) {
+ /* Configure to shutdown mode */
+ temp_sensor.write_cfg_reg(uint8_t(
+ DS7505_CFG_RESOLUTION_12BIT | DS7505_CFG_FAULT_FILTER_4 |
+ DS7505_CFG_OS_POLARITY_ACT_LOW | DS7505_CFG_INTERRUPT_MODE |
+ DS7505_CFG_SHUTDOWN));
wait_sec_prompt(WAIT_TIME); /* leave it in shutdown mode for a while */
- /* Configure for one shot, time out disabled, extended format, fault filter 4,
- active low polarity, comparator mode, shutdown
+ /* Configure for 12 BIT, fault filter 4,
+ active low polarity, interrupt mode, continuous
*/
temp_sensor.write_cfg_reg(uint8_t(
DS7505_CFG_RESOLUTION_12BIT | DS7505_CFG_FAULT_FILTER_4 |
DS7505_CFG_OS_POLARITY_ACT_LOW | DS7505_CFG_INTERRUPT_MODE |
- DS7505_CFG_SHUTDOWN));
+ DS7505_CFG_CONTINUOUS));
wait(DS7505_WAIT_CONV_TIME_12BIT);
temperature =
temp_sensor.read_reg_as_temperature(DS7505_REG_TEMPERATURE);
@@ -173,7 +174,7 @@
#include "ds7505_c.h"
pc.printf("C implementation of the code\r\n");
ds7505_init(i2c_addr);
- /* Configure for time out enabled, normal format, fault filter 6,
+ /* Configure for 9 bit, fault filter 6,
active low polarity, comparator mode, continuous
*/
ds7505_write_cfg_reg(uint8_t(
@@ -206,19 +207,20 @@
#endif
pc.printf("\r\n");
- ds7505_write_cfg_reg(uint8_t(
- DS7505_CFG_RESOLUTION_12BIT | DS7505_CFG_FAULT_FILTER_4 |
- DS7505_CFG_OS_POLARITY_ACT_LOW | DS7505_CFG_INTERRUPT_MODE |
- DS7505_CFG_SHUTDOWN), i2cBus);
for (i = 0; i < 8; i++) {
+ /* Configure for shutdown mode */
+ ds7505_write_cfg_reg(uint8_t(
+ DS7505_CFG_RESOLUTION_12BIT | DS7505_CFG_FAULT_FILTER_4 |
+ DS7505_CFG_OS_POLARITY_ACT_LOW | DS7505_CFG_INTERRUPT_MODE |
+ DS7505_CFG_SHUTDOWN), i2cBus);
wait_sec_prompt(WAIT_TIME); /* leave it in shutdown mode for a while */
- /* Configure for one shot, time out disabled, extended format, fault filter 4,
- active low polarity, comparator mode, shutdown
+ /* Configure for 12 bits, fault filter 4,
+ active low polarity, interrupt mode, continuous
*/
ds7505_write_cfg_reg(uint8_t(
DS7505_CFG_RESOLUTION_12BIT | DS7505_CFG_FAULT_FILTER_4 |
DS7505_CFG_OS_POLARITY_ACT_LOW | DS7505_CFG_INTERRUPT_MODE |
- DS7505_CFG_SHUTDOWN), i2cBus);
+ DS7505_CFG_CONTINUOUS), i2cBus);
wait(DS7505_WAIT_CONV_TIME_12BIT);
temperature = ds7505_read_reg_as_temperature(DS7505_REG_TEMPERATURE,
i2cBus);