-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #158: add API to get configured clock rate
- Loading branch information
1 parent
d372e8f
commit 0446bab
Showing
4 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
src/lib/stm32/stm32l0/CatenaStm32L0_GetSystemClockRate.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
Module: CatenaStm32L0_GetSystemClockRate.cpp | ||
Function: | ||
CatenaStm32L0::GetSystemClockRate() | ||
Copyright notice: | ||
See accompanying license | ||
Author: | ||
Terry Moore, MCCI Corporation April 2019 | ||
*/ | ||
|
||
#ifdef ARDUINO_ARCH_STM32 | ||
|
||
#include "CatenaStm32L0.h" | ||
|
||
#include <Arduino.h> | ||
|
||
using namespace McciCatena; | ||
|
||
/****************************************************************************\ | ||
| | ||
| Manifest constants & typedefs. | ||
| | ||
\****************************************************************************/ | ||
|
||
|
||
/****************************************************************************\ | ||
| | ||
| Read-only data. | ||
| | ||
\****************************************************************************/ | ||
|
||
|
||
|
||
/****************************************************************************\ | ||
| | ||
| Variables. | ||
| | ||
\****************************************************************************/ | ||
|
||
|
||
/* | ||
Name: CatenaStm32L0::GetSystemCLockRate | ||
Function: | ||
Return the system clock rate | ||
Definition: | ||
virtual uint64_t CatenaStm32L0::GetSystemClockRate( | ||
void | ||
) const override; | ||
Description: | ||
The clock rate returned is the value set at compile time | ||
by CATENA_CFG_SYSCLK. The value we return is the correct | ||
nominal value, in Hz. | ||
Returns: | ||
Analog value | ||
*/ | ||
|
||
uint64_t CatenaStm32L0::GetSystemClockRate( | ||
void | ||
) const | ||
{ | ||
switch (CATENA_CFG_SYSCLK) | ||
{ | ||
case 2: | ||
return 2097 * 1000; | ||
case 4: | ||
return 4194 * 1000; | ||
case 16: | ||
return 16 * 1000 * 1000; | ||
case 24: | ||
return 24 * 1000 * 1000; | ||
default: | ||
case 32: | ||
return 32 * 1000 * 1000; | ||
} | ||
} | ||
|
||
#endif // ARDUINO_ARCH_STM32 | ||
|
||
/**** end of CatenaStm32L0_GetSystemClockRate.cpp ****/ |