예제 #1
0
파일: osifdll.c 프로젝트: AndySze/OpenServo
EXPORT int OSIF_init(void)
{
   int rc=OSIF_ERROR;

/*
 * Set the endian flag, m_bIsLittleEndian, "TRUE" on little endian platforms
 */
   union { uint16_t i; byte_t b[2]; } k;
   k.i=256;
   m_bIsLittleEndian=k.b[1];

/*
 * OSI needs to have been initialised (by the application)
 */
   if(!I2CM_IsInitialised())
   {
      I2CM_Init();
   }
   if(I2CM_IsInitialised())
   {
      if(l_bInit!=0)
      {
         rc=OSIF_SUCCESS;
         l_bInit=0;
      }
   } else
   {
      if(l_bInit==0)
      {
         OSIF_deinit();
         l_bInit=1;
      }
   }
   return rc;
}
예제 #2
0
/*******************************************************************************
* Function Name: I2CM_Start
********************************************************************************
*
* Summary:
*  Invokes SCB_Init() and SCB_Enable().
*  After this function call, the component is enabled and ready for operation.
*  When configuration is set to "Unconfigured SCB", the component must first be
*  initialized to operate in one of the following configurations: I2C, SPI, UART
*  or EZ I2C. Otherwise this function does not enable the component.
*
* Parameters:
*  None
*
* Return:
*  None
*
* Global variables:
*  I2CM_initVar - used to check initial configuration, modified
*  on first function call.
*
*******************************************************************************/
void I2CM_Start(void)
{
    if (0u == I2CM_initVar)
    {
        I2CM_Init();
        I2CM_initVar = 1u; /* Component was initialized */
    }

    I2CM_Enable();
}