Formatting fixes for libperipherals

This commit is contained in:
e.gavrin
2014-08-12 00:15:13 +04:00
parent 839ad7e4b4
commit 0510b66504
6 changed files with 68 additions and 77 deletions
+6 -2
View File
@@ -81,7 +81,9 @@ led_blink_once (uint32_t led_id)
} }
#ifdef __TARGET_MCU #ifdef __TARGET_MCU
void initialize_leds()
void
initialize_leds ()
{ {
RCC_AHB1PeriphClockCmd (RCC_AHB1Periph_GPIOD, ENABLE); RCC_AHB1PeriphClockCmd (RCC_AHB1Periph_GPIOD, ENABLE);
@@ -91,6 +93,8 @@ void initialize_leds()
gpioStructure.GPIO_Speed = GPIO_Speed_100MHz; gpioStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_Init (GPIOD, &gpioStructure); GPIO_Init (GPIOD, &gpioStructure);
GPIO_WriteBit(GPIOD, GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15, Bit_RESET); GPIO_WriteBit (GPIOD,
GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15;,
Bit_RESET);
} }
#endif #endif
+13 -24
View File
@@ -17,7 +17,6 @@
#include "jerry-libc.h" #include "jerry-libc.h"
#ifdef __TARGET_MCU #ifdef __TARGET_MCU
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" #pragma GCC diagnostic ignored "-Wpedantic"
#pragma GCC diagnostic ignored "-Wsign-conversion" #pragma GCC diagnostic ignored "-Wsign-conversion"
@@ -30,7 +29,6 @@
#define LED_ORANGE 13 #define LED_ORANGE 13
#define LED_RED 14 #define LED_RED 14
#define LED_BLUE 15 #define LED_BLUE 15
#endif #endif
int int
@@ -64,11 +62,6 @@ wait_ms (uint32_t time_ms)
// 1 millisecond = 1,000,000 Nanoseconds // 1 millisecond = 1,000,000 Nanoseconds
#define NANO_SECOND_MULTIPLIER 1000000 #define NANO_SECOND_MULTIPLIER 1000000
__printf ("wait_ms: %d\n", time_ms); __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 #endif
#ifdef __TARGET_MCU #ifdef __TARGET_MCU
@@ -81,7 +74,8 @@ wait_ms (uint32_t time_ms)
#ifdef __TARGET_MCU #ifdef __TARGET_MCU
void initialize_timer() void
initialize_timer ()
{ {
RCC_APB1PeriphClockCmd (RCC_APB1Periph_TIM2, ENABLE); RCC_APB1PeriphClockCmd (RCC_APB1Periph_TIM2, ENABLE);
@@ -107,24 +101,17 @@ fake_exit (void)
while (1) 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);
gpio->BSRRL = (uint16_t) (1 << pin); for (index = 0; index < dot; index++); gpio->BSRRH = (uint16_t) (1 << pin); for (index = 0; index < dash; index++); for ( index = 0; index < dot; 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->BSRRH = (uint16_t) (1 << pin);
gpio->BSRRL = (uint16_t) (1 << pin); for (index = 0; index < dash; index++); gpio->BSRRH = (uint16_t) (1 << pin); for (index = 0; index < dash; index++); 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++);
} }
} }
static __IO uint32_t sys_tick_counter; static __IO uint32_t sys_tick_counter;
void void
@@ -153,7 +140,9 @@ get_sys_tick_counter(void)
return sys_tick_counter; return sys_tick_counter;
} }
void SysTick_Handler(void) { void
SysTick_Handler (void)
{
time_tick_decrement (); time_tick_decrement ();
} }
-1
View File
@@ -26,7 +26,6 @@ void analog_write(uint32_t, uint32_t);
void wait_ms (uint32_t); void wait_ms (uint32_t);
#ifdef __TARGET_MCU #ifdef __TARGET_MCU
void fake_exit (void); void fake_exit (void);
-1
View File
@@ -19,4 +19,3 @@
#include "globals.h" #include "globals.h"
#endif /* SENSORS_H */ #endif /* SENSORS_H */