Formatting fixes for libperipherals
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
#include "jerry-libc.h"
|
||||
|
||||
#ifdef __TARGET_MCU
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
@@ -30,7 +29,6 @@
|
||||
#define LED_ORANGE 13
|
||||
#define LED_RED 14
|
||||
#define LED_BLUE 15
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
@@ -64,15 +62,10 @@ wait_ms (uint32_t time_ms)
|
||||
// 1 millisecond = 1,000,000 Nanoseconds
|
||||
#define NANO_SECOND_MULTIPLIER 1000000
|
||||
__printf ("wait_ms: %d\n", time_ms);
|
||||
// const long interval_ms = time_ms * NANO_SECOND_MULTIPLIER;
|
||||
//
|
||||
// timespec sleep_value = {0};
|
||||
// sleep_value.tv_nsec = interval_ms;
|
||||
// nanosleep (&sleep_value, NULL);
|
||||
#endif
|
||||
|
||||
#ifdef __TARGET_MCU
|
||||
while (time_ms--)
|
||||
while (time_ms --)
|
||||
{
|
||||
wait_1ms ();
|
||||
}
|
||||
@@ -81,18 +74,19 @@ wait_ms (uint32_t time_ms)
|
||||
|
||||
#ifdef __TARGET_MCU
|
||||
|
||||
void initialize_timer()
|
||||
void
|
||||
initialize_timer ()
|
||||
{
|
||||
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
|
||||
RCC_APB1PeriphClockCmd (RCC_APB1Periph_TIM2, ENABLE);
|
||||
|
||||
TIM_TimeBaseInitTypeDef timerInitStructure;
|
||||
timerInitStructure.TIM_Prescaler = 40000;
|
||||
timerInitStructure.TIM_CounterMode = TIM_CounterMode_Up;
|
||||
timerInitStructure.TIM_Period = 500;
|
||||
timerInitStructure.TIM_ClockDivision = TIM_CKD_DIV1;
|
||||
timerInitStructure.TIM_RepetitionCounter = 0;
|
||||
TIM_TimeBaseInit(TIM2, &timerInitStructure);
|
||||
TIM_Cmd(TIM2, ENABLE);
|
||||
TIM_TimeBaseInitTypeDef timerInitStructure;
|
||||
timerInitStructure.TIM_Prescaler = 40000;
|
||||
timerInitStructure.TIM_CounterMode = TIM_CounterMode_Up;
|
||||
timerInitStructure.TIM_Period = 500;
|
||||
timerInitStructure.TIM_ClockDivision = TIM_CKD_DIV1;
|
||||
timerInitStructure.TIM_RepetitionCounter = 0;
|
||||
TIM_TimeBaseInit (TIM2, &timerInitStructure);
|
||||
TIM_Cmd (TIM2, ENABLE);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -104,27 +98,20 @@ fake_exit (void)
|
||||
|
||||
int dot = 600000;
|
||||
int dash = dot * 3;
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
gpio->BSRRL = (uint16_t) (1 << pin); for (index = 0; index < dot; index++); gpio->BSRRH = (uint16_t) (1 << pin); for (index = 0; index < dash; index++);
|
||||
gpio->BSRRL = (uint16_t) (1 << pin); for (index = 0; index < dot; index++); gpio->BSRRH = (uint16_t) (1 << pin); for (index = 0; index < dash; index++);
|
||||
gpio->BSRRL = (uint16_t) (1 << pin); for (index = 0; index < dot; index++); gpio->BSRRH = (uint16_t) (1 << pin); for (index = 0; index < dash; index++);
|
||||
|
||||
gpio->BSRRL = (uint16_t) (1 << pin); for (index = 0; index < dash; index++); gpio->BSRRH = (uint16_t) (1 << pin); for (index = 0; index < dash; index++);
|
||||
gpio->BSRRL = (uint16_t) (1 << pin); for (index = 0; index < dash; index++); gpio->BSRRH = (uint16_t) (1 << pin); for (index = 0; index < dash; index++);
|
||||
gpio->BSRRL = (uint16_t) (1 << pin); for (index = 0; index < dash; index++); gpio->BSRRH = (uint16_t) (1 << pin); for (index = 0; index < dash; index++);
|
||||
|
||||
gpio->BSRRL = (uint16_t) (1 << pin); for (index = 0; index < dot; index++); gpio->BSRRH = (uint16_t) (1 << pin); for (index = 0; index < dash; index++);
|
||||
gpio->BSRRL = (uint16_t) (1 << pin); for (index = 0; index < dot; index++); gpio->BSRRH = (uint16_t) (1 << pin); for (index = 0; index < dash; index++);
|
||||
gpio->BSRRL = (uint16_t) (1 << pin); for (index = 0; index < dot; index++); gpio->BSRRH = (uint16_t) (1 << pin);
|
||||
|
||||
for (index = 0; index < dash * 7; index++);
|
||||
gpio->BSRRL = (uint16_t) (1 << pin);
|
||||
for ( index = 0; index < dot; index ++)
|
||||
{
|
||||
};
|
||||
gpio->BSRRH = (uint16_t) (1 << pin);
|
||||
for (index = 0; index < dash; index ++)
|
||||
{
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static __IO uint32_t sys_tick_counter;
|
||||
|
||||
void
|
||||
@@ -142,19 +129,21 @@ initialize_sys_tick (void)
|
||||
}
|
||||
|
||||
void
|
||||
set_sys_tick_counter(uint32_t set_value)
|
||||
set_sys_tick_counter (uint32_t set_value)
|
||||
{
|
||||
sys_tick_counter = set_value;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
get_sys_tick_counter(void)
|
||||
get_sys_tick_counter (void)
|
||||
{
|
||||
return sys_tick_counter;
|
||||
}
|
||||
|
||||
void SysTick_Handler(void) {
|
||||
time_tick_decrement();
|
||||
void
|
||||
SysTick_Handler (void)
|
||||
{
|
||||
time_tick_decrement ();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -162,7 +151,7 @@ time_tick_decrement (void)
|
||||
{
|
||||
if (sys_tick_counter != 0x00)
|
||||
{
|
||||
sys_tick_counter--;
|
||||
sys_tick_counter --;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user