Merge remote-tracking branch 'refs/remotes/origin/master' into Scheduler
This commit is contained in:
commit
c2ff566c46
@ -15,6 +15,7 @@
|
|||||||
#ifndef DRIVERS_SYSTEM_CLOCK_H_
|
#ifndef DRIVERS_SYSTEM_CLOCK_H_
|
||||||
#define DRIVERS_SYSTEM_CLOCK_H_
|
#define DRIVERS_SYSTEM_CLOCK_H_
|
||||||
|
|
||||||
|
#include "stm32f4xx.h"
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* BRIEF: Starts the system clock at 100MHz *
|
* BRIEF: Starts the system clock at 100MHz *
|
||||||
|
@ -8,8 +8,7 @@
|
|||||||
* -------- ---- ----------- *
|
* -------- ---- ----------- *
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include <drivers/system_clock.h>
|
#include "drivers/system_clock.h"
|
||||||
#include "stm32f4xx.h"
|
|
||||||
|
|
||||||
//the number of clock cycles per microsecond
|
//the number of clock cycles per microsecond
|
||||||
static uint32_t usTicks = 0;
|
static uint32_t usTicks = 0;
|
||||||
@ -18,7 +17,7 @@ static uint32_t usTicks = 0;
|
|||||||
* BRIEF: Starts the system clock at 100MHz *
|
* BRIEF: Starts the system clock at 100MHz *
|
||||||
* INFORMATION: In the current version it works with ADC and DMA *
|
* INFORMATION: In the current version it works with ADC and DMA *
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
void SystemClock_Config(void)
|
void system_clock_config(void)
|
||||||
{
|
{
|
||||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||||
@ -69,13 +68,13 @@ uint32_t clock_get_us()
|
|||||||
|
|
||||||
//make sure that the system tick interrupt does not happen during the time we fetch microsecond from the register
|
//make sure that the system tick interrupt does not happen during the time we fetch microsecond from the register
|
||||||
do {
|
do {
|
||||||
ms = get_ms();
|
ms = clock_get_ms();
|
||||||
cycle_cnt = SysTick->VAL;
|
cycle_cnt = SysTick->VAL;
|
||||||
|
|
||||||
//If the SysTick timer expired during the previous instruction, we need to give it a little time for that
|
//If the SysTick timer expired during the previous instruction, we need to give it a little time for that
|
||||||
//interrupt to be delivered before we can recheck sysTickUptime:
|
//interrupt to be delivered before we can recheck sysTickUptime:
|
||||||
asm volatile("\tnop\n");
|
asm volatile("\tnop\n");
|
||||||
} while (ms != get_ms());
|
} while (ms != clock_get_ms());
|
||||||
|
|
||||||
assert_param(us >= 1000);
|
assert_param(us >= 1000);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user