//
//
//lecture - i2c-eeprom - this will invoke the appropriate open method corresponding to the
//                       device type and initialize the active device object /control object !!!
//
//lecture - UART - this will invoke appropriate open method for UART type device - invoked from
//                 FreeRTOS_DriverInterface.c - refer to that file, if needed !!!
//
//
portBASE_TYPE vFreeRTOS_lpc17xx_PopulateFunctionPointers( const Peripheral_Types_t ePeripheralType, Peripheral_Control_t * const pxPeripheralControl )
{
portBASE_TYPE xReturn = pdFALSE;

	switch( ePeripheralType )
	{
	        //
	        //
			//lecture - UART - in our case, FreeRTOS_UART_open() is invoked - it is in
			//                 FreeRTOS_lpc17xx_uart.c - UART driver
			//
			//
		/* Open the peripheral. */
		case eUART_TYPE	:

			#if ioconfigINCLUDE_UART == 1
			{
				xReturn = FreeRTOS_UART_open( pxPeripheralControl );   //aaa-zzz
			}
			#endif /* ioconfigINCLUDE_UART */
			break;


		case eSSP_TYPE :

			#if ioconfigINCLUDE_SSP == 1
			{
				//xReturn = FreeRTOS_SSP_open( pxPeripheralControl );   //aaa-zzz
			}
			#endif /* ioconfigINCLUDE_SSP */
			break;
		//
        //
		//lecture - i2c-eeprom -in our case, FreeRTOS_I2C_open() is invoked - it is in
		//                      FreeRTOS_lpc17xx_i2c.c - i2c master driver
		//
		//
		case eI2C_TYPE :
		
			#if ioconfigINCLUDE_I2C == 1
			{
				xReturn = FreeRTOS_I2C_open( pxPeripheralControl );
			}
			#endif /* ioconfigINCLUDE_I2C */
			break;


		default :
		
			/* Nothing to do here.  xReturn is already set to pdFALSE. */
			configASSERT( xReturn );
			break;
	}
	
	/* Just to prevent compiler warnings should FreeRTOSIOConfig.h be
	configured to exclude the above FreeRTOS_nnn_open() calls. */
	( void ) pxPeripheralControl;

	return xReturn;
}
예제 #2
0
파일: main.c 프로젝트: ievosabo/Canner
int main (void) 
{

	if (!FreeRTOS_UART_open(&pxSerialPort[0], PORT_0, BAUD_115200, configQUEUE_REGISTRY_SIZE))
	{
		return -1;
	}
	if (!FreeRTOS_UART_open(&pxSerialPort[1], PORT_1, BAUD_115200, configQUEUE_REGISTRY_SIZE))
	{
		return -1;
	}
	
	FreeRTOS_CLI_setup(pxSerialPort[PORT_0], FreeRTOS_UART_read, FreeRTOS_UART_write);

#ifdef CLI_ENABLE
	vRegisterCliCmds();
	xTaskCreate(vCommandConsoleTask,( const signed char * )"CLI",configCLI_STACK_SIZE, NULL, mainNORMAL_TASK_PRIORITY, NULL);

#endif

	FreeRTOS_CAN_Init(configCAN_RX_QUEUE_SIZE, configCAN_TX_QUEUE_SIZE);

	xTaskCreate(vCanReceiveTask,
				(const signed char *)CAN_RX_TASK_NAME,
				configCAN_STACK_SIZE, 
				NULL, 
				mainNORMAL_TASK_PRIORITY, 
				NULL);

	xTaskCreate(vCanCmdTask,
				(const signed char *)CAN_CMD_TASK_NAME,
				configCAN_STACK_SIZE, 
				NULL, 
				mainNORMAL_TASK_PRIORITY, 
				NULL);

	xTaskCreate(vLcdTask,
				(const signed char *)LCD_TASK_NAME,
				configLCD_STACK_SIZE, 
				NULL, 
				mainNORMAL_TASK_PRIORITY, 
				NULL);

	vTaskStartScheduler();

	return 0;
}
예제 #3
0
//------------------------------------------------------------------------------------
// FUNCIONES GENERALES FreeRTOS ( son las que usa la aplicacion )
//------------------------------------------------------------------------------------
Peripheral_Descriptor_t FreeRTOS_open(const u08 port, const u32 flags)
{

	switch(port) {

	case pUART0:
		pdUART0.portId = port;
		FreeRTOS_UART_open (&pdUART0, flags);
		break;
	case pUART1:
		pdUART1.portId = port;
		FreeRTOS_UART_open (&pdUART1, flags);
		break;
	case pI2C:
		pdI2C.portId = port;
		FreeRTOS_I2C_open (&pdI2C, flags);
		break;
	}

	return(NULL);

}