/** **************************************************************************************** * @brief Main routineof the DA14580 Engineering Examples Functions * DA14580 Peripherals Udage Examples * - UART * - SPI Flash * - Boot From SPI flash * - EEPROM * - Timers * - Battery Level Indication - ADC * - Quadrature * - Buzzer * Due to HW Development Kit limitations, user must select one of the follwoing configuartion for UART, SPI, I2C. * Addicional Hardware (SPI, EEPROM boadrs) or Hardware modification may needed for some tof the tests. * More information in the file periph_setup.h, Application Notes, and User Guide for DA14580 * - UART only ( No HW modifications on rev C2 motherboard, No additional hardware) * - SPI Flash with UART (HW modifications & additional Hardware needed , SPI_DI_PIN on the additional SPI / EEPROM daughterboard ) * - Boot From SPI Flash with UART (HW modifications & additional Hardware needed, (UART TX) ) * - Boot From SPI Flash without UART (Additional Hardware needed) * - Boot From EEPROM with UART (Additional Hardware needed) * **************************************************************************************** */ int main (void) { short int index = 0; char mchoice; periph_init(); printf_string("DA14580 Engineering Examples\n\r"); printf_string("Connect the appropriate peripheral before choosing each test\n\r\n\r"); printf_string("Refer to Engineering Examples User Guide\n\r\n\r"); print_menu(); while(1){ if (index==1) break; mchoice = uart_receive_byte(); switch (mchoice){ case 'u': uart_test(); endtest_bridge(&index); break; case 'f': spi_test(); endtest_bridge(&index); break; case 'i': spi_image(); endtest_bridge(&index); break; case 'e': i2c_test(); endtest_bridge(&index); break; case 'd': i2c_image(); endtest_bridge(&index); break; // case 't': swt_test(); endtest_bridge(&index); break; #ifdef QUADEC_ENABLED case 'q': quad_decoder_test(); endtest_bridge(&index); break; #endif //QUADEC_ENABLED case 't': timer0_test(); endtest_bridge(&index); break; case 'p': timer2_test(); endtest_bridge(&index); break; case 'b': batt_test(); endtest_bridge(&index); break; case 'x': index=1;break; default: print_input(); continue; }; }; printf_string("\n\r End of tests\n\r"); while(1); }
/** **************************************************************************************** * @brief Main routineof the DA14580 Peripheral Examples Functions * DA14580 Peripherals Udage Examples * - UART * - SPI Flash * - Boot From SPI flash * - EEPROM * - Timers * - Battery Level Indication - ADC * - Quadrature * - Buzzer * Due to HW Development Kit limitations, user must select one of the follwoing configuartion for UART, SPI, I2C. * Addicional Hardware (SPI, EEPROM boadrs) or Hardware modification may needed for some tof the tests. * More information in the file periph_setup.h, Application Notes, and User Guide for DA14580 * - UART only ( No HW modifications on rev C2 motherboard, No additional hardware) * - SPI Flash with UART (HW modifications & additional Hardware needed , SPI_DI_PIN on the additional SPI / EEPROM daughterboard ) * - Boot From SPI Flash with UART (HW modifications & additional Hardware needed, (UART TX) ) * - Boot From SPI Flash without UART (Additional Hardware needed) * - Boot From EEPROM with UART (Additional Hardware needed) * **************************************************************************************** */ int main (void) { short int index = 0; char mchoice; periph_init(); printf_string("\n\rDA14580 Peripheral Examples\n\r"); printf_string( "---------------------------\n\r"); printf_string("Before running the tests:\n\r"); printf_string(" 1) Make sure you have connected the appropriate peripheral(s).\n\r"); printf_string(" 2) Select the associated hardware configuration in 'periph_setup.h'.\n\r"); printf_string(" 3) Build.\n\r"); printf_string("Please, refer to DA14580 Peripheral Examples User Manual\n\r"); printf_string("for detailed instructions.\n\r"); print_menu(); while(1){ if (index==1) break; mchoice = uart_receive_byte(); switch (mchoice){ case 'u': uart_test(); endtest_bridge(&index); break; #ifdef SPI_ENABLED case 'f': spi_test(); endtest_bridge(&index); break; #endif //SPI_ENABLED #ifdef EEPROM_ENABLED case 'e': i2c_test(); endtest_bridge(&index); break; #endif //EEPROM_ENABLED #ifdef QUADEC_ENABLED case 'q': quad_decoder_test(); endtest_bridge(&index); break; #endif //QUADEC_ENABLED #ifdef BUZZER_ENABLED case 't': timer0_test(); endtest_bridge(&index); break; case 'p': timer2_test(); endtest_bridge(&index); break; #endif //BUZZER_ENABLED case 'b': batt_test(); endtest_bridge(&index); break; case 'x': index=1;break; default: print_input(); continue; }; }; printf_string("\n\r End of tests\n\r"); while(1); }