libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
RTC peripheral API

Access functions for the Real Time Counter Controller More...

Collaboration diagram for RTC peripheral API:

Functions

void rtc_set_prescaler (uint32_t rtc, uint16_t presc)
 RTC set Prescaler value. More...
 
uint32_t rtc_get_counter (uint32_t rtc)
 RTC get Counter value. More...
 
void rtc_enable_events (uint32_t rtc, uint32_t mask)
 Enable events. More...
 
void rtc_disable_events (uint32_t rtc, uint32_t mask)
 Disable events. More...
 
void rtc_start (uint32_t rtc)
 Start the RTC. More...
 
void rtc_stop (uint32_t rtc)
 Stop the RTC. More...
 
void rtc_clear (uint32_t rtc)
 Clear the RTC. More...
 
void rtc_set_compare (uint32_t rtc, uint8_t cmp, uint32_t value)
 Set compare register. More...
 

Detailed Description

Access functions for the Real Time Counter Controller

LGPL License Terms libopencm3 License

Author
© 2016 Maxim Sloyko maxim.nosp@m.s@go.nosp@m.ogle..nosp@m.com

Function Documentation

◆ rtc_clear()

void rtc_clear ( uint32_t  rtc)

Clear the RTC.

Parameters
[in]rtcuint32_t RTC base

Definition at line 98 of file rtc.c.

References PERIPH_TRIGGER_TASK, and RTC_TASK_CLEAR.

◆ rtc_disable_events()

void rtc_disable_events ( uint32_t  rtc,
uint32_t  mask 
)

Disable events.

Parameters
[in]rtcuint32_t RTC base
[in]maskuint32_t which events to disable

Definition at line 71 of file rtc.c.

References RTC_EVTENCLR.

◆ rtc_enable_events()

void rtc_enable_events ( uint32_t  rtc,
uint32_t  mask 
)

Enable events.

Parameters
[in]rtcuint32_t RTC base
[in]maskuint32_t which events to enable

Definition at line 61 of file rtc.c.

References RTC_EVTENSET.

◆ rtc_get_counter()

uint32_t rtc_get_counter ( uint32_t  rtc)

RTC get Counter value.

Parameters
[in]rtcuint32_t RTC base

Definition at line 51 of file rtc.c.

References RTC_COUNTER.

◆ rtc_set_compare()

void rtc_set_compare ( uint32_t  rtc,
uint8_t  cmp,
uint32_t  value 
)

Set compare register.

Parameters
[in]rtcuint32_t RTC base
[in]cmpuint8_t compare number (0-3)
[in]valueuint32_t compare value

Definition at line 109 of file rtc.c.

References RTC_CC.

◆ rtc_set_prescaler()

void rtc_set_prescaler ( uint32_t  rtc,
uint16_t  presc 
)

RTC set Prescaler value.

The clock needs to be stopped for this to have any effect.

Parameters
[in]rtcuint32_t RTC base
[in]prescuint16_t 12 bit prescaler value.

Definition at line 42 of file rtc.c.

References RTC_PRESCALER.

◆ rtc_start()

void rtc_start ( uint32_t  rtc)

Start the RTC.

Parameters
[in]rtcuint32_t RTC base

Definition at line 80 of file rtc.c.

References PERIPH_TRIGGER_TASK, and RTC_TASK_START.

◆ rtc_stop()

void rtc_stop ( uint32_t  rtc)

Stop the RTC.

Parameters
[in]rtcuint32_t RTC base

Definition at line 89 of file rtc.c.

References PERIPH_TRIGGER_TASK, and RTC_TASK_STOP.