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
Diff: main.cpp
- Revision:
- 1:a7990c969d1a
- Parent:
- 0:a3f9ce6b99f5
- Child:
- 2:07fde4ba8e91
--- a/main.cpp Thu May 10 22:59:56 2018 +0000 +++ b/main.cpp Sat May 12 03:59:43 2018 +0000 @@ -41,7 +41,10 @@ DigitalOut rLED(LED1); DigitalOut gLED(LED2); DigitalOut bLED(LED3); - + +I2C i2cBus(P3_4, P3_5); + +DS4424 ds4424_dac(i2cBus, DS4424::DS4424_I2C_SLAVE_ADRS0, DS4424::DS4424_IC); // main() runs in its own thread in the OS // (note the calls to Thread::wait below for delays) @@ -49,7 +52,7 @@ { int32_t value[4]={0,0,0,0}; int ret, i; - + DigitalOut rLED(LED1, LED_OFF); DigitalOut gLED(LED2, LED_OFF); DigitalOut bLED(LED3, LED_OFF); @@ -58,18 +61,9 @@ bLED = LED_ON; gLED = LED_ON; -// I2C i2cBus(P5_7, P6_0); - I2C i2cBus(P3_4, P3_5); - //i2cBus.frequency(400000); - DS4424 ds4424_dac(i2cBus, DS4424::DS4424_I2C_SLAVE_ADRS0); + i2cBus.frequency(400000); - ret = ds4424_dac.readRaw(value[0], DS4424::REG_OUT0); - ret = ds4424_dac.readRaw(value[1], DS4424::REG_OUT1); - ret = ds4424_dac.readRaw(value[2], DS4424::REG_OUT2); - ret = ds4424_dac.readRaw(value[3], DS4424::REG_OUT3); - for (i = 0; i < 4; i++) { - printf("Out%d = %d\r\n", i, value[i]); - } + // read each channel ret = ds4424_dac.writeRaw(127, DS4424::REG_OUT0); ret = ds4424_dac.writeRaw(2, DS4424::REG_OUT1); ret = ds4424_dac.writeRaw(-127, DS4424::REG_OUT2); @@ -82,11 +76,9 @@ for (i = 0; i < 4; i++) { printf("Out%d = %d\r\n", i, value[i]); } - - //ret = ds4424_dac.printRawRegs(); - //ret = ds4424_dac.printRegs(); + printf("\r\n"); - while (true) { + while (true) { // Blink the blue-green LED bLED = !bLED; gLED = !gLED; wait(1.0);