Util.c File Reference

Various utilities for STM32 CircleOS. More...


Functions

u16 UTIL_GetBat (void)
u16 UTIL_GetTemp (void)
void UTIL_SetTempMode (int mode)
u8 UTIL_GetUsb (void)
void UTIL_uint2str (char *ptr, u32 X, u16 digit, int fillwithzero)
void UTIL_int2str (char *ptr, s32 X, u16 digit, int fillwithzero)
void UTIL_SetPll (enum eSpeed speed)
enum eSpeed UTIL_GetPll (void)
const char * UTIL_GetVersion (void)
u16 UTIL_ReadBackupRegister (u16 BKP_DR)
void UTIL_WriteBackupRegister (u16 BKP_DR, u16 Data)
void UTIL_SetIrqHandler (int Offs, tHandler pHDL)
tHandler UTIL_GetIrqHandler (int Offs)
void UTIL_SetSchHandler (enum eSchHandler Ix, tHandler pHDL)
tHandler UTIL_GetSchHandler (enum eSchHandler Ix)


Detailed Description

Author:
RT
Date:
07/2007

Function Documentation

u16 UTIL_GetBat ( void   ) 

Return the batterie tension in mV.

Returns:
Batterie tension in mV.

tHandler UTIL_GetIrqHandler ( int  Offs  ) 

Get the current IRQ handler. Since (V1.6) the vector table is relocated in RAM, the vectors can be easily modified by the applications.

Parameters:
[in] Offs Address in the NVIC table
Returns:
A pointer to the current handler.

enum eSpeed UTIL_GetPll ( void   ) 

Get clock frequency

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

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:

Parameters:
[in] Ix ID is the SCH Handler
Returns:
A pointer to the current handler.

u16 UTIL_GetTemp ( void   ) 

Return the Temperature: degrees / 10, Celcius or Fahrenheit.

Returns:
The temperature (C or F) (averaging of several channels).

u8 UTIL_GetUsb ( void   ) 

Return the USB connexion state.

Returns:
The USB connexion state.

const char* UTIL_GetVersion ( void   ) 

Get CircleOS version.

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

void UTIL_int2str ( char *  ptr,
s32  X,
u16  digit,
int  fillwithzero 
)

Convert a signed integer into a string.

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.

u16 UTIL_ReadBackupRegister ( u16  BKP_DR  ) 

Reads data from the specified Data Backup Register.

Parameters:
[in] BKP_DR Specifies the Data Backup Register. This parameter can be BKP_DRx where x:[1, 10]
Returns:
The content of the specified Data Backup Register.

void UTIL_SetIrqHandler ( int  Offs,
tHandler  pHDL 
)

Redirect an IRQ handler.

Parameters:
[in] Offs Address in the NVIC table
[in] pHDL Pointer to the handler.

void UTIL_SetPll ( enum eSpeed  speed  ) 

Set clock frequency (lower to save energy)

Parameters:
[in] speed New clock speed from very low to very fast.

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:

Parameters:
[in] Ix ID if the SCH Handler
[in] pHDL Pointer to the handler.

void UTIL_SetTempMode ( int  mode  ) 

Set the temperature mode (F/C)

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

void UTIL_uint2str ( char *  ptr,
u32  X,
u16  digit,
int  fillwithzero 
)

Convert an unsigned integer into a string.

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.

void UTIL_WriteBackupRegister ( u16  BKP_DR,
u16  Data 
)

Writes data to the specified Data Backup Register.

Parameters:
[in] BKP_DR Specifies the Data Backup Register. This parameter can be BKP_DRx where x:[1, 10]
[in] Data The data to write.