Test program running on MAX32625MBED. Control through USB Serial commands using a terminal emulator such as teraterm or putty.
Dependencies: MaximTinyTester CmdLine MAX5171 USBDevice
Diff: Test_Main_MAX5171.cpp
- Revision:
- 23:abd02fed1ae4
- Parent:
- 22:a14c19b97d0b
- Child:
- 24:3ef3dd32c7b5
diff -r a14c19b97d0b -r abd02fed1ae4 Test_Main_MAX5171.cpp --- a/Test_Main_MAX5171.cpp Thu Mar 12 23:37:48 2020 +0000 +++ b/Test_Main_MAX5171.cpp Fri Apr 03 06:27:43 2020 +0000 @@ -1,4 +1,4 @@ -// /******************************************************************************* +// /******************************************************************************* // * Copyright (C) 2020 Maxim Integrated Products, Inc., All Rights Reserved. // * // * Permission is hereby granted, free of charge, to any person obtaining a @@ -76,6 +76,9 @@ #if defined(TARGET_MAX32625MBED) #include "USBSerial.h" USBSerial serial; // virtual serial port over USB (DEV connector) +#elif defined(TARGET_MAX32600MBED) +#include "USBSerial.h" +USBSerial serial; // virtual serial port over USB (DEV connector) #elif defined(TARGET_MAX32630MBED) #include "USBSerial.h" USBSerial serial; // virtual serial port over USB (DEV connector) @@ -739,29 +742,33 @@ #endif //-------------------------------------------------- #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE) - #define HAS_digitalInOut0 0 // P0_0 TARGET_MAX32625MBED D0 - #define HAS_digitalInOut1 0 // P0_1 TARGET_MAX32625MBED D1 + #define HAS_digitalInOut0 0 + #define HAS_digitalInOut1 0 #if APPLICATION_MAX11131 - #define HAS_digitalInOut2 0 // P0_2 TARGET_MAX32625MBED D2 -- MAX11131 EOC DigitalIn + // D2 -- MAX11131 EOC DigitalIn + #define HAS_digitalInOut2 0 #else - #define HAS_digitalInOut2 1 // P0_2 TARGET_MAX32625MBED D2 -#endif - #define HAS_digitalInOut3 1 // P0_3 TARGET_MAX32625MBED D3 - #define HAS_digitalInOut4 1 // P0_4 TARGET_MAX32625MBED D4 - #define HAS_digitalInOut5 1 // P0_5 TARGET_MAX32625MBED D5 - #define HAS_digitalInOut6 1 // P0_6 TARGET_MAX32625MBED D6 - #define HAS_digitalInOut7 1 // P0_7 TARGET_MAX32625MBED D7 + #define HAS_digitalInOut2 1 +#endif + #define HAS_digitalInOut3 1 + #define HAS_digitalInOut4 1 + #define HAS_digitalInOut5 1 + #define HAS_digitalInOut6 1 + #define HAS_digitalInOut7 1 #if APPLICATION_MAX5715 - #define HAS_digitalInOut8 0 // P1_4 TARGET_MAX32625MBED D8 -- MAX5715 CLRb DigitalOut + // D8 -- MAX5715 CLRb DigitalOut + #define HAS_digitalInOut8 0 #else - #define HAS_digitalInOut8 1 // P1_4 TARGET_MAX32625MBED D8 + #define HAS_digitalInOut8 1 #endif #if APPLICATION_MAX5715 - #define HAS_digitalInOut9 0 // P1_5 TARGET_MAX32625MBED D9 -- MAX5715 LDACb DigitalOut + // D9 -- MAX5715 LDACb DigitalOut + #define HAS_digitalInOut9 0 #elif APPLICATION_MAX11131 - #define HAS_digitalInOut9 0 // P1_5 TARGET_MAX32625MBED D9 -- MAX11131 CNVST DigitalOut + // D9 -- MAX11131 CNVST DigitalOut + #define HAS_digitalInOut9 0 #else - #define HAS_digitalInOut9 1 // P1_5 TARGET_MAX32625MBED D9 + #define HAS_digitalInOut9 1 #endif #if HAS_SPI // avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut @@ -955,6 +962,8 @@ || HAS_digitalInOut14 || HAS_digitalInOut15 \ || HAS_digitalInOut16 || HAS_digitalInOut17 #define HAS_digitalInOuts 1 +#else +#warning "Note: There are no digitalInOut resources defined" #endif // uncrustify-0.66.1 *INDENT-OFF* @@ -1305,6 +1314,8 @@ || HAS_analogIn12 || HAS_analogIn13 \ || HAS_analogIn14 || HAS_analogIn15 #define HAS_analogIns 1 +#else +#warning "Note: There are no analogIn resources defined" #endif // DigitalInOut pin resource: print the pin index names to serial @@ -1690,13 +1701,21 @@ #define D13 P1_0 #endif -// example code declare SPI interface +// example code declare SPI interface (GPIO controlled CS) #if defined(TARGET_MAX32625MBED) SPI spi(SPI1_MOSI, SPI1_MISO, SPI1_SCK); // mosi, miso, sclk spi1 TARGET_MAX32625MBED: P1_1 P1_2 P1_0 Arduino 10-pin header D11 D12 D13 DigitalOut spi_cs(SPI1_SS); // TARGET_MAX32625MBED: P1_3 Arduino 10-pin header D10 #elif defined(TARGET_MAX32600MBED) SPI spi(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // mosi, miso, sclk spi1 TARGET_MAX32600MBED: Arduino 10-pin header D11 D12 D13 DigitalOut spi_cs(SPI2_SS); // Generic: Arduino 10-pin header D10 +#elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE) +// TODO1: avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut +// void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel) +// +// TODO1: NUCLEO_F446RE SPI not working; CS and MOSI data looks OK but no SCLK clock pulses. +SPI spi(SPI_MOSI, SPI_MISO, SPI_SCK); // mosi, miso, sclk spi1 TARGET_NUCLEO_F446RE: Arduino 10-pin header D11 D12 D13 +DigitalOut spi_cs(SPI_CS); // TARGET_NUCLEO_F446RE: PB_6 Arduino 10-pin header D10 +// #else SPI spi(D11, D12, D13); // mosi, miso, sclk spi1 TARGET_MAX32600MBED: Arduino 10-pin header D11 D12 D13 DigitalOut spi_cs(D10); // Generic: Arduino 10-pin header D10 @@ -1724,10 +1743,6 @@ #define MAX5171_ONSPIPRINT 1 #endif // MAX5171_ONSPIPRINT -//---------------------------------------- -// Global I2C options -// - #define APPLICATION_ArduinoPinsMonitor 1 //-------------------------------------------------- @@ -1804,6 +1819,43 @@ #endif //-------------------------------------------------- +// functions tested by SelfTest() +extern uint16_t fn_MAX5171_DACCodeOfVoltage(double voltageV); +extern double fn_MAX5171_VoltageOfCode(int value_u14); +extern void fn_MAX5171_Init(void); +extern uint8_t fn_MAX5171_CODE_LOAD(int dacCodeLsbs); +extern uint8_t fn_MAX5171_UPO_HIGH(void); +extern uint8_t fn_MAX5171_UPO_LOW(void); + +//-------------------------------------------------- +// optional self-test groups for self test function SelfTest() +// enable by changing the #define value from 0 to 1 + +// SelfTest group DACCodeOfVoltage description: +// Verify function DACCodeOfVoltage (enabled by default) +#ifndef MAX5171_SELFTEST_DACCodeOfVoltage +#define MAX5171_SELFTEST_DACCodeOfVoltage 1 +#endif + +// SelfTest group VoltageOfCode description: +// Verify function VoltageOfCode (enabled by default) +#ifndef MAX5171_SELFTEST_VoltageOfCode +#define MAX5171_SELFTEST_VoltageOfCode 1 +#endif + +// SelfTest group CODE_LOAD description: +// Verify function CODE_LOAD (enabled by default) +#ifndef MAX5171_SELFTEST_CODE_LOAD +#define MAX5171_SELFTEST_CODE_LOAD 1 +#endif + +// SelfTest group UPO description: +// Verify User Programmable Output functions UPO_HIGH and UPO_LOW (enabled by default) +#ifndef MAX5171_SELFTEST_UPO +#define MAX5171_SELFTEST_UPO 1 +#endif + +//-------------------------------------------------- // When user presses button BUTTON1, perform self test #if HAS_BUTTON1_DEMO_INTERRUPT void onButton1FallingEdge(void) @@ -1850,6 +1902,806 @@ #endif tinyTester.clear(); + // @test group DACCodeOfVoltage // Verify function DACCodeOfVoltage (enabled by default) + // @test group DACCodeOfVoltage tinyTester.blink_time_msec = 20 // quickly speed through the software verification + // docTest_item['actionType'] = 'assign-propname-value' + // docTest_item['group-id-value'] = 'DACCodeOfVoltage' + // docTest_item['action'] = 'tinyTester.blink_time_msec = 20' + // docTest_item['remarks'] = 'quickly speed through the software verification' + // docTest_item['propName'] = 'tinyTester.blink_time_msec' + // docTest_item['propValue'] = '20' +#if MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage None quickly speed through the software verification + // assign-propname-value + // tinyTesterPropName = "tinyTester.blink_time_msec" + // tinyTesterPropValue = "20" + tinyTester.blink_time_msec = 20; +#endif // MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage + + // @test group DACCodeOfVoltage tinyTester.print("VRef = 2.500 MAX5171 14-bit LSB = 0.00015V") + // docTest_item['actionType'] = 'print-string' + // docTest_item['group-id-value'] = 'DACCodeOfVoltage' + // docTest_item['action'] = 'tinyTester.print("VRef = 2.500 MAX5171 14-bit LSB = 0.00015V")' + // docTest_item['arglist'] = 'VRef = 2.500 MAX5171 14-bit LSB = 0.00015V' +#if MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage None + // print-string + // tinyTesterFuncName = "tinyTester.print" + // tinyTesterPrintStringLiteral = "VRef = 2.500 MAX5171 14-bit LSB = 0.00015V" + tinyTester.print("VRef = 2.500 MAX5171 14-bit LSB = 0.00015V"); +#endif // MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage + + // @test group DACCodeOfVoltage VRef = 2.500 + // docTest_item['actionType'] = 'assign-propname-value' + // docTest_item['group-id-value'] = 'DACCodeOfVoltage' + // docTest_item['action'] = 'VRef = 2.500' + // docTest_item['propName'] = 'VRef' + // docTest_item['propValue'] = '2.500' +#if MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage None + // assign-propname-value + // tinyTesterPropName = "VRef" + // tinyTesterPropValue = "2.500" + g_MAX5171_device.VRef = 2.500; +#endif // MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage + + // @test group DACCodeOfVoltage tinyTester.err_threshold = 0.00015259720441921504 // 14-bit LSB (2.500/16383) + // docTest_item['actionType'] = 'assign-propname-value' + // docTest_item['group-id-value'] = 'DACCodeOfVoltage' + // docTest_item['action'] = 'tinyTester.err_threshold = 0.00015259720441921504' + // docTest_item['remarks'] = '14-bit LSB (2.500/16383)' + // docTest_item['propName'] = 'tinyTester.err_threshold' + // docTest_item['propValue'] = '0.00015259720441921504' +#if MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage None 14-bit LSB (2.500/16383) + // assign-propname-value + // tinyTesterPropName = "tinyTester.err_threshold" + // tinyTesterPropValue = "0.00015259720441921504" + tinyTester.err_threshold = 0.00015259720441921504; +#endif // MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage + + // @test group DACCodeOfVoltage DACCodeOfVoltage(2.499847412109375) expect 0x3FFF + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'DACCodeOfVoltage' + // docTest_item['action'] = 'DACCodeOfVoltage(2.499847412109375) expect 0x3FFF' + // docTest_item['funcName'] = 'DACCodeOfVoltage' + // docTest_item['arglist'] = '2.499847412109375' + // docTest_item['expect-value'] = '0x3FFF' +#if MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage DACCodeOfVoltage + // call-function + // ASSERT_EQ(g_MAX5171_device.DACCodeOfVoltage((double)2.499847412109375), (uint16_t)0x3FFF); // + tinyTester.FunctionCall_Expect("MAX5171.DACCodeOfVoltage", fn_MAX5171_DACCodeOfVoltage, (double)2.499847412109375, /* expect: */ (uint16_t)0x3FFF); // +#endif // MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage + + // @test group DACCodeOfVoltage DACCodeOfVoltage(2.49969482421875) expect 0x3FFE + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'DACCodeOfVoltage' + // docTest_item['action'] = 'DACCodeOfVoltage(2.49969482421875) expect 0x3FFE' + // docTest_item['funcName'] = 'DACCodeOfVoltage' + // docTest_item['arglist'] = '2.49969482421875' + // docTest_item['expect-value'] = '0x3FFE' +#if MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage DACCodeOfVoltage + // call-function + // ASSERT_EQ(g_MAX5171_device.DACCodeOfVoltage((double)2.49969482421875), (uint16_t)0x3FFE); // + tinyTester.FunctionCall_Expect("MAX5171.DACCodeOfVoltage", fn_MAX5171_DACCodeOfVoltage, (double)2.49969482421875, /* expect: */ (uint16_t)0x3FFE); // +#endif // MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage + + // @test group DACCodeOfVoltage DACCodeOfVoltage(2.499542236328125) expect 0x3FFD + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'DACCodeOfVoltage' + // docTest_item['action'] = 'DACCodeOfVoltage(2.499542236328125) expect 0x3FFD' + // docTest_item['funcName'] = 'DACCodeOfVoltage' + // docTest_item['arglist'] = '2.499542236328125' + // docTest_item['expect-value'] = '0x3FFD' +#if MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage DACCodeOfVoltage + // call-function + // ASSERT_EQ(g_MAX5171_device.DACCodeOfVoltage((double)2.499542236328125), (uint16_t)0x3FFD); // + tinyTester.FunctionCall_Expect("MAX5171.DACCodeOfVoltage", fn_MAX5171_DACCodeOfVoltage, (double)2.499542236328125, /* expect: */ (uint16_t)0x3FFD); // +#endif // MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage + + // @test group DACCodeOfVoltage DACCodeOfVoltage(2.4993896484375) expect 0x3FFC + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'DACCodeOfVoltage' + // docTest_item['action'] = 'DACCodeOfVoltage(2.4993896484375) expect 0x3FFC' + // docTest_item['funcName'] = 'DACCodeOfVoltage' + // docTest_item['arglist'] = '2.4993896484375' + // docTest_item['expect-value'] = '0x3FFC' +#if MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage DACCodeOfVoltage + // call-function + // ASSERT_EQ(g_MAX5171_device.DACCodeOfVoltage((double)2.4993896484375), (uint16_t)0x3FFC); // + tinyTester.FunctionCall_Expect("MAX5171.DACCodeOfVoltage", fn_MAX5171_DACCodeOfVoltage, (double)2.4993896484375, /* expect: */ (uint16_t)0x3FFC); // +#endif // MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage + + // @test group DACCodeOfVoltage DACCodeOfVoltage(1.250152587890625) expect 0x2001 + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'DACCodeOfVoltage' + // docTest_item['action'] = 'DACCodeOfVoltage(1.250152587890625) expect 0x2001' + // docTest_item['funcName'] = 'DACCodeOfVoltage' + // docTest_item['arglist'] = '1.250152587890625' + // docTest_item['expect-value'] = '0x2001' +#if MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage DACCodeOfVoltage + // call-function + // ASSERT_EQ(g_MAX5171_device.DACCodeOfVoltage((double)1.250152587890625), (uint16_t)0x2001); // + tinyTester.FunctionCall_Expect("MAX5171.DACCodeOfVoltage", fn_MAX5171_DACCodeOfVoltage, (double)1.250152587890625, /* expect: */ (uint16_t)0x2001); // +#endif // MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage + + // @test group DACCodeOfVoltage DACCodeOfVoltage(1.25) expect 0x2000 + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'DACCodeOfVoltage' + // docTest_item['action'] = 'DACCodeOfVoltage(1.25) expect 0x2000' + // docTest_item['funcName'] = 'DACCodeOfVoltage' + // docTest_item['arglist'] = '1.25' + // docTest_item['expect-value'] = '0x2000' +#if MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage DACCodeOfVoltage + // call-function + // ASSERT_EQ(g_MAX5171_device.DACCodeOfVoltage((double)1.25), (uint16_t)0x2000); // + tinyTester.FunctionCall_Expect("MAX5171.DACCodeOfVoltage", fn_MAX5171_DACCodeOfVoltage, (double)1.25, /* expect: */ (uint16_t)0x2000); // +#endif // MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage + + // @test group DACCodeOfVoltage DACCodeOfVoltage(1.249847412109375) expect 0x1FFF + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'DACCodeOfVoltage' + // docTest_item['action'] = 'DACCodeOfVoltage(1.249847412109375) expect 0x1FFF' + // docTest_item['funcName'] = 'DACCodeOfVoltage' + // docTest_item['arglist'] = '1.249847412109375' + // docTest_item['expect-value'] = '0x1FFF' +#if MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage DACCodeOfVoltage + // call-function + // ASSERT_EQ(g_MAX5171_device.DACCodeOfVoltage((double)1.249847412109375), (uint16_t)0x1FFF); // + tinyTester.FunctionCall_Expect("MAX5171.DACCodeOfVoltage", fn_MAX5171_DACCodeOfVoltage, (double)1.249847412109375, /* expect: */ (uint16_t)0x1FFF); // +#endif // MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage + + // @test group DACCodeOfVoltage DACCodeOfVoltage(1.24969482421875) expect 0x1FFE + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'DACCodeOfVoltage' + // docTest_item['action'] = 'DACCodeOfVoltage(1.24969482421875) expect 0x1FFE' + // docTest_item['funcName'] = 'DACCodeOfVoltage' + // docTest_item['arglist'] = '1.24969482421875' + // docTest_item['expect-value'] = '0x1FFE' +#if MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage DACCodeOfVoltage + // call-function + // ASSERT_EQ(g_MAX5171_device.DACCodeOfVoltage((double)1.24969482421875), (uint16_t)0x1FFE); // + tinyTester.FunctionCall_Expect("MAX5171.DACCodeOfVoltage", fn_MAX5171_DACCodeOfVoltage, (double)1.24969482421875, /* expect: */ (uint16_t)0x1FFE); // +#endif // MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage + + // @test group DACCodeOfVoltage DACCodeOfVoltage(0.000457763671875) expect 0x0003 + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'DACCodeOfVoltage' + // docTest_item['action'] = 'DACCodeOfVoltage(0.000457763671875) expect 0x0003' + // docTest_item['funcName'] = 'DACCodeOfVoltage' + // docTest_item['arglist'] = '0.000457763671875' + // docTest_item['expect-value'] = '0x0003' +#if MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage DACCodeOfVoltage + // call-function + // ASSERT_EQ(g_MAX5171_device.DACCodeOfVoltage((double)0.000457763671875), (uint16_t)0x0003); // + tinyTester.FunctionCall_Expect("MAX5171.DACCodeOfVoltage", fn_MAX5171_DACCodeOfVoltage, (double)0.000457763671875, /* expect: */ (uint16_t)0x0003); // +#endif // MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage + + // @test group DACCodeOfVoltage DACCodeOfVoltage(0.00030517578125) expect 0x0002 + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'DACCodeOfVoltage' + // docTest_item['action'] = 'DACCodeOfVoltage(0.00030517578125) expect 0x0002' + // docTest_item['funcName'] = 'DACCodeOfVoltage' + // docTest_item['arglist'] = '0.00030517578125' + // docTest_item['expect-value'] = '0x0002' +#if MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage DACCodeOfVoltage + // call-function + // ASSERT_EQ(g_MAX5171_device.DACCodeOfVoltage((double)0.00030517578125), (uint16_t)0x0002); // + tinyTester.FunctionCall_Expect("MAX5171.DACCodeOfVoltage", fn_MAX5171_DACCodeOfVoltage, (double)0.00030517578125, /* expect: */ (uint16_t)0x0002); // +#endif // MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage + + // @test group DACCodeOfVoltage DACCodeOfVoltage(0.000152587890625) expect 0x0001 + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'DACCodeOfVoltage' + // docTest_item['action'] = 'DACCodeOfVoltage(0.000152587890625) expect 0x0001' + // docTest_item['funcName'] = 'DACCodeOfVoltage' + // docTest_item['arglist'] = '0.000152587890625' + // docTest_item['expect-value'] = '0x0001' +#if MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage DACCodeOfVoltage + // call-function + // ASSERT_EQ(g_MAX5171_device.DACCodeOfVoltage((double)0.000152587890625), (uint16_t)0x0001); // + tinyTester.FunctionCall_Expect("MAX5171.DACCodeOfVoltage", fn_MAX5171_DACCodeOfVoltage, (double)0.000152587890625, /* expect: */ (uint16_t)0x0001); // +#endif // MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage + + // @test group DACCodeOfVoltage DACCodeOfVoltage(0.00000) expect 0x0000 + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'DACCodeOfVoltage' + // docTest_item['action'] = 'DACCodeOfVoltage(0.00000) expect 0x0000' + // docTest_item['funcName'] = 'DACCodeOfVoltage' + // docTest_item['arglist'] = '0.00000' + // docTest_item['expect-value'] = '0x0000' +#if MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage DACCodeOfVoltage + // call-function + // ASSERT_EQ(g_MAX5171_device.DACCodeOfVoltage((double)0.00000), (uint16_t)0x0000); // + tinyTester.FunctionCall_Expect("MAX5171.DACCodeOfVoltage", fn_MAX5171_DACCodeOfVoltage, (double)0.00000, /* expect: */ (uint16_t)0x0000); // +#endif // MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage + + // @test group DACCodeOfVoltage tinyTester.blink_time_msec = 75 // default 75 resume hardware self test + // docTest_item['actionType'] = 'assign-propname-value' + // docTest_item['group-id-value'] = 'DACCodeOfVoltage' + // docTest_item['action'] = 'tinyTester.blink_time_msec = 75' + // docTest_item['remarks'] = 'default 75 resume hardware self test' + // docTest_item['propName'] = 'tinyTester.blink_time_msec' + // docTest_item['propValue'] = '75' +#if MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage None default 75 resume hardware self test + // assign-propname-value + // tinyTesterPropName = "tinyTester.blink_time_msec" + // tinyTesterPropValue = "75" + tinyTester.blink_time_msec = 75; +#endif // MAX5171_SELFTEST_DACCodeOfVoltage // group DACCodeOfVoltage + + // @test group VoltageOfCode // Verify function VoltageOfCode (enabled by default) + // @test group VoltageOfCode tinyTester.blink_time_msec = 20 // quickly speed through the software verification + // docTest_item['actionType'] = 'assign-propname-value' + // docTest_item['group-id-value'] = 'VoltageOfCode' + // docTest_item['action'] = 'tinyTester.blink_time_msec = 20' + // docTest_item['remarks'] = 'quickly speed through the software verification' + // docTest_item['propName'] = 'tinyTester.blink_time_msec' + // docTest_item['propValue'] = '20' +#if MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode None quickly speed through the software verification + // assign-propname-value + // tinyTesterPropName = "tinyTester.blink_time_msec" + // tinyTesterPropValue = "20" + tinyTester.blink_time_msec = 20; +#endif // MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode + + // @test group VoltageOfCode tinyTester.print("VRef = 2.500 MAX5171 14-bit LSB = 0.00015V") + // docTest_item['actionType'] = 'print-string' + // docTest_item['group-id-value'] = 'VoltageOfCode' + // docTest_item['action'] = 'tinyTester.print("VRef = 2.500 MAX5171 14-bit LSB = 0.00015V")' + // docTest_item['arglist'] = 'VRef = 2.500 MAX5171 14-bit LSB = 0.00015V' +#if MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode None + // print-string + // tinyTesterFuncName = "tinyTester.print" + // tinyTesterPrintStringLiteral = "VRef = 2.500 MAX5171 14-bit LSB = 0.00015V" + tinyTester.print("VRef = 2.500 MAX5171 14-bit LSB = 0.00015V"); +#endif // MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode + + // @test group VoltageOfCode VRef = 2.500 + // docTest_item['actionType'] = 'assign-propname-value' + // docTest_item['group-id-value'] = 'VoltageOfCode' + // docTest_item['action'] = 'VRef = 2.500' + // docTest_item['propName'] = 'VRef' + // docTest_item['propValue'] = '2.500' +#if MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode None + // assign-propname-value + // tinyTesterPropName = "VRef" + // tinyTesterPropValue = "2.500" + g_MAX5171_device.VRef = 2.500; +#endif // MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode + + // @test group VoltageOfCode tinyTester.err_threshold = 0.00015259720441921504 // 14-bit LSB (2.500/16383) + // docTest_item['actionType'] = 'assign-propname-value' + // docTest_item['group-id-value'] = 'VoltageOfCode' + // docTest_item['action'] = 'tinyTester.err_threshold = 0.00015259720441921504' + // docTest_item['remarks'] = '14-bit LSB (2.500/16383)' + // docTest_item['propName'] = 'tinyTester.err_threshold' + // docTest_item['propValue'] = '0.00015259720441921504' +#if MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode None 14-bit LSB (2.500/16383) + // assign-propname-value + // tinyTesterPropName = "tinyTester.err_threshold" + // tinyTesterPropValue = "0.00015259720441921504" + tinyTester.err_threshold = 0.00015259720441921504; +#endif // MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode + + // @test group VoltageOfCode VoltageOfCode(0x3FFF) expect 2.499847412109375 + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'VoltageOfCode' + // docTest_item['action'] = 'VoltageOfCode(0x3FFF) expect 2.499847412109375' + // docTest_item['funcName'] = 'VoltageOfCode' + // docTest_item['arglist'] = '0x3FFF' + // docTest_item['expect-value'] = '2.499847412109375' +#if MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode VoltageOfCode + // call-function + // ASSERT_EQ(g_MAX5171_device.VoltageOfCode((uint16_t)0x3FFF), (double)2.499847412109375); // + tinyTester.FunctionCall_Expect("MAX5171.VoltageOfCode", fn_MAX5171_VoltageOfCode, (uint16_t)0x3FFF, /* expect: */ (double)2.499847412109375); // +#endif // MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode + + // @test group VoltageOfCode VoltageOfCode(0x3FFE) expect 2.49969482421875 + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'VoltageOfCode' + // docTest_item['action'] = 'VoltageOfCode(0x3FFE) expect 2.49969482421875' + // docTest_item['funcName'] = 'VoltageOfCode' + // docTest_item['arglist'] = '0x3FFE' + // docTest_item['expect-value'] = '2.49969482421875' +#if MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode VoltageOfCode + // call-function + // ASSERT_EQ(g_MAX5171_device.VoltageOfCode((uint16_t)0x3FFE), (double)2.49969482421875); // + tinyTester.FunctionCall_Expect("MAX5171.VoltageOfCode", fn_MAX5171_VoltageOfCode, (uint16_t)0x3FFE, /* expect: */ (double)2.49969482421875); // +#endif // MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode + + // @test group VoltageOfCode VoltageOfCode(0x3FFD) expect 2.499542236328125 + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'VoltageOfCode' + // docTest_item['action'] = 'VoltageOfCode(0x3FFD) expect 2.499542236328125' + // docTest_item['funcName'] = 'VoltageOfCode' + // docTest_item['arglist'] = '0x3FFD' + // docTest_item['expect-value'] = '2.499542236328125' +#if MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode VoltageOfCode + // call-function + // ASSERT_EQ(g_MAX5171_device.VoltageOfCode((uint16_t)0x3FFD), (double)2.499542236328125); // + tinyTester.FunctionCall_Expect("MAX5171.VoltageOfCode", fn_MAX5171_VoltageOfCode, (uint16_t)0x3FFD, /* expect: */ (double)2.499542236328125); // +#endif // MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode + + // @test group VoltageOfCode VoltageOfCode(0x3FFC) expect 2.4993896484375 + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'VoltageOfCode' + // docTest_item['action'] = 'VoltageOfCode(0x3FFC) expect 2.4993896484375' + // docTest_item['funcName'] = 'VoltageOfCode' + // docTest_item['arglist'] = '0x3FFC' + // docTest_item['expect-value'] = '2.4993896484375' +#if MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode VoltageOfCode + // call-function + // ASSERT_EQ(g_MAX5171_device.VoltageOfCode((uint16_t)0x3FFC), (double)2.4993896484375); // + tinyTester.FunctionCall_Expect("MAX5171.VoltageOfCode", fn_MAX5171_VoltageOfCode, (uint16_t)0x3FFC, /* expect: */ (double)2.4993896484375); // +#endif // MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode + + // @test group VoltageOfCode VoltageOfCode(0x2001) expect 1.250152587890625 + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'VoltageOfCode' + // docTest_item['action'] = 'VoltageOfCode(0x2001) expect 1.250152587890625' + // docTest_item['funcName'] = 'VoltageOfCode' + // docTest_item['arglist'] = '0x2001' + // docTest_item['expect-value'] = '1.250152587890625' +#if MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode VoltageOfCode + // call-function + // ASSERT_EQ(g_MAX5171_device.VoltageOfCode((uint16_t)0x2001), (double)1.250152587890625); // + tinyTester.FunctionCall_Expect("MAX5171.VoltageOfCode", fn_MAX5171_VoltageOfCode, (uint16_t)0x2001, /* expect: */ (double)1.250152587890625); // +#endif // MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode + + // @test group VoltageOfCode VoltageOfCode(0x2000) expect 1.25 + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'VoltageOfCode' + // docTest_item['action'] = 'VoltageOfCode(0x2000) expect 1.25' + // docTest_item['funcName'] = 'VoltageOfCode' + // docTest_item['arglist'] = '0x2000' + // docTest_item['expect-value'] = '1.25' +#if MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode VoltageOfCode + // call-function + // ASSERT_EQ(g_MAX5171_device.VoltageOfCode((uint16_t)0x2000), (double)1.25); // + tinyTester.FunctionCall_Expect("MAX5171.VoltageOfCode", fn_MAX5171_VoltageOfCode, (uint16_t)0x2000, /* expect: */ (double)1.25); // +#endif // MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode + + // @test group VoltageOfCode VoltageOfCode(0x1FFF) expect 1.249847412109375 + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'VoltageOfCode' + // docTest_item['action'] = 'VoltageOfCode(0x1FFF) expect 1.249847412109375' + // docTest_item['funcName'] = 'VoltageOfCode' + // docTest_item['arglist'] = '0x1FFF' + // docTest_item['expect-value'] = '1.249847412109375' +#if MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode VoltageOfCode + // call-function + // ASSERT_EQ(g_MAX5171_device.VoltageOfCode((uint16_t)0x1FFF), (double)1.249847412109375); // + tinyTester.FunctionCall_Expect("MAX5171.VoltageOfCode", fn_MAX5171_VoltageOfCode, (uint16_t)0x1FFF, /* expect: */ (double)1.249847412109375); // +#endif // MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode + + // @test group VoltageOfCode VoltageOfCode(0x1FFE) expect 1.24969482421875 + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'VoltageOfCode' + // docTest_item['action'] = 'VoltageOfCode(0x1FFE) expect 1.24969482421875' + // docTest_item['funcName'] = 'VoltageOfCode' + // docTest_item['arglist'] = '0x1FFE' + // docTest_item['expect-value'] = '1.24969482421875' +#if MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode VoltageOfCode + // call-function + // ASSERT_EQ(g_MAX5171_device.VoltageOfCode((uint16_t)0x1FFE), (double)1.24969482421875); // + tinyTester.FunctionCall_Expect("MAX5171.VoltageOfCode", fn_MAX5171_VoltageOfCode, (uint16_t)0x1FFE, /* expect: */ (double)1.24969482421875); // +#endif // MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode + + // @test group VoltageOfCode VoltageOfCode(0x0003) expect 0.000457763671875 + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'VoltageOfCode' + // docTest_item['action'] = 'VoltageOfCode(0x0003) expect 0.000457763671875' + // docTest_item['funcName'] = 'VoltageOfCode' + // docTest_item['arglist'] = '0x0003' + // docTest_item['expect-value'] = '0.000457763671875' +#if MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode VoltageOfCode + // call-function + // ASSERT_EQ(g_MAX5171_device.VoltageOfCode((uint16_t)0x0003), (double)0.000457763671875); // + tinyTester.FunctionCall_Expect("MAX5171.VoltageOfCode", fn_MAX5171_VoltageOfCode, (uint16_t)0x0003, /* expect: */ (double)0.000457763671875); // +#endif // MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode + + // @test group VoltageOfCode VoltageOfCode(0x0002) expect 0.00030517578125 + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'VoltageOfCode' + // docTest_item['action'] = 'VoltageOfCode(0x0002) expect 0.00030517578125' + // docTest_item['funcName'] = 'VoltageOfCode' + // docTest_item['arglist'] = '0x0002' + // docTest_item['expect-value'] = '0.00030517578125' +#if MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode VoltageOfCode + // call-function + // ASSERT_EQ(g_MAX5171_device.VoltageOfCode((uint16_t)0x0002), (double)0.00030517578125); // + tinyTester.FunctionCall_Expect("MAX5171.VoltageOfCode", fn_MAX5171_VoltageOfCode, (uint16_t)0x0002, /* expect: */ (double)0.00030517578125); // +#endif // MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode + + // @test group VoltageOfCode VoltageOfCode(0x0001) expect 0.000152587890625 + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'VoltageOfCode' + // docTest_item['action'] = 'VoltageOfCode(0x0001) expect 0.000152587890625' + // docTest_item['funcName'] = 'VoltageOfCode' + // docTest_item['arglist'] = '0x0001' + // docTest_item['expect-value'] = '0.000152587890625' +#if MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode VoltageOfCode + // call-function + // ASSERT_EQ(g_MAX5171_device.VoltageOfCode((uint16_t)0x0001), (double)0.000152587890625); // + tinyTester.FunctionCall_Expect("MAX5171.VoltageOfCode", fn_MAX5171_VoltageOfCode, (uint16_t)0x0001, /* expect: */ (double)0.000152587890625); // +#endif // MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode + + // @test group VoltageOfCode VoltageOfCode(0x0000) expect 0.00000 + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'VoltageOfCode' + // docTest_item['action'] = 'VoltageOfCode(0x0000) expect 0.00000' + // docTest_item['funcName'] = 'VoltageOfCode' + // docTest_item['arglist'] = '0x0000' + // docTest_item['expect-value'] = '0.00000' +#if MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode VoltageOfCode + // call-function + // ASSERT_EQ(g_MAX5171_device.VoltageOfCode((uint16_t)0x0000), (double)0.00000); // + tinyTester.FunctionCall_Expect("MAX5171.VoltageOfCode", fn_MAX5171_VoltageOfCode, (uint16_t)0x0000, /* expect: */ (double)0.00000); // +#endif // MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode + + // @test group VoltageOfCode tinyTester.blink_time_msec = 75 // default 75 resume hardware self test + // docTest_item['actionType'] = 'assign-propname-value' + // docTest_item['group-id-value'] = 'VoltageOfCode' + // docTest_item['action'] = 'tinyTester.blink_time_msec = 75' + // docTest_item['remarks'] = 'default 75 resume hardware self test' + // docTest_item['propName'] = 'tinyTester.blink_time_msec' + // docTest_item['propValue'] = '75' +#if MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode None default 75 resume hardware self test + // assign-propname-value + // tinyTesterPropName = "tinyTester.blink_time_msec" + // tinyTesterPropValue = "75" + tinyTester.blink_time_msec = 75; +#endif // MAX5171_SELFTEST_VoltageOfCode // group VoltageOfCode + + // @test group CODE_LOAD // Verify function CODE_LOAD (enabled by default) + // @test group CODE_LOAD tinyTester.blink_time_msec = 75 // default 75 resume hardware self test + // docTest_item['actionType'] = 'assign-propname-value' + // docTest_item['group-id-value'] = 'CODE_LOAD' + // docTest_item['action'] = 'tinyTester.blink_time_msec = 75' + // docTest_item['remarks'] = 'default 75 resume hardware self test' + // docTest_item['propName'] = 'tinyTester.blink_time_msec' + // docTest_item['propValue'] = '75' +#if MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD None default 75 resume hardware self test + // assign-propname-value + // tinyTesterPropName = "tinyTester.blink_time_msec" + // tinyTesterPropValue = "75" + tinyTester.blink_time_msec = 75; +#endif // MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD + + // @test group CODE_LOAD tinyTester.settle_time_msec = 500 + // docTest_item['actionType'] = 'assign-propname-value' + // docTest_item['group-id-value'] = 'CODE_LOAD' + // docTest_item['action'] = 'tinyTester.settle_time_msec = 500' + // docTest_item['propName'] = 'tinyTester.settle_time_msec' + // docTest_item['propValue'] = '500' +#if MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD None + // assign-propname-value + // tinyTesterPropName = "tinyTester.settle_time_msec" + // tinyTesterPropValue = "500" + tinyTester.settle_time_msec = 500; +#endif // MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD + + // @test Init() + // docTest_item['actionType'] = 'call-function' + // docTest_item['action'] = 'Init()' + // docTest_item['funcName'] = 'Init' + // call-function + // ASSERT_EQ(g_MAX5171_device.Init(()), (void)None); // + // tinyTester.FunctionCall_Expect("MAX5171.Init", fn_MAX5171_Init, /* empty docTest_argList */ /* empty expect: */ (void)None); // + g_MAX5171_device.Init(); // + + // @test VRef expect 2.500 // Nominal Full-Scale Voltage Reference + // docTest_item['actionType'] = 'test-propname-expect-value' + // docTest_item['action'] = 'VRef expect 2.500' + // docTest_item['remarks'] = 'Nominal Full-Scale Voltage Reference' + // docTest_item['expect-value'] = '2.500' + // docTest_item['propName'] = 'VRef' + // test-propname-expect-value + tinyTester.Expect("MAX5171.VRef", g_MAX5171_device.VRef, /* expect: */ 2.500); // Nominal Full-Scale Voltage Reference + + // @test group CODE_LOAD tinyTester.err_threshold = 0.050 + // docTest_item['actionType'] = 'assign-propname-value' + // docTest_item['group-id-value'] = 'CODE_LOAD' + // docTest_item['action'] = 'tinyTester.err_threshold = 0.050' + // docTest_item['propName'] = 'tinyTester.err_threshold' + // docTest_item['propValue'] = '0.050' +#if MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD None + // assign-propname-value + // tinyTesterPropName = "tinyTester.err_threshold" + // tinyTesterPropValue = "0.050" + tinyTester.err_threshold = 0.050; +#endif // MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD + + // @test group CODE_LOAD tinyTester.print("100.0% of full scale REF(2.50V) = 2.50V Jumper FB=1-2") + // docTest_item['actionType'] = 'print-string' + // docTest_item['group-id-value'] = 'CODE_LOAD' + // docTest_item['action'] = 'tinyTester.print("100.0% of full scale REF(2.50V) = 2.50V Jumper FB=1-2")' + // docTest_item['arglist'] = '100.0% of full scale REF(2.50V) = 2.50V Jumper FB=1-2' +#if MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD None + // print-string + // tinyTesterFuncName = "tinyTester.print" + // tinyTesterPrintStringLiteral = "100.0% of full scale REF(2.50V) = 2.50V Jumper FB=1-2" + tinyTester.print("100.0% of full scale REF(2.50V) = 2.50V Jumper FB=1-2"); +#endif // MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD + + // @test group CODE_LOAD CODE_LOAD(0x3FFF) // 100.0% of full scale REF(2.50V) = 2.50V + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'CODE_LOAD' + // docTest_item['action'] = 'CODE_LOAD(0x3FFF)' + // docTest_item['remarks'] = '100.0% of full scale REF(2.50V) = 2.50V' + // docTest_item['funcName'] = 'CODE_LOAD' + // docTest_item['arglist'] = '0x3FFF' +#if MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD CODE_LOAD 100.0% of full scale REF(2.50V) = 2.50V + // call-function + // ASSERT_EQ(g_MAX5171_device.CODE_LOAD((uint16_t)0x3FFF), (uint8_t)None); // 100.0% of full scale REF(2.50V) = 2.50V + // tinyTester.FunctionCall_Expect("MAX5171.CODE_LOAD", fn_MAX5171_CODE_LOAD, (uint16_t)0x3FFF, /* empty expect: */ (uint8_t)None); // 100.0% of full scale REF(2.50V) = 2.50V + g_MAX5171_device.CODE_LOAD((uint16_t)0x3FFF); // 100.0% of full scale REF(2.50V) = 2.50V +#endif // MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD + + // @test group CODE_LOAD tinyTester.Wait_Output_Settling() + // docTest_item['actionType'] = 'call-tinytester-function' + // docTest_item['group-id-value'] = 'CODE_LOAD' + // docTest_item['action'] = 'tinyTester.Wait_Output_Settling()' + // docTest_item['propName'] = 'Wait_Output_Settling' +#if MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD None + // call-tinytester-function + // tinyTesterFuncName = "tinyTester.Wait_Output_Settling" + // docTest_argList = "" + tinyTester.Wait_Output_Settling(); // +#endif // MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD + + // @test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(2.500) + // docTest_item['actionType'] = 'call-tinytester-function' + // docTest_item['group-id-value'] = 'CODE_LOAD' + // docTest_item['action'] = 'tinyTester.AnalogIn0_Read_Expect_voltageV(2.500)' + // docTest_item['arglist'] = '2.500' + // docTest_item['propName'] = 'AnalogIn0_Read_Expect_voltageV' +#if MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD None + // call-tinytester-function + // tinyTesterFuncName = "tinyTester.AnalogIn0_Read_Expect_voltageV" + // docTest_argList = "2.500" + tinyTester.AnalogIn0_Read_Expect_voltageV(2.500); // +#endif // MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD + + // @test group CODE_LOAD tinyTester.print("0.0% of full scale REF(2.50V) = 0.000V") + // docTest_item['actionType'] = 'print-string' + // docTest_item['group-id-value'] = 'CODE_LOAD' + // docTest_item['action'] = 'tinyTester.print("0.0% of full scale REF(2.50V) = 0.000V")' + // docTest_item['arglist'] = '0.0% of full scale REF(2.50V) = 0.000V' +#if MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD None + // print-string + // tinyTesterFuncName = "tinyTester.print" + // tinyTesterPrintStringLiteral = "0.0% of full scale REF(2.50V) = 0.000V" + tinyTester.print("0.0% of full scale REF(2.50V) = 0.000V"); +#endif // MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD + + // @test group CODE_LOAD CODE_LOAD(0x0000) // 0.0% of full scale REF(2.50V) = 0.000V + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'CODE_LOAD' + // docTest_item['action'] = 'CODE_LOAD(0x0000)' + // docTest_item['remarks'] = '0.0% of full scale REF(2.50V) = 0.000V' + // docTest_item['funcName'] = 'CODE_LOAD' + // docTest_item['arglist'] = '0x0000' +#if MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD CODE_LOAD 0.0% of full scale REF(2.50V) = 0.000V + // call-function + // ASSERT_EQ(g_MAX5171_device.CODE_LOAD((uint16_t)0x0000), (uint8_t)None); // 0.0% of full scale REF(2.50V) = 0.000V + // tinyTester.FunctionCall_Expect("MAX5171.CODE_LOAD", fn_MAX5171_CODE_LOAD, (uint16_t)0x0000, /* empty expect: */ (uint8_t)None); // 0.0% of full scale REF(2.50V) = 0.000V + g_MAX5171_device.CODE_LOAD((uint16_t)0x0000); // 0.0% of full scale REF(2.50V) = 0.000V +#endif // MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD + + // @test group CODE_LOAD tinyTester.Wait_Output_Settling() + // docTest_item['actionType'] = 'call-tinytester-function' + // docTest_item['group-id-value'] = 'CODE_LOAD' + // docTest_item['action'] = 'tinyTester.Wait_Output_Settling()' + // docTest_item['propName'] = 'Wait_Output_Settling' +#if MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD None + // call-tinytester-function + // tinyTesterFuncName = "tinyTester.Wait_Output_Settling" + // docTest_argList = "" + tinyTester.Wait_Output_Settling(); // +#endif // MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD + + // @test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(0.0000) + // docTest_item['actionType'] = 'call-tinytester-function' + // docTest_item['group-id-value'] = 'CODE_LOAD' + // docTest_item['action'] = 'tinyTester.AnalogIn0_Read_Expect_voltageV(0.0000)' + // docTest_item['arglist'] = '0.0000' + // docTest_item['propName'] = 'AnalogIn0_Read_Expect_voltageV' +#if MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD None + // call-tinytester-function + // tinyTesterFuncName = "tinyTester.AnalogIn0_Read_Expect_voltageV" + // docTest_argList = "0.0000" + tinyTester.AnalogIn0_Read_Expect_voltageV(0.0000); // +#endif // MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD + + // @test group CODE_LOAD tinyTester.print("50.0% of full scale REF(2.50V) = 1.25V") + // docTest_item['actionType'] = 'print-string' + // docTest_item['group-id-value'] = 'CODE_LOAD' + // docTest_item['action'] = 'tinyTester.print("50.0% of full scale REF(2.50V) = 1.25V")' + // docTest_item['arglist'] = '50.0% of full scale REF(2.50V) = 1.25V' +#if MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD None + // print-string + // tinyTesterFuncName = "tinyTester.print" + // tinyTesterPrintStringLiteral = "50.0% of full scale REF(2.50V) = 1.25V" + tinyTester.print("50.0% of full scale REF(2.50V) = 1.25V"); +#endif // MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD + + // @test group CODE_LOAD CODE_LOAD(0x1FFF) // 50.0% of full scale REF(2.50V) = 1.25V + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'CODE_LOAD' + // docTest_item['action'] = 'CODE_LOAD(0x1FFF)' + // docTest_item['remarks'] = '50.0% of full scale REF(2.50V) = 1.25V' + // docTest_item['funcName'] = 'CODE_LOAD' + // docTest_item['arglist'] = '0x1FFF' +#if MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD CODE_LOAD 50.0% of full scale REF(2.50V) = 1.25V + // call-function + // ASSERT_EQ(g_MAX5171_device.CODE_LOAD((uint16_t)0x1FFF), (uint8_t)None); // 50.0% of full scale REF(2.50V) = 1.25V + // tinyTester.FunctionCall_Expect("MAX5171.CODE_LOAD", fn_MAX5171_CODE_LOAD, (uint16_t)0x1FFF, /* empty expect: */ (uint8_t)None); // 50.0% of full scale REF(2.50V) = 1.25V + g_MAX5171_device.CODE_LOAD((uint16_t)0x1FFF); // 50.0% of full scale REF(2.50V) = 1.25V +#endif // MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD + + // @test group CODE_LOAD tinyTester.Wait_Output_Settling() + // docTest_item['actionType'] = 'call-tinytester-function' + // docTest_item['group-id-value'] = 'CODE_LOAD' + // docTest_item['action'] = 'tinyTester.Wait_Output_Settling()' + // docTest_item['propName'] = 'Wait_Output_Settling' +#if MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD None + // call-tinytester-function + // tinyTesterFuncName = "tinyTester.Wait_Output_Settling" + // docTest_argList = "" + tinyTester.Wait_Output_Settling(); // +#endif // MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD + + // @test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(1.2500) + // docTest_item['actionType'] = 'call-tinytester-function' + // docTest_item['group-id-value'] = 'CODE_LOAD' + // docTest_item['action'] = 'tinyTester.AnalogIn0_Read_Expect_voltageV(1.2500)' + // docTest_item['arglist'] = '1.2500' + // docTest_item['propName'] = 'AnalogIn0_Read_Expect_voltageV' +#if MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD None + // call-tinytester-function + // tinyTesterFuncName = "tinyTester.AnalogIn0_Read_Expect_voltageV" + // docTest_argList = "1.2500" + tinyTester.AnalogIn0_Read_Expect_voltageV(1.2500); // +#endif // MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD + + // @test group UPO // Verify User Programmable Output functions UPO_HIGH and UPO_LOW (enabled by default) + // @test group UPO tinyTester.blink_time_msec = 75 // default 75 resume hardware self test + // docTest_item['actionType'] = 'assign-propname-value' + // docTest_item['group-id-value'] = 'UPO' + // docTest_item['action'] = 'tinyTester.blink_time_msec = 75' + // docTest_item['remarks'] = 'default 75 resume hardware self test' + // docTest_item['propName'] = 'tinyTester.blink_time_msec' + // docTest_item['propValue'] = '75' +#if MAX5171_SELFTEST_UPO // group UPO None default 75 resume hardware self test + // assign-propname-value + // tinyTesterPropName = "tinyTester.blink_time_msec" + // tinyTesterPropValue = "75" + tinyTester.blink_time_msec = 75; +#endif // MAX5171_SELFTEST_UPO // group UPO + + // @test group UPO tinyTester.settle_time_msec = 500 // default 250 + // docTest_item['actionType'] = 'assign-propname-value' + // docTest_item['group-id-value'] = 'UPO' + // docTest_item['action'] = 'tinyTester.settle_time_msec = 500' + // docTest_item['remarks'] = 'default 250' + // docTest_item['propName'] = 'tinyTester.settle_time_msec' + // docTest_item['propValue'] = '500' +#if MAX5171_SELFTEST_UPO // group UPO None default 250 + // assign-propname-value + // tinyTesterPropName = "tinyTester.settle_time_msec" + // tinyTesterPropValue = "500" + tinyTester.settle_time_msec = 500; +#endif // MAX5171_SELFTEST_UPO // group UPO + + // @test group UPO UPO_HIGH() + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'UPO' + // docTest_item['action'] = 'UPO_HIGH()' + // docTest_item['funcName'] = 'UPO_HIGH' +#if MAX5171_SELFTEST_UPO // group UPO UPO_HIGH + // call-function + // ASSERT_EQ(g_MAX5171_device.UPO_HIGH(()), (uint8_t)None); // + // tinyTester.FunctionCall_Expect("MAX5171.UPO_HIGH", fn_MAX5171_UPO_HIGH, /* empty docTest_argList */ /* empty expect: */ (uint8_t)None); // + g_MAX5171_device.UPO_HIGH(); // +#endif // MAX5171_SELFTEST_UPO // group UPO + + // @test group UPO tinyTester.Wait_Output_Settling() + // docTest_item['actionType'] = 'call-tinytester-function' + // docTest_item['group-id-value'] = 'UPO' + // docTest_item['action'] = 'tinyTester.Wait_Output_Settling()' + // docTest_item['propName'] = 'Wait_Output_Settling' +#if MAX5171_SELFTEST_UPO // group UPO None + // call-tinytester-function + // tinyTesterFuncName = "tinyTester.Wait_Output_Settling" + // docTest_argList = "" + tinyTester.Wait_Output_Settling(); // +#endif // MAX5171_SELFTEST_UPO // group UPO + + // @test group CODE_LOAD tinyTester.DigitalIn_Read_Expect_WarnOnly(UPO_pin, "UPO", 1, "UPO_pin is high after MAX5171 UPO_HIGH command") + // docTest_item['actionType'] = 'call-tinytester-function' + // docTest_item['group-id-value'] = 'CODE_LOAD' + // docTest_item['action'] = 'tinyTester.DigitalIn_Read_Expect_WarnOnly(UPO_pin, "UPO", 1, "UPO_pin is high after MAX5171 UPO_HIGH command")' + // docTest_item['arglist'] = 'UPO_pin, "UPO", 1, "UPO_pin is high after MAX5171 UPO_HIGH command"' + // docTest_item['propName'] = 'DigitalIn_Read_Expect_WarnOnly' +#if MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD None + // call-tinytester-function + // tinyTesterFuncName = "tinyTester.DigitalIn_Read_Expect_WarnOnly" + // docTest_argList = "UPO_pin, "UPO", 1, "UPO_pin is high after MAX5171 UPO_HIGH command"" + tinyTester.DigitalIn_Read_Expect_WarnOnly(UPO_pin, "UPO", 1, "UPO_pin is high after MAX5171 UPO_HIGH command"); // +#endif // MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD + + // @test group UPO UPO_LOW() + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'UPO' + // docTest_item['action'] = 'UPO_LOW()' + // docTest_item['funcName'] = 'UPO_LOW' +#if MAX5171_SELFTEST_UPO // group UPO UPO_LOW + // call-function + // ASSERT_EQ(g_MAX5171_device.UPO_LOW(()), (uint8_t)None); // + // tinyTester.FunctionCall_Expect("MAX5171.UPO_LOW", fn_MAX5171_UPO_LOW, /* empty docTest_argList */ /* empty expect: */ (uint8_t)None); // + g_MAX5171_device.UPO_LOW(); // +#endif // MAX5171_SELFTEST_UPO // group UPO + + // @test group UPO tinyTester.Wait_Output_Settling() + // docTest_item['actionType'] = 'call-tinytester-function' + // docTest_item['group-id-value'] = 'UPO' + // docTest_item['action'] = 'tinyTester.Wait_Output_Settling()' + // docTest_item['propName'] = 'Wait_Output_Settling' +#if MAX5171_SELFTEST_UPO // group UPO None + // call-tinytester-function + // tinyTesterFuncName = "tinyTester.Wait_Output_Settling" + // docTest_argList = "" + tinyTester.Wait_Output_Settling(); // +#endif // MAX5171_SELFTEST_UPO // group UPO + + // @test group CODE_LOAD tinyTester.DigitalIn_Read_Expect_WarnOnly(UPO_pin, "UPO", 0, "UPO_pin is low after MAX5171 UPO_LOW command") + // docTest_item['actionType'] = 'call-tinytester-function' + // docTest_item['group-id-value'] = 'CODE_LOAD' + // docTest_item['action'] = 'tinyTester.DigitalIn_Read_Expect_WarnOnly(UPO_pin, "UPO", 0, "UPO_pin is low after MAX5171 UPO_LOW command")' + // docTest_item['arglist'] = 'UPO_pin, "UPO", 0, "UPO_pin is low after MAX5171 UPO_LOW command"' + // docTest_item['propName'] = 'DigitalIn_Read_Expect_WarnOnly' +#if MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD None + // call-tinytester-function + // tinyTesterFuncName = "tinyTester.DigitalIn_Read_Expect_WarnOnly" + // docTest_argList = "UPO_pin, "UPO", 0, "UPO_pin is low after MAX5171 UPO_LOW command"" + tinyTester.DigitalIn_Read_Expect_WarnOnly(UPO_pin, "UPO", 0, "UPO_pin is low after MAX5171 UPO_LOW command"); // +#endif // MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD + + // @test group UPO UPO_HIGH() + // docTest_item['actionType'] = 'call-function' + // docTest_item['group-id-value'] = 'UPO' + // docTest_item['action'] = 'UPO_HIGH()' + // docTest_item['funcName'] = 'UPO_HIGH' +#if MAX5171_SELFTEST_UPO // group UPO UPO_HIGH + // call-function + // ASSERT_EQ(g_MAX5171_device.UPO_HIGH(()), (uint8_t)None); // + // tinyTester.FunctionCall_Expect("MAX5171.UPO_HIGH", fn_MAX5171_UPO_HIGH, /* empty docTest_argList */ /* empty expect: */ (uint8_t)None); // + g_MAX5171_device.UPO_HIGH(); // +#endif // MAX5171_SELFTEST_UPO // group UPO + + // @test group UPO tinyTester.Wait_Output_Settling() + // docTest_item['actionType'] = 'call-tinytester-function' + // docTest_item['group-id-value'] = 'UPO' + // docTest_item['action'] = 'tinyTester.Wait_Output_Settling()' + // docTest_item['propName'] = 'Wait_Output_Settling' +#if MAX5171_SELFTEST_UPO // group UPO None + // call-tinytester-function + // tinyTesterFuncName = "tinyTester.Wait_Output_Settling" + // docTest_argList = "" + tinyTester.Wait_Output_Settling(); // +#endif // MAX5171_SELFTEST_UPO // group UPO + + // @test group CODE_LOAD tinyTester.DigitalIn_Read_Expect_WarnOnly(UPO_pin, "UPO", 1, "UPO_pin is high after MAX5171 UPO_HIGH command") + // docTest_item['actionType'] = 'call-tinytester-function' + // docTest_item['group-id-value'] = 'CODE_LOAD' + // docTest_item['action'] = 'tinyTester.DigitalIn_Read_Expect_WarnOnly(UPO_pin, "UPO", 1, "UPO_pin is high after MAX5171 UPO_HIGH command")' + // docTest_item['arglist'] = 'UPO_pin, "UPO", 1, "UPO_pin is high after MAX5171 UPO_HIGH command"' + // docTest_item['propName'] = 'DigitalIn_Read_Expect_WarnOnly' +#if MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD None + // call-tinytester-function + // tinyTesterFuncName = "tinyTester.DigitalIn_Read_Expect_WarnOnly" + // docTest_argList = "UPO_pin, "UPO", 1, "UPO_pin is high after MAX5171 UPO_HIGH command"" + tinyTester.DigitalIn_Read_Expect_WarnOnly(UPO_pin, "UPO", 1, "UPO_pin is high after MAX5171 UPO_HIGH command"); // +#endif // MAX5171_SELFTEST_CODE_LOAD // group CODE_LOAD + // #if INJECT_SELFTEST_FAIL // Test of the pass/fail report mechanism @@ -1861,6 +2713,96 @@ tinyTester.Report_Summary(); } +//-------------------------------------------------- +// selfTestFunctionClosures[functionName]['functionName'] = 'DACCodeOfVoltage' +// selfTestFunctionClosures[functionName]['argListDeclaration'] = 'double voltageV' +// selfTestFunctionClosures[functionName]['returnType'] = 'uint16_t' +// selfTestFunctionClosures[functionName]['argNames'] = 'voltageV' +// CommandParamIn_declaration = 'double voltageV' +// argNames_recast_implementation = '(double)voltageV' +//-------------------------------------------------- +// selftest: define function under test +// uint16_t MAX5171::DACCodeOfVoltage(double voltageV) +uint16_t fn_MAX5171_DACCodeOfVoltage(double voltageV) +{ + return g_MAX5171_device.DACCodeOfVoltage((double)voltageV); +} + +//-------------------------------------------------- +// selfTestFunctionClosures[functionName]['functionName'] = 'VoltageOfCode' +// selfTestFunctionClosures[functionName]['argListDeclaration'] = 'uint16_t value_u14' +// selfTestFunctionClosures[functionName]['returnType'] = 'double' +// selfTestFunctionClosures[functionName]['argNames'] = 'value_u14' +// CommandParamIn_declaration = 'int value_u14' +// argNames_recast_implementation = '(uint16_t)value_u14' +//-------------------------------------------------- +// selftest: define function under test +// double MAX5171::VoltageOfCode(uint16_t value_u14) +double fn_MAX5171_VoltageOfCode(int value_u14) +{ + return g_MAX5171_device.VoltageOfCode((uint16_t)value_u14); +} + +//-------------------------------------------------- +// selfTestFunctionClosures[functionName]['functionName'] = 'Init' +// selfTestFunctionClosures[functionName]['argListDeclaration'] = 'void' +// selfTestFunctionClosures[functionName]['returnType'] = 'void' +// selfTestFunctionClosures[functionName]['argNames'] = '' +// CommandParamIn_declaration = 'void' +// argNames_recast_implementation = '' +//-------------------------------------------------- +// selftest: define function under test +// void MAX5171::Init(void) +void fn_MAX5171_Init(void) +{ + return g_MAX5171_device.Init(); +} + +//-------------------------------------------------- +// selfTestFunctionClosures[functionName]['functionName'] = 'CODE_LOAD' +// selfTestFunctionClosures[functionName]['argListDeclaration'] = 'uint16_t dacCodeLsbs' +// selfTestFunctionClosures[functionName]['returnType'] = 'uint8_t' +// selfTestFunctionClosures[functionName]['argNames'] = 'dacCodeLsbs' +// CommandParamIn_declaration = 'int dacCodeLsbs' +// argNames_recast_implementation = '(uint16_t)dacCodeLsbs' +//-------------------------------------------------- +// selftest: define function under test +// uint8_t MAX5171::CODE_LOAD(uint16_t dacCodeLsbs) +uint8_t fn_MAX5171_CODE_LOAD(int dacCodeLsbs) +{ + return g_MAX5171_device.CODE_LOAD((uint16_t)dacCodeLsbs); +} + +//-------------------------------------------------- +// selfTestFunctionClosures[functionName]['functionName'] = 'UPO_HIGH' +// selfTestFunctionClosures[functionName]['argListDeclaration'] = 'void' +// selfTestFunctionClosures[functionName]['returnType'] = 'uint8_t' +// selfTestFunctionClosures[functionName]['argNames'] = '' +// CommandParamIn_declaration = 'void' +// argNames_recast_implementation = '' +//-------------------------------------------------- +// selftest: define function under test +// uint8_t MAX5171::UPO_HIGH(void) +uint8_t fn_MAX5171_UPO_HIGH(void) +{ + return g_MAX5171_device.UPO_HIGH(); +} + +//-------------------------------------------------- +// selfTestFunctionClosures[functionName]['functionName'] = 'UPO_LOW' +// selfTestFunctionClosures[functionName]['argListDeclaration'] = 'void' +// selfTestFunctionClosures[functionName]['returnType'] = 'uint8_t' +// selfTestFunctionClosures[functionName]['argNames'] = '' +// CommandParamIn_declaration = 'void' +// argNames_recast_implementation = '' +//-------------------------------------------------- +// selftest: define function under test +// uint8_t MAX5171::UPO_LOW(void) +uint8_t fn_MAX5171_UPO_LOW(void) +{ + return g_MAX5171_device.UPO_LOW(); +} + //-------------------------------------------------- inline void print_command_prompt() @@ -2332,10 +3274,12 @@ // %SD -- SPI diagnostic messages enable if (g_MAX5171_device.onSPIprint) { g_MAX5171_device.onSPIprint = NULL; + // no g_MAX5171_device.futility_countdown_limit property; device_has_property(Device, 'futility_countdown_limit') != None is false } else { void onSPIprint_handler(size_t byteCount, uint8_t mosiData[], uint8_t misoData[]); g_MAX5171_device.onSPIprint = onSPIprint_handler; + // no g_MAX5171_device.futility_countdown_limit property; device_has_property(Device, 'futility_countdown_limit') is false } break; case 'W': case 'R': case 'w': case 'r': @@ -2618,7 +3562,7 @@ // Optional Diagnostic function to print SPI transactions void onSPIprint_handler(size_t byteCount, uint8_t mosiData[], uint8_t misoData[]) { - cmdLine_serial.serial().printf("\r\nSPI MOSI->"); + cmdLine_serial.serial().printf("\r\n SPI MOSI->"); for (uint8_t index = 0; index < byteCount; index++) { cmdLine_serial.serial().printf(" 0x%2.2X", mosiData[index]); } @@ -2640,31 +3584,7 @@ # endif cmdLine_serial.serial().printf("\r\nMAX5171_Init()"); - // Initialize MAX5171 and verify device ID - if (g_MAX5171_device.Init() == 0) - { // init failed; try "safe mode" SPI at slower SCLK rate - cmdLine_serial.serial().printf("\r\nMAX5171 Init failed; retry at SPI SCLK frequency 2000000 Hz\r\n"); - - g_SPI_SCLK_Hz = 2000000; - g_MAX5171_device.spi_frequency(2000000); - g_MAX5171_device.Init(); - } - if (g_SPI_SCLK_Hz > g_MAX5171_device.get_spi_frequency()) - { // Device limits SPI SCLK frequency - g_SPI_SCLK_Hz = g_MAX5171_device.get_spi_frequency(); - cmdLine_serial.serial().printf("\r\nMAX5171 limits SPI SCLK frequency to %ld Hz\r\n", g_SPI_SCLK_Hz); - - g_MAX5171_device.Init(); - } - if (g_MAX5171_device.get_spi_frequency() > g_SPI_SCLK_Hz) - { // Platform limits SPI SCLK frequency - g_MAX5171_device.spi_frequency(g_SPI_SCLK_Hz); - cmdLine_serial.serial().printf("\r\nPlatform limits MAX5171 SPI SCLK frequency to %ld Hz\r\n", g_SPI_SCLK_Hz); - - g_MAX5171_device.Init(); - } - g_SPI_dataMode = g_MAX5171_device.get_spi_dataMode(); - + g_MAX5171_device.Init(); // defined in #include MAX5171.h # if MAX5171_ONSPIPRINT // Optional Diagnostic function to print SPI transactions g_MAX5171_device.onSPIprint = onSPIprint_handler; @@ -2746,6 +3666,31 @@ //print_banner(); +#if HAS_I2C +// i2c init +// declare in narrower scope: MAX32625MBED I2C i2cMaster(...) +// i2cMaster.frequency(g_I2C_SCL_Hz); +#else + // Ensure that the unused I2C pins do not interfere with analog inputs A4 and A5 +#if HAS_digitalInOut14 + // DigitalInOut digitalInOut14(P1_6, PIN_INPUT, PullUp, 1); // P1_6 TARGET_MAX32635MBED A4/SDA (10pin digital connector) + digitalInOut14.input(); +#endif +#if HAS_digitalInOut15 + // DigitalInOut digitalInOut15(P1_7, PIN_INPUT, PullUp, 1); // P1_7 TARGET_MAX32635MBED A5/SCL (10pin digital connector) + digitalInOut15.input(); +#endif +#if HAS_digitalInOut16 + // DigitalInOut mode can be one of PullUp, PullDown, PullNone, OpenDrain + // PullUp-->3.4V, PullDown-->1.7V, PullNone-->3.5V, OpenDrain-->0.00V + //DigitalInOut digitalInOut16(P3_4, PIN_INPUT, OpenDrain, 0); // P3_4 TARGET_MAX32635MBED A4/SDA (6pin analog connector) + digitalInOut16.input(); +#endif +#if HAS_digitalInOut17 + //DigitalInOut digitalInOut17(P3_5, PIN_INPUT, OpenDrain, 0); // P3_5 TARGET_MAX32635MBED A5/SCL (6pin analog connector) + digitalInOut17.input(); +#endif +#endif // HAS_I2C #if USE_LEDS @@ -2811,13 +3756,17 @@ // #if USE_LEDS // rgb_led.white(); // diagnostic rbg led RED+GREEN+BLUE=WHITE // #endif // USE_LEDS - led1 = LED_ON; - led2 = LED_ON; - led3 = LED_ON; + if (led1.is_connected()) { + led1 = LED_ON; + } + if (led2.is_connected()) { + led2 = LED_ON; + } + if (led3.is_connected()) { + led3 = LED_ON; + } InitializeConfiguration(); - g_MAX5171_device.Init(); - // example code: serial port banner message #if defined(TARGET_MAX32625MBED) serial.printf("MAX32625MBED "); @@ -2873,4 +3822,3 @@ } } // while(1) } -