CircleOS  1
Functions
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)
 
char * UTIL_GetVersion (void)
 
void UTIL_SetSchHandler (enum eSchHandler Ix, tHandler pHDL)
 
tHandler UTIL_GetSchHandler (enum eSchHandler Ix)
 
bool UTIL_IsStandAloneMode (void)
 
u16 UTIL_GetBatStatus (void)
 
NODEBUG2 uint_t UTIL_SaveScreenBMP (char *filename)
 
void UTIL_SetDividerHandler (enum eSchHandler IDx, u16 divider)
 
u16 UTIL_GetDividerHandler (enum eSchHandler IDx)
 

Detailed Description

Author
RT
Date
07/2007
Version
4.0 Add Open4 Primer
Date
10/2009
Version
4.4 Add divider handler management
Date
07/2013

Definition in file Util.c.

Function Documentation

u16 UTIL_GetBatStatus ( void  )

Reads the status of the battery charger.

Returns
flagsta : 0 : battery is absent or dead (green on and red on) 1 : charged (green on and red off) 2 : battery is being charged (green off and red on) 3 : power supplied by battery (green off and red off) = normal mode

Definition at line 366 of file Util.c.

u16 UTIL_GetDividerHandler ( enum eSchHandler  IDx)

Get the current divider for a SCHEDULER handler. With UTIL_GetDividerHandler(), these functions allow to take the control of the different handler. See scheduler.c to understand further...

Parameters
[in]IDxID if the SCH Handler
Returns
divider.

Definition at line 544 of file Util.c.

enum eSpeed UTIL_GetPll ( void  )

Get clock frequency

Returns
Current clock speed from very low to very fast.

Definition at line 240 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]IxID is the SCH Handler
Returns
A pointer to the current handler, or 0 in case of an error.

Definition at line 316 of file Util.c.

char* UTIL_GetVersion ( void  )

Get CircleOS version.

Returns
A pointer to a string containing the CircleOS version.

Definition at line 258 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]ptrThe output string.
[in]XThe unsigned value to convert.
[in]digitThe number of digits in the output string.
[in]fillwithzero0 fill with blanks. 1 fill with zeros.

Definition at line 222 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 345 of file Util.c.

NODEBUG2 uint_t UTIL_SaveScreenBMP ( char *  filename)

Definition at line 383 of file Util.c.

void UTIL_SetDividerHandler ( enum eSchHandler  IDx,
u16  divider 
)

Set the current divider for a SCHEDULER handler. With UTIL_GetDividerHandler(), these functions allow to take the control of the different handler. See scheduler.c to understand further...

Parameters
[in]IDxID if the SCH Handler
[in]dividernew ticks divider of the handler

Definition at line 522 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]IxID if the SCH Handler
[in]pHDLPointer to the handler.

Definition at line 284 of file Util.c.

void UTIL_SetTempMode ( bool  mode)

Set the temperature mode (F/C)

Parameters
[in]mode0: Celcius, 1: Fahrenheit

Definition at line 172 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]ptrThe output string.
[in]XThe unsigned value to convert.
[in]digitThe number of digits in the output string.
[in]fillwithzero0 fill with blanks. 1 fill with zeros.

Definition at line 198 of file Util.c.