sbgECom Library  4.0.1987-stable
C library to interface SBG Systems IMU/AHRS/INS
sbgPlatform.h File Reference

Platform-specific functions. More...

#include <sbgDefines.h>
#include <sbgErrorCodes.h>
#include <debug/sbgDebug.h>

Go to the source code of this file.

Typedefs

typedef void(* SbgCommonLibOnLogFunc) (const char *pFileName, const char *pFunctionName, uint32_t line, const char *pCategory, SbgDebugLogType logType, SbgErrorCode errorCode, const char *pMessage)
 

Functions

SBG_COMMON_LIB_API uint32_t sbgGetTime (void)
 
SBG_COMMON_LIB_API void sbgSleep (uint32_t ms)
 
SBG_COMMON_LIB_API void sbgCommonLibSetLogCallback (SbgCommonLibOnLogFunc logCallback)
 
SBG_COMMON_LIB_API void sbgPlatformDebugLogMsg (const char *pFileName, const char *pFunctionName, uint32_t line, const char *pCategory, SbgDebugLogType logType, SbgErrorCode errorCode, const char *pFormat,...) SBG_CHECK_FORMAT(printf
 

Detailed Description

Platform-specific functions.

Author
SBG Systems
Date
March 17, 2015

This file should be modified to each targeted platform. For example, all common headers should be included from this file.

The platform endianness should be defined here.

License

The MIT license

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Typedef Documentation

◆ SbgCommonLibOnLogFunc

typedef void(* SbgCommonLibOnLogFunc) (const char *pFileName, const char *pFunctionName, uint32_t line, const char *pCategory, SbgDebugLogType logType, SbgErrorCode errorCode, const char *pMessage)

Type for logging functions.

Parameters
[in]pFileNameFile name where the error occurred.
[in]pFunctionNameFunction name where the error occurred.
[in]lineLine number where the error occurred.
[in]pCategoryCategory for this log or "None" if no category has been specified.
[in]logTypeDefine if we have an error, a warning, an info or a debug log.
[in]errorCodeThe error code associated with the message.
[in]pMessageThe message to log.

Function Documentation

◆ sbgGetTime()

SBG_COMMON_LIB_API uint32_t sbgGetTime ( void  )

Get the current time.

Returns
The current time, in ms.

◆ sbgSleep()

SBG_COMMON_LIB_API void sbgSleep ( uint32_t  ms)

Sleep.

Parameters
[in]msTime to wait, in ms.

◆ sbgCommonLibSetLogCallback()

SBG_COMMON_LIB_API void sbgCommonLibSetLogCallback ( SbgCommonLibOnLogFunc  logCallback)

Set the log function.

Some platforms may not provide the ability to set a user-provided log function, in which case this function does nothing.

Parameters
[in]logCallbackLog function.

◆ sbgPlatformDebugLogMsg()

SBG_COMMON_LIB_API void sbgPlatformDebugLogMsg ( const char *  pFileName,
const char *  pFunctionName,
uint32_t  line,
const char *  pCategory,
SbgDebugLogType  logType,
SbgErrorCode  errorCode,
const char *  pFormat,
  ... 
)

Log a message.

Parameters
[in]pFileNameFile name where the error occurred.
[in]pFunctionNameFunction name where the error occurred.
[in]lineLine number where the error occurred.
[in]pCategoryCategory for this log or "None" if no category has been specified.
[in]logTypeDefine if we have an error, a warning, an info or a debug log.
[in]errorCodeThe error code associated with the message.
[in]pFormatThe error message that will be used with the variable list of arguments.