Beispiel #1
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;
}
Beispiel #2
0
int main(void)
{
	xTimerHandle xLEDTimer;

	/* Prepare the hardware to run this demo. */
	prvSetupHardware();

	/* Create the timer that toggles an LED to show that the system is running,
	and that the other tasks are behaving as expected. */
	xLEDTimer = xTimerCreate((const signed char * const) "LED timer",/* A text name, purely to help debugging. */
							mainSOFTWARE_TIMER_RATE,	/* The timer period. */
							pdTRUE,						/* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
							NULL,						/* The timer does not use its ID, so the ID is just set to NULL. */
							prvLEDTimerCallback			/* The function that is called each time the timer expires. */
							);

	/* Sanity check the timer's creation, then start the timer.  The timer
	will not actually start until the FreeRTOS kernel is started. */
	configASSERT(xLEDTimer);
	xTimerStart(xLEDTimer, mainDONT_BLOCK);

	/* Create the example tasks as per the configuration settings.
	See the comments at the top of this file. */
	#if (defined confINCLUDE_UART_CLI)
	{
		create_uart_cli_task(BOARD_UART,
				mainUART_CLI_TASK_STACK_SIZE,
				mainUART_CLI_TASK_PRIORITY);
	}
	#endif /* confINCLUDE_USART_CLI */

	#if (defined confINCLUDE_USART_ECHO_TASKS)
	{
		create_usart_echo_test_tasks(BOARD_USART,
				mainUSART_ECHO_TASK_STACK_SIZE,
				mainUSART_ECHO_TASK_PRIORITY);
	}
	#endif /* confINCLUDE_USART_ECHO_TASKS */

	#if (defined confINCLUDE_USART_CLI)
	{
		create_usart_cli_task(BOARD_USART,
				mainUSART_CLI_TASK_STACK_SIZE,
				mainUSART_CLI_TASK_PRIORITY);
	}
	#endif /* confINCLUDE_USART_CLI */

	#if (defined confINCLUDE_CDC_CLI)
	{
		create_usb_cdc_cli_task(mainCDC_CLI_TASK_STACK_SIZE,
				mainCDC_CLI_TASK_PRIORITY);
	}
	#endif /* confINCLUDE_CDC_CLI */

	#if (defined confINCLUDE_SPI_FLASH_TASK)
	{
		create_spi_flash_test_task(BOARD_SPI,
				mainSPI_FLASH_TASK_STACK_SIZE,
				mainSPI_FLASH_TASK_PRIORITY,
				mainDEMONSTRATE_ASYNCHRONOUS_API);
	}
	#endif /* confINCLUDE_SPI_FLASH_TASK */

	#if (defined confINCLUDE_TWI_EEPROM_TASK)
	{
		create_twi_eeprom_test_task(BOARD_BASE_TWI_EEPROM,
				mainTWI_EEPROM_TASK_STACK_SIZE,
				mainTWI_EEPROM_TASK_PRIORITY,
				mainDEMONSTRATE_ASYNCHRONOUS_API);
	}
	#endif /* confINCLUDE_TWI_EEPROM_TASK */

	/* Start the RTOS scheduler. */
	vTaskStartScheduler();

	/* If all is well, the scheduler will now be running, and the following line
	will never be reached.  If the following line does execute, then there was
	insufficient FreeRTOS heap memory available for the idle and/or timer tasks
	to be created.  See the memory management section on the FreeRTOS web site
	for more details. */
	for (;;) {
	}
}