int main() { rflpc_uart_init(RFLPC_UART0); rflpc_timer_enable(RFLPC_TIMER0); rflpc_timer_set_clock(RFLPC_TIMER0,RFLPC_CCLK/8); rflpc_timer_set_pre_scale_register(RFLPC_TIMER0, rflpc_clock_get_system_clock()/8000000); /* microsecond timer */ rflpc_timer_start(RFLPC_TIMER0); printf("SPI test sample build on %s %s\r\n", __DATE__, __TIME__); printf("Waiting 1 second\r\n"); wait(1000000); printf("OK\r\n"); test_spi(); while(1); return 0; }
int self_test(usbthing_t usbthing, int interactive) { int res; res = test_gpio(usbthing, interactive); if (res < 0) { printf("GPIO test failed: %d\r\n", res); } else { printf("GPIO test OK\r\n"); } res = test_spi(usbthing, interactive); if (res < 0) { printf("SPI test failed: %d\r\n", res); } else { printf("SPI test OK\r\n"); } res = test_spi_bulk(usbthing, interactive); if (res < 0) { printf("SPI bulk test failed: %d\r\n", res); } else { printf("SPI test OK\r\n"); } res = test_adc(usbthing, interactive); if (res < 0) { printf("ADC test failed: %d\r\n", res); } else { printf("ADC test OK\r\n"); } res = test_dac_adc(usbthing, interactive); if (res < 0) { printf("DAC -> ADC test failed: %d\r\n", res); return -1; } return 0; }