GlobLib
HAL and API libraries for MCUs and hardware.

This module contains low level functions for systick usage. More...

Files

file  stm32f103cb_systick.h
 Header file for stm32f103cb SYSTICK.
 

Macros

#define SYSTICK   27
 This is a dummy define so that USB_coms() can use systick as a timer option.
 

Functions

mcu_error SYSTICK_setup (uint32_t timeout, void(*handler)(void))
 Sets up systick and handler. More...
 
mcu_error SYSTICK_timeout (uint32_t timeout)
 Change the systick timeout value. More...
 
void SYSTICK_handler (void(*handler)(void))
 Sets the handler called on interrupt event. More...
 
uint32_t SYSTICK_count (void)
 Get the current clock value. More...
 
void SYSTICK_stop (void)
 Stop the systick counter. More...
 
void SYSTICK_start (void)
 Start the systick counter. More...
 

Detailed Description

This module contains low level functions for systick usage.

Author
Stuart Ianna
Version
0.1
Date
June 2018
Warning
None
Bug:
Todo:
Compilers
  • arm-none-eabi-gcc (15:4.9.3+svn231177-1) 4.9.3 20150529 (prerelease)
Example Usage
void flash(void);
int main(void)
{
//Enable LED pin
//Setup systick timeout and handler, handler must be void(*handler)(void)
SYSTICK_setup(500000,&flash);
//Done
while (1);
return 0;
}
//This gets called on systick timeout
void flash(void){
}

Function Documentation

uint32_t SYSTICK_count ( void  )

Get the current clock value.

Returns
The current value of the clock.

Definition at line 91 of file stm32f103cb_systick.c.

void SYSTICK_handler ( void(*)(void)  handler)

Sets the handler called on interrupt event.

Parameters
handlerThe function to be called on interrupt event
Returns
none

Definition at line 78 of file stm32f103cb_systick.c.

mcu_error SYSTICK_setup ( uint32_t  timeout,
void(*)(void)  handler 
)

Sets up systick and handler.

This function checks if the timeout value specified is possible, defaults to ..... if not.

Parameters
timeoutThe desired timeout in microseconds
handlerThe function to be called on interrupt event
Returns
Error code define by mcu_error, SYSTICK_NOERROR if no error, SYSTICK_TOSHORT if timeout value is too small

Definition at line 23 of file stm32f103cb_systick.c.

void SYSTICK_start ( void  )

Start the systick counter.

Systick counter must have been set up with SYSTICK_setup() before this is used.

Returns
The current value of the clock.

Definition at line 102 of file stm32f103cb_systick.c.

void SYSTICK_stop ( void  )

Stop the systick counter.

Returns
The current value of the clock.

Definition at line 108 of file stm32f103cb_systick.c.

mcu_error SYSTICK_timeout ( uint32_t  timeout)

Change the systick timeout value.

This function checks if the timeout value specified is possible, defaults to ..... if not.

Parameters
timeoutThe desired timeout in microseconds
Returns
Error code define by mcu_error, SYSTICK_NOERROR if no error, SYSTICK_TOOLONG if timeout value is too small

Definition at line 33 of file stm32f103cb_systick.c.