Util.c File Reference

Various common utilities for CircleOS. More...

Go to the source code of this file.

Functions

void UTIL_SetTempMode (bool mode)
void UTIL_uint2str (u8 *ptr, uint_t X, len_t digit, bool fillwithzero)
void UTIL_int2str (u8 *ptr, int_t X, len_t digit, bool fillwithzero)
enum eSpeed UTIL_GetPll (void)
const u8 * UTIL_GetVersion (void)
void UTIL_SetSchHandler (enum eSchHandler Ix, tHandler pHDL)
tHandler UTIL_GetSchHandler (enum eSchHandler Ix)
bool UTIL_IsStandAloneMode (void)

Detailed Description

Author:
RT
Date:
07/2007
Version:
4.0 Add Open4 Primer
Date:
10/2009

Definition in file Util.c.


Function Documentation

enum eSpeed UTIL_GetPll ( void   ) 

Get clock frequency

Returns:
Current clock speed from very low to very fast.

Definition at line 229 of file Util.c.

tHandler UTIL_GetSchHandler ( enum eSchHandler  Ix  ) 

Get the current SCHEDULER handler. With UTIL_SetSchHandler(), these functions allow to take the control of the different handler. You can:

  • replace them (get-Set)by your own handler
  • disable a handler: UTIL_SetSchHandler(Ix,0);
  • create a new handler (using the unused handlers). See scheduler.c to understand further...
Parameters:
[in] Ix ID is the SCH Handler
Returns:
A pointer to the current handler, or 0 in case of an error.

Definition at line 298 of file Util.c.

const u8* UTIL_GetVersion ( void   ) 

Get CircleOS version.

Returns:
A pointer to a string containing the CircleOS version.

Definition at line 247 of file Util.c.

void UTIL_int2str ( u8 *  ptr,
int_t  X,
len_t  digit,
bool  fillwithzero 
)

Convert a signed integer into a string. Using this function leads to much smaller code than using the sprintf() function from the C library.

Parameters:
[out] ptr The output string.
[in] X The unsigned value to convert.
[in] digit The number of digits in the output string.
[in] fillwithzero 
  • 0 fill with blanks.
  • 1 fill with zeros.

Definition at line 211 of file Util.c.

bool UTIL_IsStandAloneMode ( void   ) 

Get the current mode of the Primer.

Returns:
1 if "stand alone" mode detected. 0 if "in base" mode detected.

Definition at line 320 of file Util.c.

void UTIL_SetSchHandler ( enum eSchHandler  Ix,
tHandler  pHDL 
)

Redirect a SCHEDULER handler. Set the current SCHEDULER handler. With UTIL_GetSchHandler(), these functions allow to take the control of the different handler. You can:

  • replace them (get-Set)by your own handler
  • disable a handler: UTIL_SetSchHandler(Ix,0);
  • create a new handler (using the unused handlers). See scheduler.c to understand further...
Parameters:
[in] Ix ID if the SCH Handler
[in] pHDL Pointer to the handler.

Definition at line 273 of file Util.c.

void UTIL_SetTempMode ( bool  mode  ) 

Set the temperature mode (F/C)

Parameters:
[in] mode 0: Celcius, 1: Fahrenheit

Definition at line 161 of file Util.c.

void UTIL_uint2str ( u8 *  ptr,
uint_t  X,
len_t  digit,
bool  fillwithzero 
)

Convert an unsigned integer into a string. Using this function leads to much smaller code than using the sprintf() function from the C library.

Parameters:
[out] ptr The output string.
[in] X The unsigned value to convert.
[in] digit The number of digits in the output string.
[in] fillwithzero 
  • 0 fill with blanks.
  • 1 fill with zeros.

Definition at line 187 of file Util.c.