Test program running on MAX32625MBED. Control through USB Serial commands using a terminal emulator such as teraterm or putty.
Dependencies: MaximTinyTester CmdLine MAX541 USBDevice
Diff: main.cpp
- Revision:
- 6:dc823dc85234
- Parent:
- 5:82037e281451
- Child:
- 7:bf501f8cb637
--- a/main.cpp Thu Jun 20 00:26:29 2019 +0000 +++ b/main.cpp Thu Jun 20 22:02:25 2019 +0000 @@ -31,74 +31,6 @@ ******************************************************************************* */ -//---------------------------------------------------------------------- -// mbed-os compatability tests... -//---------------------------------------------------------------------- -// mbed-os-5.12: buildable; warnings -// -// Not supported by MAX32625MBED... better stick with mbed-os-5.11 for now. -// Watch out for conflict with USBDevice library. -// Now that USBSerial is part of the official mbed-os-5.12 API, -// remove the external USBDevice library if present: -// mbed remove USBDevice -// -// cd mbed-os ; mbed update mbed-os-5.12 ; cd ..; mbed remove USBDevice -//---------------------------------------------------------------------- -// mbed-os-5.11: buildable; warnings -// -// fixed: format '%d' expects argument of type 'int', but argument _ has type 'uint32_t {aka long unsigned int}' [-Wformat=] -// fixed: 'static osStatus rtos::Thread::wait(uint32_t)' is deprecated: Static methods only affecting current thread cause confusion. Replaced by ThisThread::sleep_for. [since mbed-os-5.10] [-Wdeprecated-declarations] -// -// prior to mbed-os-5.12, USBSerial required an external library: -// mbed add https://developer.mbed.org/teams/MaximIntegrated/code/USBDevice/ -// -// cd mbed-os ; mbed update mbed-os-5.11 -// cd .. ; mbed sync -//---------------------------------------------------------------------- -// mbed-os-5.10 buildable; warning about wait function -// 'static osStatus rtos::Thread::wait(uint32_t)' is deprecated: Static methods only affecting current thread cause confusion. Replaced by ThisThread::sleep_for. [since mbed-os-5.10] [-Wdeprecated-declarations] -// -// prior to mbed-os-5.12, USBSerial required an external library: -// mbed add https://developer.mbed.org/teams/MaximIntegrated/code/USBDevice/ -// -// cd mbed-os ; mbed update mbed-os-5.10 -// cd .. ; mbed sync -//---------------------------------------------------------------------- -// mbed-os-5.9 buildable -// -// prior to mbed-os-5.12, USBSerial required an external library: -// mbed add https://developer.mbed.org/teams/MaximIntegrated/code/USBDevice/ -// -// cd mbed-os ; mbed update mbed-os-5.9 -// cd .. ; mbed sync -//---------------------------------------------------------------------- -// mbed-os-5.8 buildable -// -// prior to mbed-os-5.12, USBSerial required an external library: -// mbed add https://developer.mbed.org/teams/MaximIntegrated/code/USBDevice/ -// -// cd mbed-os ; mbed update mbed-os-5.8 -// cd .. ; mbed sync -//--------------------------------------------------------------------- -// mbed-os-5.7 buildable -// -// prior to mbed-os-5.12, USBSerial required an external library: -// mbed add https://developer.mbed.org/teams/MaximIntegrated/code/USBDevice/ -// -// cd mbed-os ; mbed update mbed-os-5.7 -// cd .. ; mbed sync -//---------------------------------------------------------------------- -// mbed-os-5.6 pass -// [Warning] USBSerial.h@59,203: 'mbed::FunctionPointerArg1<R, void>::FunctionPointerArg1(R (*)()) [with R = void]' is deprecated: FunctionPointer has been replaced by Callback<void()> [since mbed-os-5.1] [-Wdeprecated-declarations] -// [Warning] USBSerial.h@134,27: 'void mbed::Callback<R()>::attach(R (*)()) [with R = void]' is deprecated: Replaced by simple assignment 'Callback cb = func [since mbed-os-5.4] [-Wdeprecated-declarations] -// -// prior to mbed-os-5.12, USBSerial required an external library: -// mbed add https://developer.mbed.org/teams/MaximIntegrated/code/USBDevice/ -// -// cd mbed-os ; mbed update mbed-os-5.6 -// cd .. ; mbed sync -//---------------------------------------------------------------------- - // Test fixture and application menu for breakout boards: // - MAX5715BOB // - MAX11131BOB @@ -756,12 +688,6 @@ void on_immediate_0x7b(); // Unicode (U+007B) { LEFT CURLY BRACKET void on_immediate_0x7d(); // Unicode (U+007D) } RIGHT CURLY BRACKET -//-------------------------------------------------- -// Option to process command buffer from microUSBserial or DAPLINKserial -#ifndef USE_COMMAND_BUFFER -#define USE_COMMAND_BUFFER 1 -#endif -#if USE_COMMAND_BUFFER #include "CmdLine.h" # if HAS_DAPLINK_SERIAL @@ -773,7 +699,6 @@ CmdLine cmdLine_microUSBserial(microUSBserial, "microUSB"); # endif // HAS_MICROUSBSERIAL -#endif // USE_COMMAND_BUFFER //-------------------------------------------------- // tolerate AT commands, which may be sent during probe, such as: @@ -1254,294 +1179,6 @@ // uncrustify-0.66.1 *INDENT-OFF* //-------------------------------------------------- -// Declare the PwmOut driver -// Optional PwmOut support. If there is only one it should be pwmDriver1. -// P) PWM pin#, duty cycle -#if defined(TARGET_MAX32630) -// +-------------[microUSB]-------------+ -// | J1 MAX32630FTHR J2 | -// | [ ] RST GND [ ] | -// | [ ] 3V3 BAT+[ ] | -// | [ ] 1V8 reset SW1 | -// | [ ] GND J4 J3 | -// | [ ] AIN_0 1.2Vfs (bat) SYS [ ] | -// | [ ] AIN_1 1.2Vfs PWR [ ] | -// | [ ] AIN_2 1.2Vfs +5V VBUS [ ] | -// | [ ] AIN_3 1.2Vfs 1-WIRE P4_0 [x] | pwm4 -// | [ ] P5_7 SDA2 SRN P5_6 [x] | pwm5 -// | [ ] P6_0 SCL2 SDIO3 P5_5 [x] | pwm6 -// pwm13 | [ ] P5_0 SCLK SDIO2 P5_4 [x] | pwm7 -// pwm14 | [ ] P5_1 MOSI SSEL P5_3 [x] | pwm8 -// pwm3 | [x] P5_2 MISO RTS P3_3 [x] | pwm9 -// pwm2 | [x] P3_0 RX CTS P3_2 [ ] | pwm10 -// pwm1 | [x] P3_1 TX SCL P3_5 [ ] | pwm11 -// | [ ] GND SDA P3_4 [ ] | pwm12 -// +------------------------------------+ -// MAX32630FTHR mbed PwmOut driver is limited to 32-bit counter value; -// see pwmout_update function in mbed-os/targets/TARGET_Maxim/TARGET_MAX32630/pwmout_api.c -// int div = (obj->period * (SystemCoreClock / 1000000))/32; -#if HAS_SPI -// avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut - #define HAS_pwmDriver13 0 // P5_0 PT8 TARGET_MAX32630 J1.11 pass ok; conflict PT8 P3_0 P5_0 - #define HAS_pwmDriver14 0 // P5_1 PT9 TARGET_MAX32630 J1.12 pass ok; conflict PT9 P3_1 P5_1 - #define HAS_pwmDriver3 0 // P5_2 PT10 TARGET_MAX32630 J1.13 pass ok; conflict PT10 P3_2 P5_2 - #define HAS_pwmDriver2 0 // P3_0 PT8 TARGET_MAX32630 J1.14 pass ok; conflict PT8 P3_0 P5_0 -#endif -// #define HAS_pwmDriver0 0 // not assigned -# ifndef HAS_pwmDriver1 - //~ #define HAS_pwmDriver1 1 // P3_1 PT9 TARGET_MAX32630 J1.15 pass ok; conflict PT9 P3_1 P5_1 -# endif -# ifndef HAS_pwmDriver2 - #define HAS_pwmDriver2 1 // P3_0 PT8 TARGET_MAX32630 J1.14 pass ok; conflict PT8 P3_0 P5_0 -# endif -# ifndef HAS_pwmDriver3 - #define HAS_pwmDriver3 1 // P5_2 PT10 TARGET_MAX32630 J1.13 pass ok; conflict PT10 P3_2 P5_2 -# endif -# ifndef HAS_pwmDriver4 - //~ #define HAS_pwmDriver4 1 // P4_0 PT0 TARGET_MAX32630 J3.4 pass ok -# endif -# ifndef HAS_pwmDriver5 - //~ #define HAS_pwmDriver5 1 // P5_6 PT14 TARGET_MAX32630 J3.5 pass ok -# endif -# ifndef HAS_pwmDriver6 - //~ #define HAS_pwmDriver6 1 // P5_5 PT13 TARGET_MAX32630 J3.6 pass ok; conflict PT13 P3_5 P5_5 -# endif -# ifndef HAS_pwmDriver7 - //~ #define HAS_pwmDriver7 1 // P5_4 PT12 TARGET_MAX32630 J3.7 pass ok; conflict PT12 P3_4 P5_4 -# endif -# ifndef HAS_pwmDriver8 - //~ #define HAS_pwmDriver8 1 // P5_3 PT11 TARGET_MAX32630 J3.8 pass ok; conflict PT11 P3_3 P5_3 -# endif -# ifndef HAS_pwmDriver9 -// #define HAS_pwmDriver9 1 // P3_3 PT11 TARGET_MAX32630 J3.9 pass ok; conflict PT11 P3_3 P5_3 -# endif -# ifndef HAS_pwmDriver10 -// #define HAS_pwmDriver10 1 // P3_2 PT10 TARGET_MAX32630 J3.10 pass ok; conflict PT10 P3_2 P5_2 -# endif -# ifndef HAS_pwmDriver11 -// #define HAS_pwmDriver11 1 // P3_5 PT13 TARGET_MAX32630 J3.11 pass ok; conflict PT13 P3_5 P5_5 -# endif -# ifndef HAS_pwmDriver12 -// #define HAS_pwmDriver12 1 // P3_4 PT12 TARGET_MAX32630 J3.12 pass ok; conflict PT12 P3_4 P5_4 -# endif -# ifndef HAS_pwmDriver13 -// #define HAS_pwmDriver13 1 // P5_0 PT8 TARGET_MAX32630 J1.11 pass ok; conflict PT8 P3_0 P5_0 -# endif -# ifndef HAS_pwmDriver14 -// #define HAS_pwmDriver14 1 // P5_1 PT9 TARGET_MAX32630 J1.12 pass ok; conflict PT9 P3_1 P5_1 -# endif -# ifndef HAS_pwmDriver15 -// #define HAS_pwmDriver15 0 // not assigned -# endif -#if HAS_pwmDriver0 - PwmOut pwmDriver0(____); // not assigned -#endif -#if HAS_pwmDriver1 - PwmOut pwmDriver1(P3_1); // PT9 TARGET_MAX32630 J1.15 pass ok -// Investigating which TARGET_MAX32630 PWM drivers work. -// fail assert = runtime failure at system boot, as the only pwm pin -// pass? = no runtime failure as the only pwm pin, may be ok -// pass ok = plays well with others -// PT0..PT15 identify which Pulse Train resource drives that GPIO pin - //PwmOut pwmDriver1(P5_7); // P5_7 PT15 TARGET_MAX32630 J1.9 fail assert; resource conflict - //PwmOut pwmDriver1(P6_0); // P6_0 PT0 TARGET_MAX32630 J1.10 fail assert; resource conflict - //PwmOut pwmDriver1(P5_0); // P5_0 PT8 TARGET_MAX32630 J1.11 pass ok; conflict PT8 P3_0 P5_0 - //PwmOut pwmDriver1(P5_1); // P5_1 PT9 TARGET_MAX32630 J1.12 pass ok; conflict PT9 P3_1 P5_1 - //PwmOut pwmDriver1(P5_2); // P5_2 PT10 TARGET_MAX32630 J1.13 pass ok; conflict PT10 P3_2 P5_2 - //PwmOut pwmDriver1(P3_0); // P3_0 PT8 TARGET_MAX32630 J1.14 pass ok; conflict PT8 P3_0 P5_0 - //PwmOut pwmDriver1(P3_1); // P3_1 PT9 TARGET_MAX32630 J1.15 pass ok; conflict PT9 P3_1 P5_1 - // - //PwmOut pwmDriver1(P4_0); // P4_0 PT0 TARGET_MAX32630 J3.4 pass ok - //PwmOut pwmDriver1(P5_6); // P5_6 PT14 TARGET_MAX32630 J3.5 pass ok - //PwmOut pwmDriver1(P5_5); // P5_5 PT13 TARGET_MAX32630 J3.6 pass ok; conflict PT13 P3_5 P5_5 - //PwmOut pwmDriver1(P5_4); // P5_4 PT12 TARGET_MAX32630 J3.7 pass ok; conflict PT12 P3_4 P5_4 - //PwmOut pwmDriver1(P5_3); // P5_3 PT11 TARGET_MAX32630 J3.8 pass ok; conflict PT11 P3_3 P5_3 - //PwmOut pwmDriver1(P3_3); // P3_3 PT11 TARGET_MAX32630 J3.9 pass ok; conflict PT11 P3_3 P5_3 - //PwmOut pwmDriver1(P3_2); // P3_2 PT10 TARGET_MAX32630 J3.10 pass ok; conflict PT10 P3_2 P5_2 - //PwmOut pwmDriver1(P3_5); // P3_5 PT13 TARGET_MAX32630 J3.11 pass ok; conflict PT13 P3_5 P5_5 - //PwmOut pwmDriver1(P3_4); // P3_4 PT12 TARGET_MAX32630 J3.12 pass ok; conflict PT12 P3_4 P5_4 -#endif -#if HAS_pwmDriver2 - PwmOut pwmDriver2(P3_0); // P3_0 PT8 TARGET_MAX32630 J1.14 pass ok; conflict PT8 P3_0 P5_0 -#endif -#if HAS_pwmDriver3 - PwmOut pwmDriver3(P5_2); // P5_2 PT10 TARGET_MAX32630 J1.13 pass ok; conflict PT10 P3_2 P5_2 -#endif -#if HAS_pwmDriver4 - PwmOut pwmDriver4(P4_0); // P4_0 PT0 TARGET_MAX32630 J3.4 pass ok -#endif -#if HAS_pwmDriver5 - PwmOut pwmDriver5(P5_6); // P5_6 PT14 TARGET_MAX32630 J3.5 pass ok -#endif -#if HAS_pwmDriver6 - PwmOut pwmDriver6(P5_5); // P5_5 PT13 TARGET_MAX32630 J3.6 pass ok; conflict PT13 P3_5 P5_5 -#endif -#if HAS_pwmDriver7 - PwmOut pwmDriver7(P5_4); // P5_4 PT12 TARGET_MAX32630 J3.7 pass ok; conflict PT12 P3_4 P5_4 -#endif -#if HAS_pwmDriver8 - PwmOut pwmDriver8(P5_3); // P5_3 PT11 TARGET_MAX32630 J3.8 pass ok; conflict PT11 P3_3 P5_3 -#endif -#if HAS_pwmDriver9 - PwmOut pwmDriver9(P3_3); // P3_3 PT11 TARGET_MAX32630 J3.9 pass ok; conflict PT11 P3_3 P5_3 -#endif -#if HAS_pwmDriver10 - PwmOut pwmDriver10(P3_2); // P3_2 PT10 TARGET_MAX32630 J3.10 pass ok; conflict PT10 P3_2 P5_2 -#endif -#if HAS_pwmDriver11 - PwmOut pwmDriver11(P3_5); // P3_5 PT13 TARGET_MAX32630 J3.11 pass ok; conflict PT13 P3_5 P5_5 -#endif -#if HAS_pwmDriver12 - PwmOut pwmDriver12(P3_4); // P3_4 PT12 TARGET_MAX32630 J3.12 pass ok; conflict PT12 P3_4 P5_4 -#endif -#if HAS_pwmDriver13 - PwmOut pwmDriver13(P5_0); // P5_0 PT8 TARGET_MAX32630 J1.11 pass ok; conflict PT8 P3_0 P5_0 -#endif -#if HAS_pwmDriver14 - PwmOut pwmDriver14(P5_1); // P5_1 PT9 TARGET_MAX32630 J1.12 pass ok; conflict PT9 P3_1 P5_1 -#endif -#if HAS_pwmDriver15 - PwmOut pwmDriver15(____); // not assigned -#endif -//-------------------------------------------------- -#elif defined(TARGET_MAX32625MBED) -//-------------------------------------------------- -// TODO1: pwmDriver TARGET=MAX32625MBED ARM Cortex-M4F 96MHz 512kB Flash 160kB SRAM -#elif defined(TARGET_LPC1768) -// TARGET=LPC1768 ARM Cortex-M3 100 MHz 512kB flash 64kB SRAM -// +-------------[microUSB]-------------+ -// ______ | [ ] GND +3.3V VOUT [ ] | -// ______ | [ ] 4.5V<VIN<9.0V +5.0V VU [ ] | -// ______ | [ ] VB USB.IF- [ ] | -// ______ | [ ] nR USB.IF+ [ ] | -// ______ | [ ] p5 MOSI ETHERNET.RD- [ ] | -// ______ | [ ] p6 MISO ETHERNET.RD+ [ ] | -// ______ | [ ] p7 SCLK ETHERNET.TD- [ ] | -// ______ | [ ] p8 ETHERNET.TD+ [ ] | -// ______ | [ ] p9 TX SDA USB.D- [ ] | -// ______ | [ ] p10 RX SCL USB.D+ [ ] | -// ______ | [ ] p11 MOSI CAN-RD p30 [ ] | -// ______ | [ ] p12 MISO CAN-TD p29 [ ] | -// ______ | [ ] p13 TX SCLK SDA TX p28 [ ] | -// ______ | [ ] p14 RX SCL RX p27 [ ] | -// ______ | [ ] p15 AIN0 3.3Vfs PWM1 p26 [ ] | pwmDriver1 -// ______ | [ ] p16 AIN1 3.3Vfs PWM2 p25 [ ] | pwmDriver2 -// ______ | [ ] p17 AIN2 3.3Vfs PWM3 p24 [ ] | pwmDriver3 -// ______ | [ ] p18 AIN3 AOUT PWM4 p23 [ ] | pwmDriver4 -// ______ | [ ] p19 AIN4 3.3Vfs PWM5 p22 [ ] | pwmDriver5 -// ______ | [ ] p20 AIN5 3.3Vfs PWM6 p21 [ ] | pwmDriver6 -// +------------------------------------+ -// #define HAS_pwmDriver0 1 -# ifndef HAS_pwmDriver1 - #define HAS_pwmDriver1 1 -# endif -# ifndef HAS_pwmDriver2 - #define HAS_pwmDriver2 1 -# endif -# ifndef HAS_pwmDriver3 - #define HAS_pwmDriver3 1 -# endif -# ifndef HAS_pwmDriver4 - #define HAS_pwmDriver4 1 -# endif -# ifndef HAS_pwmDriver5 - #define HAS_pwmDriver5 1 -# endif -# ifndef HAS_pwmDriver6 - #define HAS_pwmDriver6 1 -# endif -# ifndef HAS_pwmDriver7 -// #define HAS_pwmDriver7 1 -# endif -# ifndef HAS_pwmDriver8 -// #define HAS_pwmDriver8 1 -# endif -# ifndef HAS_pwmDriver9 -// #define HAS_pwmDriver9 1 -# endif -# ifndef HAS_pwmDriver10 -// #define HAS_pwmDriver10 1 -# endif -# ifndef HAS_pwmDriver11 -// #define HAS_pwmDriver11 1 -# endif -# ifndef HAS_pwmDriver12 -// #define HAS_pwmDriver12 1 -# endif -# ifndef HAS_pwmDriver13 -// #define HAS_pwmDriver13 1 -# endif -# ifndef HAS_pwmDriver14 -// #define HAS_pwmDriver14 1 -# endif -# ifndef HAS_pwmDriver15 -// #define HAS_pwmDriver15 1 -# endif -#if HAS_pwmDriver0 - PwmOut pwmDriver0(____); // not assigned -#endif -#if HAS_pwmDriver1 - PwmOut pwmDriver1(p26); // TARGET_LPC1768 P2.0/PWM1.1/TXD1/TRACECLK -#endif -#if HAS_pwmDriver2 - PwmOut pwmDriver2(p25); // TARGET_LPC1768 P2.1/PWM1.2/RXD1 -#endif -#if HAS_pwmDriver3 - PwmOut pwmDriver3(p24); // TARGET_LPC1768 P2.2/PWM1.3/CTS1/TRACEDATA3 -#endif -#if HAS_pwmDriver4 - PwmOut pwmDriver4(p23); // TARGET_LPC1768 P2.3/PWM1.4/DCD1/TRACEDATA2 -#endif -#if HAS_pwmDriver5 - PwmOut pwmDriver5(p22); // TARGET_LPC1768 P2.4/PWM1.5/DSR1/TRACEDATA1 -#endif -#if HAS_pwmDriver6 - PwmOut pwmDriver6(p21); // TARGET_LPC1768 P2.5/PWM1.6/DTR1/TRACEDATA0 -#endif -#if HAS_pwmDriver7 - PwmOut pwmDriver7(____); // not assigned -#endif -#if HAS_pwmDriver8 - PwmOut pwmDriver8(____); // not assigned -#endif -#if HAS_pwmDriver9 - PwmOut pwmDriver9(____); // not assigned -#endif -#if HAS_pwmDriver10 - PwmOut pwmDriver10(____); // not assigned -#endif -#if HAS_pwmDriver11 - PwmOut pwmDriver11(____); // not assigned -#endif -#if HAS_pwmDriver12 - PwmOut pwmDriver12(____); // not assigned -#endif -#if HAS_pwmDriver13 - PwmOut pwmDriver13(____); // not assigned -#endif -#if HAS_pwmDriver14 - PwmOut pwmDriver14(____); // not assigned -#endif -#if HAS_pwmDriver15 - PwmOut pwmDriver15(____); // not assigned -#endif -#else - // unknown target -#endif -// uncrustify-0.66.1 *INDENT-ON* -#if HAS_pwmDriver0 || HAS_pwmDriver1 \ - || HAS_pwmDriver2 || HAS_pwmDriver3 \ - || HAS_pwmDriver4 || HAS_pwmDriver5 \ - || HAS_pwmDriver6 || HAS_pwmDriver7 \ - || HAS_pwmDriver8 || HAS_pwmDriver9 \ - || HAS_pwmDriver10 || HAS_pwmDriver11 \ - || HAS_pwmDriver12 || HAS_pwmDriver13 \ - || HAS_pwmDriver14 || HAS_pwmDriver15 -#define HAS_pwmDrivers 1 -#endif - -// uncrustify-0.66.1 *INDENT-OFF* -//-------------------------------------------------- // Declare the AnalogIn driver // Optional analogIn support. If there is only one it should be analogIn1. // A) analog input @@ -1771,23 +1408,6 @@ #endif //-------------------------------------------------- -// Diagnostic: scope trigger -//#define SCOPE_TRIG_PIN p11 -//#ifdef SCOPE_TRIG_PIN -//# if defined(TARGET_MAX32630) -// // TARGET=MAX32630 -// DigitalOut scopeTrigPinP11(P3_1, 1); -// DigitalOut scopePinP12(P3_0, 1); -//# elif defined(TARGET_LPC1768) -// // TARGET=LPC1768 -// DigitalOut scopeTrigPinP11(p11, 1); -// DigitalOut scopePinP12(p12, 1); -//# else -// // unknown target -//# endif -//#endif - -//-------------------------------------------------- // Option to use LEDs to show status #ifndef USE_LEDS #define USE_LEDS 1 @@ -1942,45 +1562,6 @@ #endif -#if APPLICATION_MAX5715 // hardware interface functions -//---------------------------------------- -// User-provided hardware function -// declare user-provided hardware interface function drive MAX5717_LDACb_Pin LDAC# -// drive LDAC# Active-Low Asynchronous Load DAC Input for MAX5715 -// -//void GPIOoutputLDACb(int isLogicHigh) -//{ -// digitalInOut9.output(); -// digitalInOut9.write(isLogicHigh); -// -//#if HAS_MICROUSBSERIAL -// cmdLine_microUSBserial.serial().printf(" digitalInOutPin 9 Output %d ", isLogicHigh); -//#endif -//#if HAS_DAPLINK_SERIAL -// cmdLine_DAPLINKserial.serial().printf(" digitalInOutPin 9 Output %d ", isLogicHigh); -//#endif -//} - -//---------------------------------------- -// User-provided hardware function -// declare user-provided hardware interface function drive MAX5717_CLRb_Pin CLR# -// drive CLR# Active-Low Clear Input for MAX5715 -// -//void GPIOoutputCLRb(int isLogicHigh) -//{ -// digitalInOut8.output(); -// digitalInOut8.write(isLogicHigh); -// -//#if HAS_MICROUSBSERIAL -// cmdLine_microUSBserial.serial().printf(" digitalInOutPin 8 Output %d ", isLogicHigh); -//#endif -//#if HAS_DAPLINK_SERIAL -// cmdLine_DAPLINKserial.serial().printf(" digitalInOutPin 8 Output %d ", isLogicHigh); -//#endif -//} -#endif - - #if APPLICATION_MAX11131 // hardware interface functions //---------------------------------------- void print_value(CmdLine& cmdLine, int16_t value_u12, int channelId) @@ -2264,310 +1845,6 @@ } cmdLine.serial().printf("\r\n"); } - -//---------------------------------------- -// User-provided hardware function -// declare user-provided hardware interface function -// Assert CNVST convert start. -// Required when using any of the InternalClock modes with SWCNV 0. -// Trigger measurement by driving CNVST/AIN14 pin low for a minimum active-low pulse duration of 5ns. (AIN14 is not available) -// -//void CNVSToutputPulseLow() -//{ -// digitalInOut9.output(); -// digitalInOut9.write(0); -// // CNVST active-low pulse duration must be 5ns (0.005us) minimum. -// digitalInOut9.write(1); -// -//#if HAS_MICROUSBSERIAL -// cmdLine_microUSBserial.serial().printf(" CNVSToutputPulseLow "); -//#endif -//#if HAS_DAPLINK_SERIAL -// cmdLine_DAPLINKserial.serial().printf(" CNVSToutputPulseLow "); -//#endif -//} - -//---------------------------------------- -// User-provided hardware function -// declare user-provided hardware interface function -// Wait for EOC pin low, indicating end of conversion. -// Required when using any of the InternalClock modes. -// -//void EOCinputWaitUntilLow() -//{ -// // -// // Arduino: pulseIn(pinIndex, HIGH | LOW, timeout_usec) // length of pulse in usec, or 0 if timeout -// // -// // const int timeout_usec = 1000; -// // TODO1: implement EOCinputWaitUntilLow APPLICATION_MAX11131 -// // similar to Arduino pulseIn(MAX11131_EOC_Pin, LOW, timeout_usec); -//#if HAS_MICROUSBSERIAL -// cmdLine_microUSBserial.serial().printf(" EOCinputWaitUntilLow "); -//#endif -//#if HAS_DAPLINK_SERIAL -// cmdLine_DAPLINKserial.serial().printf(" EOCinputWaitUntilLow "); -//#endif -//} - -//---------------------------------------- -// User-provided hardware function -// declare user-provided hardware interface function -// Assert SPI Chip Select -// SPI chip-select for MAX5715 -// -//void SPIoutputCS(int isLogicHigh) -//{ -// g_SPI_cs_state = isLogicHigh; -// spi_cs = g_SPI_cs_state; -//} - -//---------------------------------------- -// User-provided hardware function -// declare user-provided hardware interface function SPI write 16 bits -// SPI interface to MAX11131 shift 16 bits mosiData16 into MAX11131 DIN -// ignoring MAX11131 DOUT -//void SPIwrite16bits(int16_t mosiData16) -//{ -// // TODO1: implement SPIwrite16bits -// size_t byteCount = 2; -// static char mosiData[2]; -// static char misoData[2]; -// mosiData[0] = (char)((mosiData16 >> 8) & 0xFF); // MSByte -// mosiData[1] = (char)((mosiData16 >> 0) & 0xFF); // LSByte -// // -// // Arduino: begin critical section: noInterrupts() masks all interrupt sources; end critical section with interrupts() -// //~ noInterrupts(); -// // -// //~ digitalWrite(Scope_Trigger_Pin, LOW); // diagnostic Scope_Trigger_Pin -// // -// unsigned int numBytesTransferred = spi.write(mosiData, byteCount, misoData, byteCount); -// //~ SPI.transfer(mosiData8_FF0000); -// //~ SPI.transfer(mosiData16_00FF00); -// //~ SPI.transfer(mosiData16_0000FF); -// // -// //~ digitalWrite(Scope_Trigger_Pin, HIGH); // diagnostic Scope_Trigger_Pin -// // -// // Arduino: begin critical section: noInterrupts() masks all interrupt sources; end critical section with interrupts() -// //~ interrupts(); -// // -// // VERIFY: SPIwrite24bits print diagnostic information -// //cmdLine.serial().printf(" MOSI->")); -// //cmdLine.serial().printf(" 0x")); -// //Serial.print( (mosiData8_FF0000 & 0xFF), HEX); -// //cmdLine.serial().printf(" 0x")); -// //Serial.print( (mosiData16_00FF00 & 0xFF), HEX); -// //cmdLine.serial().printf(" 0x")); -// //Serial.print( (mosiData16_0000FF & 0xFF), HEX); -// // hex dump mosiData[0..byteCount-1] -//#if HAS_MICROUSBSERIAL -// cmdLine_microUSBserial.serial().printf("\r\nSPI"); -// if (byteCount > 7) { -// cmdLine_microUSBserial.serial().printf(" byteCount:%d", byteCount); -// } -// cmdLine_microUSBserial.serial().printf(" MOSI->"); -// for (unsigned int byteIndex = 0; byteIndex < byteCount; byteIndex++) -// { -// cmdLine_microUSBserial.serial().printf(" 0x%2.2X", mosiData[byteIndex]); -// } -// // hex dump misoData[0..byteCount-1] -// cmdLine_microUSBserial.serial().printf(" MISO<-"); -// for (unsigned int byteIndex = 0; byteIndex < numBytesTransferred; byteIndex++) -// { -// cmdLine_microUSBserial.serial().printf(" 0x%2.2X", misoData[byteIndex]); -// } -// cmdLine_microUSBserial.serial().printf(" "); -//#endif -//#if HAS_DAPLINK_SERIAL -// cmdLine_DAPLINKserial.serial().printf("\r\nSPI"); -// if (byteCount > 7) { -// cmdLine_DAPLINKserial.serial().printf(" byteCount:%d", byteCount); -// } -// cmdLine_DAPLINKserial.serial().printf(" MOSI->"); -// for (unsigned int byteIndex = 0; byteIndex < byteCount; byteIndex++) -// { -// cmdLine_DAPLINKserial.serial().printf(" 0x%2.2X", mosiData[byteIndex]); -// } -// // hex dump misoData[0..byteCount-1] -// cmdLine_DAPLINKserial.serial().printf(" MISO<-"); -// for (unsigned int byteIndex = 0; byteIndex < numBytesTransferred; byteIndex++) -// { -// cmdLine_DAPLINKserial.serial().printf(" 0x%2.2X", misoData[byteIndex]); -// } -// cmdLine_DAPLINKserial.serial().printf(" "); -//#endif -// // VERIFY: DIAGNOSTIC: print MAX5715 device register write -// // TODO: MAX5715_print_register_verbose(mosiData8_FF0000, mosiData16_00FFFF); -// // TODO: print_verbose_SPI_diagnostic(mosiData16_FF00, mosiData16_00FF, misoData16_FF00, misoData16_00FF); -// // -// // int misoData16 = (misoData16_FF00 << 8) | misoData16_00FF; -// // return misoData16; -//} - -//---------------------------------------- -// User-provided hardware function -// declare user-provided hardware interface function SPI write 17-24 bits -// SPI interface to MAX11131 shift 16 bits mosiData16 into MAX11131 DIN -// followed by one additional SCLK byte. -// ignoring MAX11131 DOUT -//void SPIwrite24bits(int16_t mosiData16_FFFF00, int8_t mosiData8_0000FF) -//{ -// // TODO1: implement SPIwrite24bits -// size_t byteCount = 3; -// static char mosiData[3]; -// static char misoData[3]; -// mosiData[0] = (char)((mosiData16_FFFF00 >> 8) & 0xFF); // MSByte -// mosiData[1] = (char)((mosiData16_FFFF00 >> 0) & 0xFF); // LSByte -// mosiData[2] = mosiData8_0000FF; -// // -// // Arduino: begin critical section: noInterrupts() masks all interrupt sources; end critical section with interrupts() -// //~ noInterrupts(); -// // -// //~ digitalWrite(Scope_Trigger_Pin, LOW); // diagnostic Scope_Trigger_Pin -// // -// unsigned int numBytesTransferred = spi.write(mosiData, byteCount, misoData, byteCount); -// //~ SPI.transfer(mosiData8_FF0000); -// //~ SPI.transfer(mosiData16_00FF00); -// //~ SPI.transfer(mosiData16_0000FF); -// // -// //~ digitalWrite(Scope_Trigger_Pin, HIGH); // diagnostic Scope_Trigger_Pin -// // -// // Arduino: begin critical section: noInterrupts() masks all interrupt sources; end critical section with interrupts() -// //~ interrupts(); -// // -// // VERIFY: SPIwrite24bits print diagnostic information -// //cmdLine.serial().printf(" MOSI->")); -// //cmdLine.serial().printf(" 0x")); -// //Serial.print( (mosiData8_FF0000 & 0xFF), HEX); -// //cmdLine.serial().printf(" 0x")); -// //Serial.print( (mosiData16_00FF00 & 0xFF), HEX); -// //cmdLine.serial().printf(" 0x")); -// //Serial.print( (mosiData16_0000FF & 0xFF), HEX); -// // hex dump mosiData[0..byteCount-1] -//#if HAS_MICROUSBSERIAL -// cmdLine_microUSBserial.serial().printf("\r\nSPI"); -// if (byteCount > 7) { -// cmdLine_microUSBserial.serial().printf(" byteCount:%d", byteCount); -// } -// cmdLine_microUSBserial.serial().printf(" MOSI->"); -// for (unsigned int byteIndex = 0; byteIndex < byteCount; byteIndex++) -// { -// cmdLine_microUSBserial.serial().printf(" 0x%2.2X", mosiData[byteIndex]); -// } -// // hex dump misoData[0..byteCount-1] -// cmdLine_microUSBserial.serial().printf(" MISO<-"); -// for (unsigned int byteIndex = 0; byteIndex < numBytesTransferred; byteIndex++) -// { -// cmdLine_microUSBserial.serial().printf(" 0x%2.2X", misoData[byteIndex]); -// } -// cmdLine_microUSBserial.serial().printf(" "); -//#endif -//#if HAS_DAPLINK_SERIAL -// cmdLine_DAPLINKserial.serial().printf("\r\nSPI"); -// if (byteCount > 7) { -// cmdLine_DAPLINKserial.serial().printf(" byteCount:%d", byteCount); -// } -// cmdLine_DAPLINKserial.serial().printf(" MOSI->"); -// for (unsigned int byteIndex = 0; byteIndex < byteCount; byteIndex++) -// { -// cmdLine_DAPLINKserial.serial().printf(" 0x%2.2X", mosiData[byteIndex]); -// } -// // hex dump misoData[0..byteCount-1] -// cmdLine_DAPLINKserial.serial().printf(" MISO<-"); -// for (unsigned int byteIndex = 0; byteIndex < numBytesTransferred; byteIndex++) -// { -// cmdLine_DAPLINKserial.serial().printf(" 0x%2.2X", misoData[byteIndex]); -// } -// cmdLine_DAPLINKserial.serial().printf(" "); -//#endif -// // VERIFY: DIAGNOSTIC: print MAX5715 device register write -// // TODO: MAX5715_print_register_verbose(mosiData8_FF0000, mosiData16_00FFFF); -// // -// // int misoData16 = (misoData16_FF00 << 8) | misoData16_00FF; -// // return misoData16; -//} - -//---------------------------------------- -// User-provided hardware function -// declare user-provided hardware interface function SPI read 16 bits while MOSI (Maxim DIN) is 0 -// SPI interface to capture 16 bits miso data from MAX11131 DOUT -//int16_t SPIread16bits() -//{ -// // TODO1: implement SPIread16bits -// int mosiData16 = 0; -// size_t byteCount = 2; -// static char mosiData[2]; -// static char misoData[2]; -// mosiData[0] = (char)((mosiData16 >> 8) & 0xFF); // MSByte -// mosiData[1] = (char)((mosiData16 >> 0) & 0xFF); // LSByte -// // -// // Arduino: begin critical section: noInterrupts() masks all interrupt sources; end critical section with interrupts() -// //~ noInterrupts(); -// // -// //~ digitalWrite(Scope_Trigger_Pin, LOW); // diagnostic Scope_Trigger_Pin -// // -// unsigned int numBytesTransferred = spi.write(mosiData, byteCount, misoData, byteCount); -// //~ SPI.transfer(mosiData8_FF0000); -// //~ SPI.transfer(mosiData16_00FF00); -// //~ SPI.transfer(mosiData16_0000FF); -// // -// //~ digitalWrite(Scope_Trigger_Pin, HIGH); // diagnostic Scope_Trigger_Pin -// // -// // Arduino: begin critical section: noInterrupts() masks all interrupt sources; end critical section with interrupts() -// //~ interrupts(); -// // -// // VERIFY: SPIwrite24bits print diagnostic information -// //cmdLine.serial().printf(" MOSI->")); -// //cmdLine.serial().printf(" 0x")); -// //Serial.print( (mosiData8_FF0000 & 0xFF), HEX); -// //cmdLine.serial().printf(" 0x")); -// //Serial.print( (mosiData16_00FF00 & 0xFF), HEX); -// //cmdLine.serial().printf(" 0x")); -// //Serial.print( (mosiData16_0000FF & 0xFF), HEX); -// // hex dump mosiData[0..byteCount-1] -//#if HAS_MICROUSBSERIAL -// cmdLine_microUSBserial.serial().printf("\r\nSPI"); -// if (byteCount > 7) { -// cmdLine_microUSBserial.serial().printf(" byteCount:%d", byteCount); -// } -// cmdLine_microUSBserial.serial().printf(" MOSI->"); -// for (unsigned int byteIndex = 0; byteIndex < byteCount; byteIndex++) -// { -// cmdLine_microUSBserial.serial().printf(" 0x%2.2X", mosiData[byteIndex]); -// } -// // hex dump misoData[0..byteCount-1] -// cmdLine_microUSBserial.serial().printf(" MISO<-"); -// for (unsigned int byteIndex = 0; byteIndex < numBytesTransferred; byteIndex++) -// { -// cmdLine_microUSBserial.serial().printf(" 0x%2.2X", misoData[byteIndex]); -// } -// cmdLine_microUSBserial.serial().printf(" "); -//#endif -//#if HAS_DAPLINK_SERIAL -// cmdLine_DAPLINKserial.serial().printf("\r\nSPI"); -// if (byteCount > 7) { -// cmdLine_DAPLINKserial.serial().printf(" byteCount:%d", byteCount); -// } -// cmdLine_DAPLINKserial.serial().printf(" MOSI->"); -// for (unsigned int byteIndex = 0; byteIndex < byteCount; byteIndex++) -// { -// cmdLine_DAPLINKserial.serial().printf(" 0x%2.2X", mosiData[byteIndex]); -// } -// // hex dump misoData[0..byteCount-1] -// cmdLine_DAPLINKserial.serial().printf(" MISO<-"); -// for (unsigned int byteIndex = 0; byteIndex < numBytesTransferred; byteIndex++) -// { -// cmdLine_DAPLINKserial.serial().printf(" 0x%2.2X", misoData[byteIndex]); -// } -// cmdLine_DAPLINKserial.serial().printf(" "); -//#endif -// // VERIFY: DIAGNOSTIC: print MAX5715 device register write -// // TODO: MAX5715_print_register_verbose(mosiData8_FF0000, mosiData16_00FFFF); -// // TODO: print_verbose_SPI_diagnostic(mosiData16_FF00, mosiData16_00FF, misoData16_FF00, misoData16_00FF); -// // -// int misoData16 = (misoData[0] << 8) | misoData[1]; -// return misoData16; -//} - #endif @@ -3079,121 +2356,6 @@ }; #endif -// PwmOut pin resource: print the pin index names to microUSBserial -#if HAS_pwmDrivers -void list_pwmDriverPins(Stream& serialStream) -{ -#if HAS_pwmDriver0 - serialStream.printf(" 0"); -#endif -#if HAS_pwmDriver1 - serialStream.printf(" 1"); -#endif -#if HAS_pwmDriver2 - serialStream.printf(" 2"); -#endif -#if HAS_pwmDriver3 - serialStream.printf(" 3"); -#endif -#if HAS_pwmDriver4 - serialStream.printf(" 4"); -#endif -#if HAS_pwmDriver5 - serialStream.printf(" 5"); -#endif -#if HAS_pwmDriver6 - serialStream.printf(" 6"); -#endif -#if HAS_pwmDriver7 - serialStream.printf(" 7"); -#endif -#if HAS_pwmDriver8 - serialStream.printf(" 8"); -#endif -#if HAS_pwmDriver9 - serialStream.printf(" 9"); -#endif -#if HAS_pwmDriver10 - serialStream.printf(" a"); -#endif -#if HAS_pwmDriver11 - serialStream.printf(" b"); -#endif -#if HAS_pwmDriver12 - serialStream.printf(" c"); -#endif -#if HAS_pwmDriver13 - serialStream.printf(" d"); -#endif -#if HAS_pwmDriver14 - serialStream.printf(" e"); -#endif -#if HAS_pwmDriver15 - serialStream.printf(" f"); -#endif -} -#endif - -// PwmOut pin resource: present? -#if HAS_pwmDrivers -bool has_pwmDriverPin(int cPinIndex) -{ - switch (cPinIndex) - { -#if HAS_pwmDriver0 - case '0': case 0x00: return true; -#endif -#if HAS_pwmDriver1 - case '1': case 0x01: return true; -#endif -#if HAS_pwmDriver2 - case '2': case 0x02: return true; -#endif -#if HAS_pwmDriver3 - case '3': case 0x03: return true; -#endif -#if HAS_pwmDriver4 - case '4': case 0x04: return true; -#endif -#if HAS_pwmDriver5 - case '5': case 0x05: return true; -#endif -#if HAS_pwmDriver6 - case '6': case 0x06: return true; -#endif -#if HAS_pwmDriver7 - case '7': case 0x07: return true; -#endif -#if HAS_pwmDriver8 - case '8': case 0x08: return true; -#endif -#if HAS_pwmDriver9 - case '9': case 0x09: return true; -#endif -#if HAS_pwmDriver10 - case 'a': case 0x0a: return true; -#endif -#if HAS_pwmDriver11 - case 'b': case 0x0b: return true; -#endif -#if HAS_pwmDriver12 - case 'c': case 0x0c: return true; -#endif -#if HAS_pwmDriver13 - case 'd': case 0x0d: return true; -#endif -#if HAS_pwmDriver14 - case 'e': case 0x0e: return true; -#endif -#if HAS_pwmDriver15 - case 'f': case 0x0f: return true; -#endif - default: - return false; - } -} -#endif - #if HAS_I2C // SUPPORT_I2C //-------------------------------------------------- // Search I2C device address list @@ -4490,9 +3652,6 @@ { cmdLine.serial().printf(" [%s]", cmdLine.nameStr()); } -#if USE_COMMAND_BUFFER - //cmdLine.serial().printf(" [USE_COMMAND_BUFFER]"); -#endif #if HAS_BUTTON1_DEMO_INTERRUPT cmdLine.serial().printf(" [Button1=DemoConfig1]"); #endif @@ -4566,16 +3725,6 @@ cmdLine.serial().printf("\r\n %%D -- DAC output MAX541 (SPI2)"); #endif -#if HAS_pwmDrivers - // Menu P) PWM D3|5|6|9|10|11, Output 0..255 - // %Ppin df=xx -- pwm output - cmdLine.serial().printf("\r\n %%P {High|Low|.|>|<|S|F} 0..255, {pin: *"); - // analogWrite(analogOutPin, outputValue_0_255) // PWM digital output 0..255: analogWrite works on digital pins 3, 5, 6, 9, 10, and 11. Frequency is 490 Hz except pins 5 and 6 are 980 Hz. - //cmdLine.serial().printf("\r\n P) pwmDriver {High|Low|.|>|<|S|F} {pin: *"); - list_pwmDriverPins(cmdLine.serial()); - cmdLine.serial().printf("} -- PWM Output"); -#endif - #if HAS_I2C // SUPPORT_I2C // TODO: support I2C HAS_I2C // SUPPORT_I2C // VERIFY: I2C utility commands SUPPORT_I2C @@ -4749,7 +3898,6 @@ //-------------------------------------------------- // main menu command-line parser // invoked by CmdLine::append(char ch) or CmdLine::idleAppendIfReadable() -#if USE_COMMAND_BUFFER void main_menu_onEOLcommandParser(CmdLine & cmdLine) { // DIAGNOSTIC: print line buffer @@ -4997,22 +4145,6 @@ #endif // -#if HAS_pwmDrivers - case 'P': case 'p': - { - // %Ppin df=xx -- pwm output - } - break; -#endif - // -#if 0 // HAS_pwmDrivers - case 'W': - case 'w': - // %Wpin -- measure high pulsewidth input in usec - // %wpin -- measure low pulsewidth input in usec - break; -#endif - // #if HAS_I2C // SUPPORT_I2C case 'I': case 'i': // %I... -- I2C diagnostics @@ -6809,40 +5941,6 @@ break; #endif // APPLICATION_MAX12345 -//#if IGNORE_AT_COMMANDS -// // tolerate AT commands, which may be sent during probe -// // "AT\r" -// // "AT+CGMI\r" -- request manufacturer identification AT+CMGI=? -// // "AT+CGMM\r" -- request manufacturer model -// // "AT%IPSYS?\r" -// // "ATE0\r" -- echo disable -// // "ATV1\r" -- verbose result codes OK | ERROR | NO CARRIER -// // menu_main() ignore_until_line_end: AT -// // menu_main() ignore_until_line_end: AT+CGMI -// // menu_main() ignore_until_line_end: AT+CGMM -// // menu_main() ignore_until_line_end: AT%IPSYS? -// // menu_main() ignore_until_line_end: ATE0 -// // menu_main() ignore_until_line_end: ATV1 -// // menu_main() ignore_until_line_end: AT+CMEE=1 -// // menu_main() ignore_until_line_end: ATX4 -// // menu_main() ignore_until_line_end: AT&C1 -// // menu_main() ignore_until_line_end: ATE0 -// // menu_main() ignore_until_line_end: AT+CMEE=1 -// // menu_main() ignore_until_line_end: AT+GCAP -// // menu_main() ignore_until_line_end: ATI -// // menu_main() ignore_until_line_end: AT+CPIN? -// // menu_main() ignore_until_line_end: AT+CGMM -// case 'A': -// // likely unwanted AT command, host probing for a modem. -// // ignore everything up to next line end '\r' or '\n'. -// //~ ignore_until_line_end = true; -//# if HAS_DAPLINK_SERIAL -// cmdLine_DAPLINKserial.serial().printf("\r\n ignore AT command \"%s\"\r\n", cmdLine.str()); -//# endif // HAS_DAPLINK_SERIAL -// //~ goto label_menu_main_idle; -// break; -//#endif // IGNORE_AT_COMMANDS - // // // TODO1: add new commands here // @@ -6869,7 +5967,6 @@ cmdLine.serial().printf("\r\n> "); #endif } -#endif //USE_COMMAND_BUFFER //-------------------------------------------------- void InitializeConfiguration() @@ -6985,9 +6082,6 @@ // handled as immediate command, do not append to buffer void on_immediate_0x7b() // Unicode (U+007B) { LEFT CURLY BRACKET { - //~ led1 = LED_OFF; led2 = LED_ON; led3 = LED_OFF; // diagnostic rbg led GREEN - //~ InitializeConfiguration(); - //~ ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125); #if HAS_BUTTON2_DEMO_INTERRUPT onButton2FallingEdge(); #endif @@ -6998,9 +6092,6 @@ // handled as immediate command, do not append to buffer void on_immediate_0x7d() // Unicode (U+007D) } RIGHT CURLY BRACKET { - //~ led1 = LED_OFF; led2 = LED_ON; led3 = LED_OFF; // diagnostic rbg led GREEN - //~ InitializeConfiguration(); - //~ ThisThread::sleep_for(125); // [since mbed-os-5.10] vs Thread::wait(125); #if HAS_BUTTON1_DEMO_INTERRUPT onButton1FallingEdge(); #endif @@ -7010,12 +6101,6 @@ // based on example code: https://os.mbed.com/docs/v5.7/reference/pwmout.html int main() { -//#ifdef SCOPE_TRIG_PIN -// //pinMode(SCOPE_TRIG_PIN, OUTPUT); -// scopeTrigPinP11 = 0; // digitalWrite(SCOPE_TRIG_PIN, LOW); -// scopeTrigPinP11 = 1; // digitalWrite(SCOPE_TRIG_PIN, HIGH); -//#endif // SCOPE_TRIG_PIN - // Configure serial ports #if defined(TARGET_MAX32630) // Note: DAPLINKserial interferes with the timer tick interrupt. Try faster baud rate? @@ -7038,7 +6123,6 @@ #else // unknown target #endif -#if USE_COMMAND_BUFFER # if HAS_MICROUSBSERIAL cmdLine_microUSBserial.clear(); //~ cmdLine_microUSBserial.serial().printf("\r\n cmdLine_microUSBserial.serial().printf test\r\n"); @@ -7057,7 +6141,6 @@ cmdLine_DAPLINKserial.on_immediate_0x7b = on_immediate_0x7b; cmdLine_DAPLINKserial.on_immediate_0x7d = on_immediate_0x7d; # endif -#endif print_banner(); @@ -7080,28 +6163,6 @@ # endif #endif // HAS_BUTTON2_DEMO_INTERRUPT -#if defined(TARGET_MAX32630) - // TODO1: timer tick needs to be the highest priority (priority 0, the default). - // TODO1: DAPLINKserial interferes with the timer tick interrupt. - // Lower the priority of the serial port interrupts to avoid disrupting motor operation. - NVIC_SetPriority(UART0_IRQn, 2); // reservedBlueToothSerial(P0_1, P0_0) // 0=highest priority; 1=lower - NVIC_SetPriority(UART1_IRQn, 2); // DAPLINKserial(P2_1, P2_0) // 0=highest priority; 1=lower - NVIC_SetPriority(UART2_IRQn, 2); // reservedSerial(P3_1, P3_0) // 0=highest priority; 1=lower - NVIC_SetPriority(UART3_IRQn, 2); // reservedSerial(P5_4, P5_3) // 0=highest priority; 1=lower - NVIC_SetPriority(GPIO_P0_IRQn, 2); // 0=highest priority; 1=lower - NVIC_SetPriority(GPIO_P1_IRQn, 2); // 0=highest priority; 1=lower - NVIC_SetPriority(GPIO_P2_IRQn, 2); // 0=highest priority; 1=lower - NVIC_SetPriority(GPIO_P3_IRQn, 2); // 0=highest priority; 1=lower - NVIC_SetPriority(GPIO_P4_IRQn, 2); // 0=highest priority; 1=lower - NVIC_SetPriority(GPIO_P5_IRQn, 2); // 0=highest priority; 1=lower - NVIC_SetPriority(GPIO_P6_IRQn, 2); // 0=highest priority; 1=lower - NVIC_SetPriority(GPIO_P7_IRQn, 2); // 0=highest priority; 1=lower - NVIC_SetPriority(GPIO_P8_IRQn, 2); // 0=highest priority; 1=lower - //~ NVIC_SetPriority(RTC0_IRQn, 0); // 0=highest priority; 1=lower - //~ NVIC_SetPriority(RTC3_IRQn, 0); // 0=highest priority; 1=lower - //~ NVIC_SetPriority(US_TIMER_IRQn, 0); // 0=highest priority; 1=lower -#endif - #if HAS_SPI // spi init // mode | POL PHA @@ -7249,26 +6310,11 @@ } # endif // HAS_BUTTON2_DEMO_INTERRUPT #endif -#if USE_COMMAND_BUFFER - //cmdLine_update(); - //-------------------------------------------------- - // GREEN = DAPLINKserial - //~ led1 = LED_OFF; led2 = LED_ON; led3 = LED_OFF; // diagnostic rbg led GREEN # if HAS_DAPLINK_SERIAL if (DAPLINKserial.readable()) { cmdLine_DAPLINKserial.append(DAPLINKserial.getc()); } # endif // HAS_DAPLINK_SERIAL - //-------------------------------------------------- - // BLUE = reading ADC - //~ led1 = LED_OFF; led2 = LED_OFF; led3 = LED_ON; // diagnostic rbg led BLUE - // CS=%d) set comTickLimit %d..%d CSA) comTickLimit is set by AIN0 - //~ if (is_comTickLimit_from_AIN0) { - //~ update_comTickLimit_from_AIN0_AIN4(); - //~ } - //-------------------------------------------------- - // YELLOW = microUSBserial - //~ led1 = LED_ON; led2 = LED_ON; led3 = LED_OFF; // diagnostic rbg led RED+GREEN=YELLOW # if HAS_MICROUSBSERIAL if (microUSBserial.readable()) { int c = microUSBserial.getc(); @@ -7281,70 +6327,5 @@ // } # endif // HAS_MICROUSBSERIAL - //-------------------------------------------------- - // MAGENTA = reading ADC - //~ led1 = LED_ON; led2 = LED_OFF; led3 = LED_ON; // diagnostic rbg led RED+BLUE=MAGENTA - // CP=%d) set pwmCompare %d..%d CPA) PWM is set by AIN1 - //~ if (is_pwmCompare_from_AIN1) { - //~ update_pwmCompare_from_AIN1_AIN5(); - //~ } - //-------------------------------------------------- - // CYAN = other while loop stuff? - //~ led1 = LED_OFF; led2 = LED_ON; led3 = LED_ON; // diagnostic rbg led GREEN+BLUE=CYAN - //~ rgb_led.red(); // diagnostic rbg led RED - //~ rgb_led.green(); // diagnostic rbg led GREEN - //~ rgb_led.blue(); // diagnostic rbg led BLUE - //~ rgb_led.white(); // diagnostic rbg led RED+GREEN+BLUE=WHITE - //~ rgb_led.cyan(); // diagnostic rbg led GREEN+BLUE=CYAN - //~ rgb_led.magenta(); // diagnostic rbg led RED+BLUE=MAGENTA - //~ rgb_led.yellow(); // diagnostic rbg led RED+GREEN=YELLOW - //~ rgb_led.black(); // diagnostic rbg led BLACK -#else // USE_COMMAND_BUFFER - // - // character echo demo stuff; sandbox - // - // char* gets(char* buf, int size); // equivalent to char *gets_s( char *str, rsize_t n ) - // Reads characters from stdin until a newline is found or end-of-file occurs. - // Writes only at most n-1 characters into the array pointed to by str, - // and always writes the terminating null character (unless str is a null pointer). - // The newline character, is discarded and not written to the buffer. - if (gets(line_buffer, sizeof(line_buffer))) - { - puts(line_buffer); - } - - // serial port demo -- echo from DAPLINKserial to microUSBserial - #if HAS_DAPLINK_SERIAL - if (DAPLINKserial.readable()) { - int c = DAPLINKserial.getc(); - led2 = (c & 1); - #if HAS_DAPLINK_SERIAL - DAPLINKserial.putc(c); - #endif - #if HAS_MICROUSBSERIAL - microUSBserial.putc(c); - #endif - // command processing - if (c == '?') { - print_banner(); - } - } - #endif // HAS_DAPLINK_SERIAL - // serial port demo -- echo from microUSBserial to DAPLINKserial - #if HAS_MICROUSBSERIAL - if (microUSBserial.readable()) { - int c = microUSBserial.getc(); - led1 = (c & 1); - #if HAS_DAPLINK_SERIAL - DAPLINKserial.putc(c); - #endif - microUSBserial.putc(c); - // command processing - if (c == '?') { - print_banner(); - } - } - #endif // HAS_MICROUSBSERIAL -#endif // USE_COMMAND_BUFFER } // while(1) }