Example host software for the Maxim Integrated MAX31723/MAX31722 Device Temperature Sensor. Hosted on the MAX32630FTHR. The MAX31723 may be used in thermostats, thermometers, and hardware temperature supervisors.

Dependencies:   MAX31723_Digital_Temperature_Sensor max32630fthr USBDevice

Committer:
phonemacro
Date:
Sun Oct 07 21:32:29 2018 +0000
Revision:
4:51c1a4c4f762
Parent:
2:07fde4ba8e91
Child:
7:bf8c91e28a3b
Updated comment blocks

Who changed what in which revision?

UserRevisionLine numberNew contents of line
phonemacro 0:a3f9ce6b99f5 1 /*******************************************************************************
phonemacro 0:a3f9ce6b99f5 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
phonemacro 0:a3f9ce6b99f5 3 *
phonemacro 0:a3f9ce6b99f5 4 * Permission is hereby granted, free of charge, to any person obtaining a
phonemacro 0:a3f9ce6b99f5 5 * copy of this software and associated documentation files (the "Software"),
phonemacro 0:a3f9ce6b99f5 6 * to deal in the Software without restriction, including without limitation
phonemacro 0:a3f9ce6b99f5 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
phonemacro 0:a3f9ce6b99f5 8 * and/or sell copies of the Software, and to permit persons to whom the
phonemacro 0:a3f9ce6b99f5 9 * Software is furnished to do so, subject to the following conditions:
phonemacro 0:a3f9ce6b99f5 10 *
phonemacro 0:a3f9ce6b99f5 11 * The above copyright notice and this permission notice shall be included
phonemacro 0:a3f9ce6b99f5 12 * in all copies or substantial portions of the Software.
phonemacro 0:a3f9ce6b99f5 13 *
phonemacro 0:a3f9ce6b99f5 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
phonemacro 0:a3f9ce6b99f5 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
phonemacro 0:a3f9ce6b99f5 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
phonemacro 0:a3f9ce6b99f5 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
phonemacro 0:a3f9ce6b99f5 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
phonemacro 0:a3f9ce6b99f5 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
phonemacro 0:a3f9ce6b99f5 20 * OTHER DEALINGS IN THE SOFTWARE.
phonemacro 0:a3f9ce6b99f5 21 *
phonemacro 0:a3f9ce6b99f5 22 * Except as contained in this notice, the name of Maxim Integrated
phonemacro 0:a3f9ce6b99f5 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
phonemacro 0:a3f9ce6b99f5 24 * Products, Inc. Branding Policy.
phonemacro 0:a3f9ce6b99f5 25 *
phonemacro 0:a3f9ce6b99f5 26 * The mere transfer of this software does not imply any licenses
phonemacro 0:a3f9ce6b99f5 27 * of trade secrets, proprietary technology, copyrights, patents,
phonemacro 0:a3f9ce6b99f5 28 * trademarks, maskwork rights, or any other form of intellectual
phonemacro 0:a3f9ce6b99f5 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
phonemacro 0:a3f9ce6b99f5 30 * ownership rights.
phonemacro 0:a3f9ce6b99f5 31 *******************************************************************************
phonemacro 0:a3f9ce6b99f5 32 */
phonemacro 0:a3f9ce6b99f5 33 #include "mbed.h"
phonemacro 0:a3f9ce6b99f5 34 #include "max32630fthr.h"
phonemacro 0:a3f9ce6b99f5 35 #include "DS4424.h"
phonemacro 0:a3f9ce6b99f5 36
phonemacro 0:a3f9ce6b99f5 37 #include "USBSerial.h"
phonemacro 0:a3f9ce6b99f5 38
phonemacro 0:a3f9ce6b99f5 39 MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
phonemacro 0:a3f9ce6b99f5 40
phonemacro 0:a3f9ce6b99f5 41 DigitalOut rLED(LED1);
phonemacro 0:a3f9ce6b99f5 42 DigitalOut gLED(LED2);
phonemacro 0:a3f9ce6b99f5 43 DigitalOut bLED(LED3);
phonemacro 1:a7990c969d1a 44
phonemacro 1:a7990c969d1a 45 I2C i2cBus(P3_4, P3_5);
phonemacro 1:a7990c969d1a 46
phonemacro 1:a7990c969d1a 47 DS4424 ds4424_dac(i2cBus, DS4424::DS4424_I2C_SLAVE_ADRS0, DS4424::DS4424_IC);
phonemacro 0:a3f9ce6b99f5 48
phonemacro 4:51c1a4c4f762 49 /** main() runs in its own thread in the OS */
phonemacro 4:51c1a4c4f762 50 /** (note the calls to Thread::wait below for delays) */
phonemacro 2:07fde4ba8e91 51 /**
phonemacro 4:51c1a4c4f762 52 * @brief Sample main program for Maxim Integrated DS4424, DS4422
phonemacro 4:51c1a4c4f762 53 * @version 1.0000.3
phonemacro 4:51c1a4c4f762 54 *
phonemacro 4:51c1a4c4f762 55 * @details Sample main program for DS4424, DS4422
phonemacro 4:51c1a4c4f762 56 * The prints are sent to the terminal window (9600, 8n1).
phonemacro 4:51c1a4c4f762 57 * The program sets the output DAC registers to various values.
phonemacro 4:51c1a4c4f762 58 * These registers are then read back and printed out.
phonemacro 4:51c1a4c4f762 59 * The program then blinks the blue-green LED.
phonemacro 4:51c1a4c4f762 60 * To run the program, drag and drop the .bin file into the
phonemacro 4:51c1a4c4f762 61 * DAPLINK folder. After it finishes flashing, cycle the power or
phonemacro 4:51c1a4c4f762 62 * reset the Pegasus (MAX32630FTHR) after flashing by pressing the button on
phonemacro 4:51c1a4c4f762 63 * the Pegasus next to the battery connector or the button
phonemacro 4:51c1a4c4f762 64 * on the MAXREFDES100HDK.
phonemacro 4:51c1a4c4f762 65 */
phonemacro 0:a3f9ce6b99f5 66 int main()
phonemacro 0:a3f9ce6b99f5 67 {
phonemacro 0:a3f9ce6b99f5 68 int32_t value[4]={0,0,0,0};
phonemacro 0:a3f9ce6b99f5 69 int ret, i;
phonemacro 1:a7990c969d1a 70
phonemacro 0:a3f9ce6b99f5 71 DigitalOut rLED(LED1, LED_OFF);
phonemacro 0:a3f9ce6b99f5 72 DigitalOut gLED(LED2, LED_OFF);
phonemacro 0:a3f9ce6b99f5 73 DigitalOut bLED(LED3, LED_OFF);
phonemacro 0:a3f9ce6b99f5 74
phonemacro 0:a3f9ce6b99f5 75
phonemacro 0:a3f9ce6b99f5 76 bLED = LED_ON;
phonemacro 0:a3f9ce6b99f5 77 gLED = LED_ON;
phonemacro 0:a3f9ce6b99f5 78
phonemacro 1:a7990c969d1a 79 i2cBus.frequency(400000);
phonemacro 0:a3f9ce6b99f5 80
phonemacro 1:a7990c969d1a 81 // read each channel
phonemacro 2:07fde4ba8e91 82 ret = ds4424_dac.write_raw(127, DS4424::REG_OUT0);
phonemacro 2:07fde4ba8e91 83 ret = ds4424_dac.write_raw(2, DS4424::REG_OUT1);
phonemacro 2:07fde4ba8e91 84 ret = ds4424_dac.write_raw(-127, DS4424::REG_OUT2);
phonemacro 2:07fde4ba8e91 85 ret = ds4424_dac.write_raw(-2, DS4424::REG_OUT3);
phonemacro 0:a3f9ce6b99f5 86
phonemacro 2:07fde4ba8e91 87 ret = ds4424_dac.read_raw(value[0], DS4424::REG_OUT0);
phonemacro 2:07fde4ba8e91 88 ret = ds4424_dac.read_raw(value[1], DS4424::REG_OUT1);
phonemacro 2:07fde4ba8e91 89 ret = ds4424_dac.read_raw(value[2], DS4424::REG_OUT2);
phonemacro 2:07fde4ba8e91 90 ret = ds4424_dac.read_raw(value[3], DS4424::REG_OUT3);
phonemacro 0:a3f9ce6b99f5 91 for (i = 0; i < 4; i++) {
phonemacro 0:a3f9ce6b99f5 92 printf("Out%d = %d\r\n", i, value[i]);
phonemacro 0:a3f9ce6b99f5 93 }
phonemacro 1:a7990c969d1a 94 printf("\r\n");
phonemacro 0:a3f9ce6b99f5 95
phonemacro 1:a7990c969d1a 96 while (true) { // Blink the blue-green LED
phonemacro 0:a3f9ce6b99f5 97 bLED = !bLED;
phonemacro 0:a3f9ce6b99f5 98 gLED = !gLED;
phonemacro 0:a3f9ce6b99f5 99 wait(1.0);
phonemacro 0:a3f9ce6b99f5 100 }
phonemacro 0:a3f9ce6b99f5 101
phonemacro 0:a3f9ce6b99f5 102 }
phonemacro 0:a3f9ce6b99f5 103