STM32LIB
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
STM32LIB::WAIT Class Reference

The class that implements the active waiting pause. More...

#include <WAIT.hpp>

Public Member Functions

void __attribute__ ((interrupt("IRQ"))) SysTick_Handler(void)
 The SysTick interrupt function. More...
 

Static Public Member Functions

static void init (void)
 Initiate the SysTick timer and sets the interrupts. More...
 
static void wait_ms (uint32_t ms)
 Wait for ms milliseconds. More...
 
static void wait_s (uint32_t s)
 Wait for ms seconds. More...
 

Static Public Attributes

static volatile uint32_t _Milliseconds =0
 Internal milliseconds counter. More...
 
static volatile uint32_t _Seconds =0
 Internal seconds counter. More...
 

Detailed Description

The class that implements the active waiting pause.

It uses the SysTick that fires an interrupt each 1ms. All the elements are static so it doesn't need to be initialized.

int main (void){
WAIT::init(); //sets the SysTick timer to fire each ms, activate the interrupts
//note that the class isn't instantiated
WAIT::wait_ms(100); //wait 100ms
}
See also
STM32LIB::SysTick_Handler(void)

Member Function Documentation

static void STM32LIB::WAIT::init ( void  )
inlinestatic

Initiate the SysTick timer and sets the interrupts.

static void STM32LIB::WAIT::wait_ms ( uint32_t  ms)
inlinestatic

Wait for ms milliseconds.

Parameters
msthe number of milliseconds to wait
static void STM32LIB::WAIT::wait_s ( uint32_t  s)
inlinestatic

Wait for ms seconds.

Parameters
sthe number of seconds to wait
void __attribute__ ( (interrupt("IRQ"))  )

The SysTick interrupt function.

Note the extern "C" and the weak attribute (this allows to be used for other libs)

Member Data Documentation

volatile uint32_t STM32LIB::WAIT::_Milliseconds =0
static

Internal milliseconds counter.

volatile uint32_t STM32LIB::WAIT::_Seconds =0
static

Internal seconds counter.


The documentation for this class was generated from the following files: