WebRadioApp  0.1
ew_bsp_clock.c File Reference

This file is part of the interface (glue layer) between an Embedded Wizard generated UI application and the board support package (BSP) of a dedicated target. Please note: The implementation of this module is partially based on examples that are provided within the STM32 cube firmware. In case you want to adapt this module to your custom specific hardware, please adapt the hardware initialization code according your needs or integrate the generated initialization code created by using the tool CubeMX. This template is responsible to initialize the system clock of the hardware, to provide a timer tick for the Embedded Wizard UI application and to get access to the realtime clock (RTC). Additionally, this file contains some performance measurements to analyse the CPU usage of the UI application. More...

#include "ewconfig.h"
#include "stm32h7xx_hal.h"
#include "stm32h747i_discovery.h"
#include "ew_bsp_clock.h"
#include <string.h>
Include dependency graph for ew_bsp_clock.c:

Macros

#define RTC_CLOCK_SOURCE_LSI
 
#define RTC_ASYNCH_PREDIV   0x7F
 
#define RTC_SYNCH_PREDIV   0xF9
 
#define RtcTicksPerSecond   (1UL)
 
#define RtcTicksPerMinute   (RtcTicksPerSecond * 60UL)
 
#define RtcTicksPerHour   (RtcTicksPerMinute * 60UL)
 
#define RtcTicksPerDay   (RtcTicksPerHour * 24UL)
 

Functions

void HAL_RTC_MspInit (RTC_HandleTypeDef *hrtc)
 RTC MSP Initialization This function configures the hardware resources used in this example. More...
 
void HAL_RTC_MspDeInit (RTC_HandleTypeDef *hrtc)
 RTC MSP De-Initialization This function frees the hardware resources used in this example: More...
 
void EwBspClockInit (void)
 Initialises the system clock and the real time clock. More...
 
void EwBspClockTickIncrement (void)
 The function EwBspClockTickIncrement increments the millisecond counter, which is used by the Runtime Environment (RTE) to trigger timer events. More...
 
unsigned long EwBspClockGetTicks (void)
 The function EwBspClockGetTicks returns the current ticks counter value. More...
 
unsigned long EwBspClockGetTime (void)
 Returns the current time in seconds since 01.01.1970. More...
 
void EwBspClockSetTime (unsigned long aTime)
 Sets the given time in seconds since 01.01.1970 at real time clock (RTC). More...
 
int EwBspClockGetCpuLoad (void)
 Returns the current CPU load as percent value. More...
 
void EwBspClockCpuLoadSetActive (void)
 Starts the CPU load counting. Call this function whenever CPU processing is needed. More...
 
void EwBspClockCpuLoadSetIdle (void)
 Stops the CPU load counting. Call this function whenever CPU processing is currently not needed since the program execution is waiting for some system event. More...
 

Variables

const unsigned long DaysToMonth []
 
const unsigned long DaysToMonthInLeapYear []
 
static volatile unsigned long EmWiSystemTicks = 0
 
static RTC_HandleTypeDef RtcHandle
 
volatile int XTAL_Min
 
volatile int XTAL_Hour
 
volatile int XTAL_Sec
 
volatile int XTAL_Day
 
volatile int XTAL_Month
 
volatile int XTAL_Year
 

Detailed Description

This file is part of the interface (glue layer) between an Embedded Wizard generated UI application and the board support package (BSP) of a dedicated target. Please note: The implementation of this module is partially based on examples that are provided within the STM32 cube firmware. In case you want to adapt this module to your custom specific hardware, please adapt the hardware initialization code according your needs or integrate the generated initialization code created by using the tool CubeMX. This template is responsible to initialize the system clock of the hardware, to provide a timer tick for the Embedded Wizard UI application and to get access to the realtime clock (RTC). Additionally, this file contains some performance measurements to analyse the CPU usage of the UI application.

Author
Kevin Bello (k.bel.nosp@m.lo@t.nosp@m.um.de)
Version
0.1
Date
2021-04-17