//
//
//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;
}
Esempio n. 2
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);

}