libraries/hshcal001.c
int32_t HSHCAL001_RegisterBusIO(HSHCAL001_Object_t *pObj, HSHCAL001_IO_t *pIO)
{
  int32_t ret;

  if (pObj == NULL)
  {
    ret = HSHCAL001_ERROR;
  }
  else
  {
    pObj->IO.Init      = pIO->Init;
    pObj->IO.DeInit    = pIO->DeInit;
    pObj->IO.BusType   = pIO->BusType;
    pObj->IO.Address   = pIO->Address;
    pObj->IO.WriteReg  = pIO->WriteReg;
    pObj->IO.ReadReg   = pIO->ReadReg;
    pObj->IO.GetTick   = pIO->GetTick;

    pObj->Ctx.read_reg  = ReadRegWrap;
    pObj->Ctx.write_reg = WriteRegWrap;
    pObj->Ctx.handle   = pObj;

    if (pObj->IO.Init != NULL)
    {
      ret = pObj->IO.Init();
    }
    else
    {
      ret = HSHCAL001_ERROR;
    }
  }

  return ret;
}
/**
 * @brief  Register Component Bus IO operations
 * @param  pObj the device pObj
 * @retval 0 in case of success, an error code otherwise
 */
@brief  Register Component Bus IO operations
@param  pObj the device pObj
@retval 0 in case of success, an error code otherwise
@brief Register Component Bus IO operations @param pObj the device pObj @retval 0 in case of success an error code otherwise
int32_t HSHCAL001_RegisterBusIO(HSHCAL001_Object_t *pObj, HSHCAL001_IO_t *pIO)
{
  int32_t ret;
  if (pObj == NULL)
  {
    ret = HSHCAL001_ERROR;
  }
  else
  {
    pObj->IO.Init      = pIO->Init;
    pObj->IO.DeInit    = pIO->DeInit;
    pObj->IO.BusType   = pIO->BusType;
    pObj->IO.Address   = pIO->Address;
    pObj->IO.WriteReg  = pIO->WriteReg;
    pObj->IO.ReadReg   = pIO->ReadReg;
    pObj->IO.GetTick   = pIO->GetTick;
    pObj->Ctx.read_reg  = ReadRegWrap;
    pObj->Ctx.write_reg = WriteRegWrap;
    pObj->Ctx.handle   = pObj;
    if (pObj->IO.Init != NULL)
    {
      ret = pObj->IO.Init();
    }
    else
    {
      ret = HSHCAL001_ERROR;
    }
  }
  return ret;
}
int32_t HSHCAL001_RegisterBusIO ( HSHCAL001_Object_t * pObj , HSHCAL001_IO_t * pIO ) { int32_t ret ; if ( pObj == NULL ) { ret = HSHCAL001_ERROR ; } else { pObj -> IO . Init = pIO -> Init ; pObj -> IO . DeInit = pIO -> DeInit ; pObj -> IO . BusType = pIO -> BusType ; pObj -> IO . Address = pIO -> Address ; pObj -> IO . WriteReg = pIO -> WriteReg ; pObj -> IO . ReadReg = pIO -> ReadReg ; pObj -> IO . GetTick = pIO -> GetTick ; pObj -> Ctx . read_reg = ReadRegWrap ; pObj -> Ctx . write_reg = WriteRegWrap ; pObj -> Ctx . handle = pObj ; if ( pObj -> IO . Init != NULL ) { ret = pObj -> IO . Init ( ) ; } else { ret = HSHCAL001_ERROR ; } } return ret ; }
@brief  Register Component Bus IO operations
 @param  pObj the device pObj
 @retval 0 in case of success, an error code otherwise
@brief Register Component Bus IO operations @param pObj the device pObj @retval 0 in case of success an error code otherwise