Skip to content
This repository was archived by the owner on Mar 11, 2020. It is now read-only.

Commit 3789a85

Browse files
committed
minor formatting changes
1 parent f031ee9 commit 3789a85

File tree

1 file changed

+27
-31
lines changed

1 file changed

+27
-31
lines changed

main_LPC17xx.c

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
* Copyright (C) 2009 ARM Limited. All rights reserved.
1010
*
1111
* @par
12-
* ARM Limited (ARM) is supplying this software for use with Cortex-M
13-
* processor based microcontrollers. This file can be freely distributed
12+
* ARM Limited (ARM) is supplying this software for use with Cortex-M
13+
* processor based microcontrollers. This file can be freely distributed
1414
* within development tools that are supporting such ARM based processors.
1515
*
1616
* @par
@@ -25,77 +25,73 @@
2525
#include "LPC17xx.h"
2626

2727
/*
28-
* To see how the LEDs are connected, see for instance:
28+
* To see how the LEDs are connected, refer to:
2929
* http://mbed.org/projects/libraries/svn/mbed/trunk/PinNames.h
3030
*/
31-
#define LED1 (1<<18) // LED1 = P1_18
32-
#define LED2 (1<<20) // LED2 = P1_20
33-
#define LED3 (1<<21) // LED3 = P1_21
34-
#define LED4 (1<<22) // LED4 = P1_22
31+
#define LED1 (1<<18) /* LED1 = P1_18 */
32+
#define LED2 (1<<20) /* LED2 = P1_20 */
33+
#define LED3 (1<<21) /* LED3 = P1_21 */
34+
#define LED4 (1<<22) /* LED4 = P1_22 */
3535

36+
volatile uint32_t msTicks; /* counts 1ms timeTicks */
3637

37-
volatile uint32_t msTicks; /* counts 1ms timeTicks */
3838
/*----------------------------------------------------------------------------
3939
SysTick_Handler
4040
*----------------------------------------------------------------------------*/
4141
void SysTick_Handler(void) {
42-
msTicks++; /* increment counter necessary in Delay() */
42+
msTicks++; /* increment counter necessary in Delay() */
4343
}
4444

4545
/*------------------------------------------------------------------------------
4646
delays number of tick Systicks (happens every 1 ms)
4747
*------------------------------------------------------------------------------*/
4848
__INLINE static void Delay (uint32_t dlyTicks) {
49-
uint32_t curTicks;
49+
uint32_t curTicks;
5050

51-
curTicks = msTicks;
52-
while ((msTicks - curTicks) < dlyTicks);
51+
curTicks = msTicks;
52+
while ((msTicks - curTicks) < dlyTicks);
5353
}
5454

5555
/*------------------------------------------------------------------------------
5656
configer LED pins
5757
*------------------------------------------------------------------------------*/
5858
__INLINE static void LED_Config(void) {
59-
60-
LPC_GPIO1->FIODIR = 0xFFFFFFFF; /* LEDs PORT1 are Output */
59+
LPC_GPIO1->FIODIR = 0xFFFFFFFF; /* LEDs PORT1 are Output */
6160
}
6261

6362
/*------------------------------------------------------------------------------
6463
Switch on LEDs
6564
*------------------------------------------------------------------------------*/
6665
__INLINE static void LED_On (uint32_t led) {
67-
68-
LPC_GPIO1->FIOPIN |= (led); /* Turn On LED */
66+
LPC_GPIO1->FIOPIN |= (led); /* Turn On LED */
6967
}
7068

7169

7270
/*------------------------------------------------------------------------------
7371
Switch off LEDs
7472
*------------------------------------------------------------------------------*/
7573
__INLINE static void LED_Off (uint32_t led) {
76-
77-
LPC_GPIO1->FIOPIN &= ~(led); /* Turn Off LED */
74+
LPC_GPIO1->FIOPIN &= ~(led); /* Turn Off LED */
7875
}
7976

8077
/*----------------------------------------------------------------------------
8178
MAIN function
8279
*----------------------------------------------------------------------------*/
8380
int main (void) {
84-
/* Adjust SystemCoreClock global according to clock registers */
85-
SystemCoreClockUpdate();
86-
87-
if (SysTick_Config(SystemCoreClock / 1000)) { /* Setup SysTick Timer for 1 msec interrupts */
88-
while (1); /* Capture error */
89-
}
81+
/* Adjust SystemCoreClock global according to clock registers */
82+
SystemCoreClockUpdate();
9083

91-
LED_Config();
84+
if (SysTick_Config(SystemCoreClock / 1000)) { /* Setup SysTick Timer for 1 msec interrupts */
85+
while (1); /* Capture error */
86+
}
9287

93-
while(1) {
94-
LED_On (LED1); /* Turn on the LED. */
95-
Delay (100); /* delay 100 Msec */
96-
LED_Off (LED1); /* Turn off the LED. */
97-
Delay (100); /* delay 100 Msec */
98-
}
88+
LED_Config();
9989

90+
while(1) {
91+
LED_On(LED1); /* Turn on the LED */
92+
Delay(100); /* Delay 100 Msec */
93+
LED_Off(LED1); /* Turn off the LED */
94+
Delay(100); /* Delay 100 Msec */
95+
}
10096
}
10197

0 commit comments

Comments
 (0)