Example #1
0
void sio2host_init(void)
{
#if SAMD20
	struct usart_config cdc_uart_config;
    /* Configure USART for unit test output */
    usart_get_config_defaults(&cdc_uart_config);
    cdc_uart_config.mux_setting     = EDBG_CDC_SERCOM_MUX_SETTING; 
    cdc_uart_config.pinmux_pad3     = EDBG_CDC_SERCOM_PINMUX_PAD3; 
    cdc_uart_config.pinmux_pad2     = EDBG_CDC_SERCOM_PINMUX_PAD2; 
    cdc_uart_config.baudrate        = USART_HOST_BAUDRATE;
    stdio_serial_init(&cdc_uart_module, USART_HOST,&cdc_uart_config);
    usart_enable(&cdc_uart_module);
    /* Enable transceivers */
    usart_enable_transceiver(&cdc_uart_module, USART_TRANSCEIVER_TX);
    usart_enable_transceiver(&cdc_uart_module, USART_TRANSCEIVER_RX);
#else
	stdio_serial_init(USART_HOST, &usart_serial_options);
#endif
	USART_HOST_RX_ISR_ENABLE();
}
Example #2
0
/**
 *  Configure UART for debug message output.
 */
static void configure_console(void)
{
	const usart_serial_options_t uart_serial_options = {
		.baudrate = CONF_UART_BAUDRATE,
		.paritytype = CONF_UART_PARITY
	};
	
	/* Configure console UART. */
	sysclk_enable_peripheral_clock(CONSOLE_UART_ID);
	stdio_serial_init(CONF_UART, &uart_serial_options);
}
Example #3
0
static void configure_console(void) {

	sysclk_enable_peripheral_clock(PRINTF_USART_ID);

	//const usart_serial_options_t uart_serial_options = { .baudrate = CONF_UART_BAUDRATE, .paritytype = CONF_UART_PARITY, };

	const usart_serial_options_t uart_serial_options = {
	      .baudrate = USART_BAUDRATE,
	      .charlength =   USART_CHAR_LENGTH,
	      .paritytype = USART_PARITY,
	      .stopbits = false
	      //US_MR_CHMODE_NORMAL
	   };

	usart_serial_init(PRINTF_USART, &uart_serial_options);
	stdio_serial_init(PRINTF_USART, &uart_serial_options);

	usart_enable_tx(PRINTF_USART);
	usart_enable_rx(PRINTF_USART);
}

int main(void) {
	sysclk_init();
	board_init();

	configure_console();
	printf("CPH BaseStation v%d\r\n", 1);

	printf("create_uart_cli_task\r\n");
	create_uart_cli_task(CONSOLE_UART, mainUART_CLI_TASK_STACK_SIZE, mainUART_CLI_TASK_PRIORITY);
//	printf("create_dialer_task\r\n");
//	create_dialer_task(mainDIALER_TASK_STACK_SIZE, mainDIALER_TASK_PRIORITY);

	printf("create_comm_task\r\n");
	create_comm_task(mainCOMM_TASK_STACK_SIZE, mainCOMM_TASK_PRIORITY);

	printf("create_apptask_task\r\n");
	create_app_task(mainAPPTASK_TASK_STACK_SIZE, mainAPPTASK_TASK_PRIORITY);

	printf("create_led_task\r\n");
	create_led_task();


	printf("starting task scheduler\r\n");
	/* Start the scheduler. */
	vTaskStartScheduler();

	for (;;) {
	}

	/* Will only get here if there was insufficient memory to create the idle task. */
	return 0;
}
Example #4
0
int main(void)
{
	const usart_serial_options_t usart_serial_options = {
		.baudrate   = CONF_TEST_BAUDRATE,
		.charlength = CONF_TEST_CHARLENGTH,
		.paritytype = CONF_TEST_PARITY,
		.stopbits   = CONF_TEST_STOPBITS,
	};
	uint16_t volts_values[3][NB_VALUE];
	int16_t volt_output;
	uint8_t i;

	/* Usual initializations */
	board_init();
	sysclk_init();
	sleepmgr_init();
	irq_initialize_vectors();
	cpu_irq_enable();
	stdio_serial_init(CONF_TEST_USART, &usart_serial_options);

	printf("\x0C\n\r-- ADC Calibration and averaging example");
	printf("  (Compiled: %s %s)\n\r", __DATE__, __TIME__);

	/* ADC and DAC initializations */
	main_dac_init();
	main_adc_init();

	/* Conversions without averaging and without corrections */
	main_conversions(volts_values[0]);
	/* Enable averaging */
	main_adc_averaging();
	/* Conversions with averaging and without corrections */
	main_conversions(volts_values[1]);
	/* Measure and enable corrections */
	main_adc_correction();
	/* Conversions with averaging and with corrections */
	main_conversions(volts_values[2]);

	/* Display values */
	printf("| ADC input | ADC res. |  Delta  | Averaging |  Delta  | Aver.+Corr. |  Delta  |\n\r");
	volt_output = -CONV_MAX_VOLTAGE;
	for (i = 0; i < NB_VALUE; i++) {
		printf("|  %5d mV | %5d mV | %4d mV |  %5d mV | %4d mV |   %5d mV  | %4d mV |\n\r",
				volt_output,
				volts_values[0][i], volts_values[0][i] - volt_output,
				volts_values[1][i], volts_values[1][i] - volt_output,
				volts_values[2][i], volts_values[2][i] - volt_output);
		volt_output += CONV_VOLTAGE_STEP;
	}

	while (1) {
	}
}
/**
 * \brief Run spinner widget unit tests
 */
int main (void)
{
	const usart_serial_options_t usart_serial_options = {
		.baudrate   = CONF_TEST_BAUDRATE,
		.charlength = CONF_TEST_CHARLENGTH,
		.paritytype = CONF_TEST_PARITY,
		.stopbits   = CONF_TEST_STOPBITS,
	};

	sysclk_init();
	board_init();
	gfx_mono_init();

	stdio_serial_init(CONF_TEST_USART, &usart_serial_options);


	// Define all the test cases
	DEFINE_TEST_CASE(single_spinner_spincollection_test, NULL,
			run_single_spinner_spincollection_test, NULL,
			"Single spinners in spincollection test");
	DEFINE_TEST_CASE(two_spinners_spincollection_test, NULL,
			run_two_spinners_spincollection_test, NULL,
			"Two spinners in spincollection test");
	DEFINE_TEST_CASE(three_spinners_spincollection_test, NULL,
			run_three_spinners_spincollection_test, NULL,
			"Three spinners in spincollection test");
	DEFINE_TEST_CASE(cancel_spinner_spincollection_test, NULL,
			run_cancel_spinner_spincollection_test, NULL,
			"Cancel spinner choice test");
	DEFINE_TEST_CASE(event_back_spincollection_test, NULL,
			run_event_back_spincollection_test, NULL,
			"Event back spincollection test");

	// Put test case addresses in an array
	DEFINE_TEST_ARRAY(spinctrl_tests) = {
		&single_spinner_spincollection_test,
		&two_spinners_spincollection_test,
		&three_spinners_spincollection_test,
		&event_back_spincollection_test,
		&cancel_spinner_spincollection_test,
	};

	// Define the test suite
	DEFINE_TEST_SUITE(spinctrl_suite, spinctrl_tests,
			"Spinner widget with test suite");

	// Set up the test data pointer and run all tests in the suite
	test_suite_run(&spinctrl_suite);

	while (1) {
		/* Intentionally left empty. */
	}
}
Example #6
0
/**
 * \brief Configure UART for debug message output.
 */
static void configure_console(void)
{
	const usart_serial_options_t uart_serial_options = {
		.baudrate = CONF_UART_BAUDRATE,
		.charlength = CONF_UART_CHAR_LENGTH,
		.paritytype = CONF_UART_PARITY,
		.stopbits = CONF_UART_STOP_BITS,
	};

	/* Configure console UART. */
	stdio_serial_init(CONF_UART, &uart_serial_options);
}
Example #7
0
int main()
{
    /* USART init values */
    const usart_serial_options_t usart_serial_options = {
        .baudrate     = CONF_TEST_BAUDRATE,
        .charlength   = CONF_TEST_CHARLENGTH,
        .paritytype   = CONF_TEST_PARITY,
        .stopbits     = CONF_TEST_STOPBITS,
    };

    // Initialize the board and all the peripheral required
    sysclk_init();
    board_init();
    stdio_serial_init(CONF_TEST_USART, &usart_serial_options);

#if XMEGA
    pmic_init();
    sleepmgr_init();
#endif

    DEFINE_TEST_CASE(membag_init_test, NULL, run_membag_init_test,
                     NULL, "Test membag initialization");
    DEFINE_TEST_CASE(membag_alloc_test, NULL, run_membag_alloc_test,
                     NULL, "Test membag memory allocation");
    DEFINE_TEST_CASE(membag_free_test, NULL, run_membag_free_test,
                     NULL, "Test membag memory freeing");
    DEFINE_TEST_CASE(membag_get_test, NULL, run_membag_get_test,
                     NULL, "Test membag get functions");
    DEFINE_TEST_CASE(membag_alloc_when_full_test, NULL,
                     run_membag_alloc_when_full_test, NULL,
                     "Test membag allocation when all membags are full");
    DEFINE_TEST_CASE(membag_realloc_test, NULL, run_membag_realloc_test,
                     NULL, "Test membag allocation and reallocation");

    DEFINE_TEST_ARRAY(membag_tests) = {
        &membag_init_test,
        &membag_alloc_test,
        &membag_free_test,
        &membag_get_test,
        &membag_alloc_when_full_test,
        &membag_realloc_test
    };

    DEFINE_TEST_SUITE(membag_suite,
                      membag_tests, "Common util membag test suite");

    test_suite_run(&membag_suite);

    while (1) {
        /* Intentionally left blank */
    }
}
Example #8
0
/** Initializes the sensor platform - as this calls the board and sysclock
 *  init functions internally, it will also wait for any pending serial
 *  transfer(s) to complete before calling sensor_platform_init() and will
 *  re-initialize the USART afterwards to ensure no corrupt or lost data.
 */
static void configure_sensor_platform(void)
{
#if XMEGA
	usart_clear_tx_complete(CONF_TEST_USART);
	while (!usart_tx_is_complete(CONF_TEST_USART));
#elif UC3
	while (!(usart_tx_empty(CONF_TEST_USART)));
#endif

	sensor_platform_init();

	stdio_serial_init(CONF_TEST_USART, &usart_serial_options);	
}
Example #9
0
void configure_console(void)
{
	struct usart_config usart_conf;
	usart_get_config_defaults(&usart_conf);
	usart_conf.mux_setting = EDBG_CDC_SERCOM_MUX_SETTING;
	usart_conf.pinmux_pad0 = EDBG_CDC_SERCOM_PINMUX_PAD0;
	usart_conf.pinmux_pad1 = EDBG_CDC_SERCOM_PINMUX_PAD1;
	usart_conf.pinmux_pad2 = EDBG_CDC_SERCOM_PINMUX_PAD2;
	usart_conf.pinmux_pad3 = EDBG_CDC_SERCOM_PINMUX_PAD3;
	usart_conf.baudrate    = 115200;
	stdio_serial_init(&cdc_uart_module, EDBG_CDC_MODULE, &usart_conf);
	usart_enable(&cdc_uart_module);
}
Example #10
0
/**
 * \brief Configure UART console.
 */
static void configure_console(void)
{
	const usart_serial_options_t uart_serial_options = {
		.baudrate =		CONF_UART_BAUDRATE,
		.charlength =	CONF_UART_CHAR_LENGTH,
		.paritytype =	CONF_UART_PARITY,
		.stopbits =		CONF_UART_STOP_BITS,
	};

	/* Configure UART console. */
	sysclk_enable_peripheral_clock(CONSOLE_UART_ID);
	stdio_serial_init(CONF_UART, &uart_serial_options);
}
Example #11
0
/**
* \brief Configure serial console.
*/
static void configure_console(void)
{
    struct usart_config config_usart;
    usart_get_config_defaults(&config_usart);
    config_usart.baudrate    = 115200;
    config_usart.mux_setting = EDBG_CDC_SERCOM_MUX_SETTING;
    config_usart.pinmux_pad0 = EDBG_CDC_SERCOM_PINMUX_PAD0;
    config_usart.pinmux_pad1 = EDBG_CDC_SERCOM_PINMUX_PAD1;
    config_usart.pinmux_pad2 = EDBG_CDC_SERCOM_PINMUX_PAD2;
    config_usart.pinmux_pad3 = EDBG_CDC_SERCOM_PINMUX_PAD3;
    stdio_serial_init(&usart_instance, EDBG_CDC_MODULE, &config_usart);
    usart_enable(&usart_instance);
}
Example #12
0
/**
 * Initialize USART serial as debug communication port
 */
void dbg_usart_init(void)
{
	/* USART pins init */
	_dbg_usart_pins_init();
	/* Configure USART */
    const usart_serial_options_t options = {
        .baudrate   = DBG_USART_BAUDRATE,
		.charlength = DBG_USART_CHR_LENGTH,
		.paritytype = DBG_USART_PARITY,
		.stopbits   = DBG_USART_STOP_BITS
    };
	stdio_serial_init(DBG_USART_BASE, &options);
}
Example #13
0
/* Funktionen konfiguerar kommunikationskanal via UART */
void configure_console(void) {
	const usart_serial_options_t uart_serial_options = { .baudrate = CONF_UART_BAUDRATE, .paritytype = CONF_UART_PARITY };
	
	/* Konfigurera konsol UART. */
	sysclk_enable_peripheral_clock(CONSOLE_UART_ID);
	stdio_serial_init(CONF_UART, &uart_serial_options);
	ioport_set_pin_mode(PIO_PA8_IDX, IOPORT_MODE_PULLUP);
	
	/* Specifiera att stdout inte ska buffras */
	#if defined(__GNUC__)
	setbuf(stdout, NULL);
	#endif
}
Example #14
0
/*! \brief Initializes STDIO.
 */
static void init_stdio(void)
{
  // USART options.
  static usart_serial_options_t USART_SERIAL_OPTIONS =
  {
    .baudrate     = USART_SERIAL_EXAMPLE_BAUDRATE,
    .charlength   = USART_SERIAL_CHAR_LENGTH,
    .paritytype   = USART_SERIAL_PARITY,
    .stopbits     = USART_SERIAL_STOP_BIT
  };

  // Initialize Serial Interface using Stdio Library
  stdio_serial_init(USART_SERIAL_EXAMPLE,&USART_SERIAL_OPTIONS);
}
Example #15
0
/**
 * \brief Run CRC driver unit tests
 */
int main (void)
{
	const usart_serial_options_t usart_serial_options = {
		.baudrate     = CONF_TEST_BAUDRATE,
		.charlength   = CONF_TEST_CHARLENGTH,
		.paritytype   = CONF_TEST_PARITY,
		.stopbits     = CONF_TEST_STOPBITS,
	};

	sysclk_init();
	board_init();
	sleepmgr_init();

	stdio_serial_init(CONF_TEST_USART, &usart_serial_options);

	DEFINE_TEST_CASE(crc_32bit_io_test, NULL,
		run_32bit_io_test,
		NULL, "32bit CRC on simulated IO data test");

	DEFINE_TEST_CASE(crc_16bit_io_test, NULL,
		run_16bit_io_test,
		NULL, "16bit CRC on simulated IO data test");

	DEFINE_TEST_CASE(crc_32bit_dma_test, NULL, run_32bit_dma_test,
		NULL, "32bit CRC DMA data test");

	DEFINE_TEST_CASE(crc_16bit_dma_test, NULL, run_16bit_dma_test,
		NULL, "16bit CRC DMA data test");

	DEFINE_TEST_CASE(crc_32bit_flash_range_test, NULL, run_flash_test,
		NULL, "32bit CRC flash range test");

	// Put test case addresses in an array
	DEFINE_TEST_ARRAY(crc_tests) = {
		&crc_32bit_io_test,
		&crc_16bit_io_test,
		&crc_32bit_dma_test,
		&crc_16bit_dma_test,
		&crc_32bit_flash_range_test,
	};

	// Define the test suite
	DEFINE_TEST_SUITE(crc_suite, crc_tests, "XMEGA CRC driver test suite");

	test_suite_run(&crc_suite);

	while (1) {
		// Intentionally left blank
	}
}
Example #16
0
/**
 * \brief Run MEM2MEM driver unit tests.
 */
int main(void)
{
	uint32_t i;
	const usart_serial_options_t uart_serial_options = {
		.baudrate = CONF_TEST_BAUDRATE,
		.paritytype = CONF_TEST_PARITY
	};

	/* Initialize the system. */
	sysclk_init();
	board_init();

	/* Configure console UART. */
	sysclk_enable_peripheral_clock(CONSOLE_UART_ID);
	stdio_serial_init(CONF_TEST_UART, &uart_serial_options);

	/* Initialize src buffer */
	for (i = 0; i < MEM_SIZE8/2; i ++) {
		src_mem8[i] = (i % 10) + '0';
	}
	for (;i < MEM_SIZE8; i ++) {
		src_mem8[i] = (i % ('z'-'a')) + 'a';
	}

	/* Define all the test cases */
	DEFINE_TEST_CASE(low_level_test, NULL, run_low_level_transfer_test,
			NULL, "Low Level APIs data transfer test");
	DEFINE_TEST_CASE(transfer_wait_test, NULL, run_transfer_wait_test,
			NULL, "M2M APIs data transfer wait test");
	DEFINE_TEST_CASE(transfer_job_test, NULL, run_transfer_job_test,
			NULL, "M2M APIs data transfer job test");

	/* Put test case addresses in an array */
	DEFINE_TEST_ARRAY(mem2mem_tests) = {
		&low_level_test,
		&transfer_wait_test,
		&transfer_job_test
	};

	/* Define the test suite */
	DEFINE_TEST_SUITE(mem2mem_suite, mem2mem_tests,
			"SAM MEM2MEM driver test suite");

	/* Run all tests in the test suite */
	test_suite_run(&mem2mem_suite);

	while (1) {
		/* Busy-wait forever */
	}
}
/**
 *  \brief Configure the Console UART
 */
static void configure_console(void)
{
	const usart_serial_options_t uart_serial_options = {
		.baudrate = CONF_UART_BAUDRATE,
		.paritytype = CONF_UART_PARITY
	};

	/* Configure console UART. */
	sysclk_enable_peripheral_clock(CONSOLE_UART_ID);
	stdio_serial_init(CONF_UART, &uart_serial_options);
#if defined(__GNUC__)
	setbuf(stdout, NULL);
#endif
}
Example #18
0
/**
 * \brief Run ADC unit tests
 *
 * Initializes the clock system, board and serial output, then sets up the
 * ADC unit test suite and runs it.
 */
int main(void)
{

	const usart_serial_options_t usart_serial_options = {
		.baudrate   = CONF_TEST_BAUDRATE,
		.charlength = CONF_TEST_CHARLENGTH,
		.paritytype = CONF_TEST_PARITY,
		.stopbits   = CONF_TEST_STOPBITS,
	};

	board_init();
	sysclk_init();
	sleepmgr_init();
	stdio_serial_init(CONF_TEST_USART, &usart_serial_options);

	// Define single ended conversion test cases
	DEFINE_TEST_CASE(single_ended_12bit_conversion_test, NULL,
			run_single_ended_12bit_conversion_test, NULL,
			"Single ended conversion with 12-bit result");
	DEFINE_TEST_CASE(single_ended_8bit_conversion_test, NULL,
			run_single_ended_8bit_conversion_test, NULL,
			"Single ended conversion with 8-bit result");

	// Define differential conversion test cases
	DEFINE_TEST_CASE(differential_conversion_test, NULL,
			run_differential_12bit_conversion_test, NULL,
			"Differential conversion with 12-bit result");
	DEFINE_TEST_CASE(differential_conversion_with_gain_test, NULL,
			run_differential_12bit_with_gain_conversion_test, NULL,
			"Differential conversion with 12-bit result and gain");

	// Put test case addresses in an array
	DEFINE_TEST_ARRAY(adc_tests) = {
		&single_ended_12bit_conversion_test,
		&single_ended_8bit_conversion_test,
		&differential_conversion_test,
		&differential_conversion_with_gain_test,
	};

	// Define the test suite
	DEFINE_TEST_SUITE(adc_suite, adc_tests,
			"XMEGA ADC driver test suite");

	// Run all tests in the suite
	test_suite_run(&adc_suite);

	while (1) {
		// Intentionally left empty.
	}
}
Example #19
0
/**
 * \brief Run DataFlash component unit tests
 *
 * Initializes the clock system, board, serial output and DataFlash, then sets
 * up the DataFlash unit test suite and runs it.
 */
int main(void)
{
	const usart_serial_options_t usart_serial_options = {
		.baudrate   = CONF_TEST_BAUDRATE,
		.charlength = CONF_TEST_CHARLENGTH,
		.paritytype = CONF_TEST_PARITY,
		.stopbits   = CONF_TEST_STOPBITS,
	};

	// Initialize the board and all the peripheral required
	sysclk_init();
	board_init();
	stdio_serial_init(CONF_TEST_USART, &usart_serial_options);
	at45dbx_init();

	// Define all the test cases
	DEFINE_TEST_CASE(memory_check_test, NULL, run_memory_check_test, NULL,
			"Memory check");
	DEFINE_TEST_CASE(byte_access_test, NULL, run_byte_access_test, NULL,
			"Read/write byte access");
	DEFINE_TEST_CASE(sector_access_test, NULL, run_sector_access_test, NULL,
			"Read/write sector access");
	DEFINE_TEST_CASE(multiple_sector_access_test, NULL,
			run_multiple_sector_access_test, NULL,
			"Read/write multiple sector access");
	DEFINE_TEST_CASE(memory_range_check_test, NULL,
			run_memory_range_check_test, NULL,
			"Memory range address check");

	// Put test case addresses in an array.
	DEFINE_TEST_ARRAY(memory_tests) = {
		&memory_check_test,
		&byte_access_test,
		&sector_access_test,
		&multiple_sector_access_test,
		&memory_range_check_test
	};

	// Define the test suite.
	DEFINE_TEST_SUITE(memory_suite, memory_tests,
			"AT45dbx component unit test suite");

	// Run all tests in the test suite.
	test_suite_run(&memory_suite);

	while (1) {
		// Intentionally left empty.
	};
}
Example #20
0
/**
 * \brief Run Common Clock service unit tests
 *
 * Initializes board, serial output, then sets up the
 * clock unit test suite and runs it.
 */
int main (void)
{
    const usart_serial_options_t usart_serial_options = {
        .baudrate   = CONF_TEST_BAUDRATE,
        .charlength = CONF_TEST_CHARLENGTH,
        .paritytype = CONF_TEST_PARITY,
        .stopbits   = CONF_TEST_STOPBITS,
    };

    board_init();
    stdio_serial_init(CONF_TEST_USART, &usart_serial_options);

    //set the low level write function
    //usart can work only after we call sysclk_init, because the
    //PBA clock initialized with correct value which used by usart
    //So, we output the information to one buffer before usart can work.
    ptr_put = (int (*)(void volatile*,char))&usart_write_char_buf;

    // Define all the test cases.
    DEFINE_TEST_CASE(osc_test, NULL, run_osc_test, cleanup_osc_test,
                     "Oscillator0/1 test");
    DEFINE_TEST_CASE(osc32_test, NULL, run_osc32_test, cleanup_osc32_test,
                     "32KHz oscillator test");
    DEFINE_TEST_CASE(pll_dfll_test, NULL, run_pll_dfll_test,
                     cleanup_pll_dfll_test, "Pll or Dfll test");
    DEFINE_TEST_CASE(sync_clock_test, NULL, run_sync_clock_test, NULL,
                     "CPU/HSB, peripheral bridge clock test");
    DEFINE_TEST_CASE(generic_clock_test, NULL, run_generic_clock_test,
                     cleanup_generic_clock_test, "Generic clock test");

    // Put test case addresses in an array.
    DEFINE_TEST_ARRAY(clock_tests) = {
        &osc_test,
        &osc32_test,
        &pll_dfll_test,
        &sync_clock_test,
        &generic_clock_test,
    };

    // Define the test suite.
    DEFINE_TEST_SUITE(clock_suite, clock_tests, "Clock service unit test suite");

    // Run all tests in the test suite.
    test_suite_run(&clock_suite);

    while (true) {
        __asm__("nop");
    };
}
Example #21
0
/**
 *  Configure UART console.
 */
static void configure_console(void)
{
    struct usart_config usart_conf;

    usart_get_config_defaults(&usart_conf);
    usart_conf.mux_setting = CONF_STDIO_MUX_SETTING;
    usart_conf.pinmux_pad0 = CONF_STDIO_PINMUX_PAD0;
    usart_conf.pinmux_pad1 = CONF_STDIO_PINMUX_PAD1;
    usart_conf.pinmux_pad2 = CONF_STDIO_PINMUX_PAD2;
    usart_conf.pinmux_pad3 = CONF_STDIO_PINMUX_PAD3;
    usart_conf.baudrate    = CONF_STDIO_BAUDRATE;

    stdio_serial_init(&cdc_uart_module, CONF_STDIO_USART_MODULE, &usart_conf);

}
Example #22
0
/**
 * \brief Configure serial console.
 */
static void configure_console(void)
{
	const usart_serial_options_t uart_serial_options = {
		.baudrate = CONF_UART_BAUDRATE,
#ifdef CONF_UART_CHAR_LENGTH
		.charlength = CONF_UART_CHAR_LENGTH,
#endif
		.paritytype = CONF_UART_PARITY,
#ifdef CONF_UART_STOP_BITS
		.stopbits = CONF_UART_STOP_BITS,
#endif
	};

	stdio_serial_init(CONF_UART, &uart_serial_options);
}
Example #23
0
static void configure_console(void)
{
	struct usart_config usart_conf;

	usart_get_config_defaults(&usart_conf);
	usart_conf.mux_setting = HOST_SERCOM_MUX_SETTING;
	usart_conf.pinmux_pad0 = HOST_SERCOM_PINMUX_PAD0;
	usart_conf.pinmux_pad1 = HOST_SERCOM_PINMUX_PAD1;
	usart_conf.pinmux_pad2 = HOST_SERCOM_PINMUX_PAD2;
	usart_conf.pinmux_pad3 = HOST_SERCOM_PINMUX_PAD3;
	usart_conf.baudrate    = USART_HOST_BAUDRATE;

	stdio_serial_init(&cdc_uart_module, USART_HOST, &usart_conf);
	usart_enable(&cdc_uart_module);
}
Example #24
0
static void configure_console(void)
{
	const usart_serial_options_t uart_serial_options = {.baudrate = CONF_UART_BAUDRATE, .paritytype = CONF_UART_PARITY };
	sysclk_enable_peripheral_clock(CONSOLE_UART_ID);
	stdio_serial_init(CONF_UART, &uart_serial_options);
	/* Stdout shall not be buffered */
	#if defined(__GNUC__)
	setbuf(stdout, NULL);
	#else
	/* Redan i fallet IAR's Normal DLIB default
	konfiguration:
	* sänder en tecken åtgången
	*/
	#endif
}
Example #25
0
/**
 * \brief Run WM8731 module unit tests.
 */
int main(void)
{
	const usart_serial_options_t uart_serial_options = {
		.baudrate = CONF_TEST_BAUDRATE,
		.paritytype = CONF_TEST_PARITY
	};

	/* Initialize the system. */
	sysclk_init();
	board_init();
#ifdef BOARD_AT24C_TWI_INSTANCE
	/* reset EEPROM state to release TWI */
	at24cxx_reset();
#endif

	/* Configure console UART. */
	sysclk_enable_peripheral_clock(CONSOLE_UART_ID);
	stdio_serial_init(CONF_TEST_UART, &uart_serial_options);

	/* Initial the WM8731 to DAC */
	init_dac();

	/* Initial the ssc interface */
	init_ssc();

	/* Configure DMA */
	init_dma();

	/* Define all the test cases */
	DEFINE_TEST_CASE(wm8731_transfer_test, NULL, run_wm8731_transfer_test,
			NULL, "WM8731 transfer test.");

	/* Put test case addresses in an array */
	DEFINE_TEST_ARRAY(wm8731_tests) = {
		&wm8731_transfer_test,
	};

	/* Define the test suite */
	DEFINE_TEST_SUITE(wm8731_suite, wm8731_tests,
			"SAM WM8731 module test suite");

	/* Run all tests in the test suite */
	test_suite_run(&wm8731_suite);

	while (1) {
		/* Busy-wait forever */
	}
}
Example #26
0
/**
 * \brief Application entry point for AT30TS(E)75x unit tests.
 *
 * \return Unused (ANSI-C compatibility).
 */
int main(void)
{
	const usart_serial_options_t usart_serial_options = {
		.baudrate   = CONF_TEST_BAUDRATE,
		.charlength = CONF_TEST_CHARLENGTH,
		.paritytype = CONF_TEST_PARITY,
		.stopbits   = CONF_TEST_STOPBITS
	};

	sysclk_init();
	board_init();
	/* Initialize AT30TS(E)75x */
	at30tse_init();

	stdio_serial_init(CONF_TEST_USART, &usart_serial_options);

	/* Define all the test cases */
	DEFINE_TEST_CASE(at30tse_test_read_temperature,
			NULL, run_test_read_temperature, NULL,
			"at30tse read temperature test");
#if BOARD_USING_AT30TSE != AT30TS75
	DEFINE_TEST_CASE(at30tse_test_write_data,
			NULL, run_test_write_data, NULL,
			"at30tse write data test");
	DEFINE_TEST_CASE(at30tse_test_read_data,
			NULL, run_test_read_compare_data, NULL,
			"at30tse read and compare data test");
#endif
	/* Put test case addresses in an array */
	DEFINE_TEST_ARRAY(at30tse_test_array) = {
			&at30tse_test_read_temperature,
#if BOARD_USING_AT30TSE != AT30TS75
			&at30tse_test_write_data,
			&at30tse_test_read_data,
#endif
	};

	/* Define the test suite */
	DEFINE_TEST_SUITE(at30tse_suite, at30tse_test_array,
			"at30tse driver test suite");

	/* Run all tests in the test suite */
	test_suite_run(&at30tse_suite);

	while (1) {
		/* Busy-wait forever */
	}
}
void configureConsole(void)
/* Enables feedback through the USB-cable back to terminal within Atmel Studio */
/* Note that  the baudrate, parity and other parameters must be set in conf/conf_uart_serial.h */
{
	const usart_serial_options_t uart_serial_options = {
		.baudrate = CONF_UART_BAUDRATE,
		.paritytype = CONF_UART_PARITY
	};

	/* Configure console UART. */
	sysclk_enable_peripheral_clock(CONSOLE_UART_ID);
	stdio_serial_init(CONF_UART, &uart_serial_options);
	
	printf("Console ready\n");
	printf("=============\n");
}
Example #28
0
/**
 * \brief Initialize the USART for unit test
 *
 * Initializes the SERCOM USART used for sending the unit test status to the
 * computer via the EDBG CDC gateway.
 */
static void cdc_uart_init(void)
{
	struct usart_config usart_conf;

	/* Configure USART for unit test output */
	usart_get_config_defaults(&usart_conf);
	usart_conf.mux_setting = CONF_STDIO_MUX_SETTING;
	usart_conf.pinmux_pad0 = CONF_STDIO_PINMUX_PAD0;
	usart_conf.pinmux_pad1 = CONF_STDIO_PINMUX_PAD1;
	usart_conf.pinmux_pad2 = CONF_STDIO_PINMUX_PAD2;
	usart_conf.pinmux_pad3 = CONF_STDIO_PINMUX_PAD3;
	usart_conf.baudrate    = CONF_STDIO_BAUDRATE;

	stdio_serial_init(&cdc_uart_module, CONF_STDIO_USART, &usart_conf);
	usart_enable(&cdc_uart_module);
}
Example #29
0
static void serial_port_init(void)
{
	struct usart_config usart_conf;

	/* Configure USART for unit test output */
	usart_get_config_defaults(&usart_conf);
	usart_conf.mux_setting = EDBG_CDC_SERCOM_MUX_SETTING;
	usart_conf.pinmux_pad0 = EDBG_CDC_SERCOM_PINMUX_PAD0;
	usart_conf.pinmux_pad1 = EDBG_CDC_SERCOM_PINMUX_PAD1;
	usart_conf.pinmux_pad2 = EDBG_CDC_SERCOM_PINMUX_PAD2;
	usart_conf.pinmux_pad3 = EDBG_CDC_SERCOM_PINMUX_PAD3;
	usart_conf.baudrate    = DEFAULT_BAUD_RATE;

	stdio_serial_init(&usart_instance, EDBG_CDC_MODULE, &usart_conf);
	usart_enable(&usart_instance);
}
/** Set up the USART (EDBG) communication for debug purpose. */
static void setup_usart_channel(void)
{
	struct usart_config config_usart;
	usart_get_config_defaults(&config_usart);

	/* Configure the USART settings and initialize the standard I/O library */
	config_usart.baudrate = 115200;
	config_usart.mux_setting = EDBG_CDC_SERCOM_MUX_SETTING;
	config_usart.pinmux_pad0 = EDBG_CDC_SERCOM_PINMUX_PAD0;
	config_usart.pinmux_pad1 = EDBG_CDC_SERCOM_PINMUX_PAD1;
	config_usart.pinmux_pad2 = EDBG_CDC_SERCOM_PINMUX_PAD2;
	config_usart.pinmux_pad3 = EDBG_CDC_SERCOM_PINMUX_PAD3;

	stdio_serial_init(&usart_instance, EDBG_CDC_MODULE, &config_usart);
	usart_enable(&usart_instance);
}