Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
15ab6141
You need to sign in or sign up before continuing.
Commit
15ab6141
authored
9 years ago
by
Hauke Petersen
Browse files
Options
Downloads
Patches
Plain Diff
boards/openmote-cc2538: unified LED defines
parent
058d1967
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
boards/openmote-cc2538/board.c
+6
-31
6 additions, 31 deletions
boards/openmote-cc2538/board.c
boards/openmote-cc2538/include/board.h
+22
-22
22 additions, 22 deletions
boards/openmote-cc2538/include/board.h
with
28 additions
and
53 deletions
boards/openmote-cc2538/board.c
+
6
−
31
View file @
15ab6141
...
...
@@ -19,41 +19,16 @@
*/
#include
"board.h"
#include
"cpu.h"
static
inline
void
leds_init
(
void
);
#include
"periph/gpio.h"
void
board_init
(
void
)
{
/* initialize the boards LEDs */
leds_init
();
gpio_init
(
LED0_PIN
,
GPIO_DIR_OUT
,
GPIO_NOPULL
);
gpio_init
(
LED1_PIN
,
GPIO_DIR_OUT
,
GPIO_NOPULL
);
gpio_init
(
LED2_PIN
,
GPIO_DIR_OUT
,
GPIO_NOPULL
);
gpio_init
(
LED3_PIN
,
GPIO_DIR_OUT
,
GPIO_NOPULL
);
/* initialize the CPU */
cpu_init
();
}
/**
* @brief Initialize the boards on-board LEDs (LD3 and LD4)
*
* The LED initialization is hard-coded in this function. As the LEDs are soldered
* onto the board they are fixed to their CPU pins.
*
* The LEDs are connected to the following pins:
* - LED1: PC4 (red)
* - LED2: PC5 (orange)
* - LED3: PC6 (yellow)
* - LED4: PC7 (green)
*/
static
inline
void
leds_init
(
void
)
{
/* set pins to be controlled by software */
LED_PORT
->
AFSEL
&=
~
((
1
<<
LED_RED_PIN
)
|
(
1
<<
LED_GREEN_PIN
)
|
(
1
<<
LED_YELLOW_PIN
)
|
(
1
<<
LED_ORANGE_PIN
));
/* configure pins as output */
LED_PORT
->
DIR
|=
((
1
<<
LED_RED_PIN
)
|
(
1
<<
LED_GREEN_PIN
)
|
(
1
<<
LED_YELLOW_PIN
)
|
(
1
<<
LED_ORANGE_PIN
));
/* configure io-mux for used pins */
IOC
->
PC_OVER
[
LED_RED_PIN
]
=
IOC_OVERRIDE_OE
;
IOC
->
PC_OVER
[
LED_GREEN_PIN
]
=
IOC_OVERRIDE_OE
;
IOC
->
PC_OVER
[
LED_YELLOW_PIN
]
=
IOC_OVERRIDE_OE
;
IOC
->
PC_OVER
[
LED_ORANGE_PIN
]
=
IOC_OVERRIDE_OE
;
}
This diff is collapsed.
Click to expand it.
boards/openmote-cc2538/include/board.h
+
22
−
22
View file @
15ab6141
...
...
@@ -29,35 +29,35 @@
#endif
/**
* @
name
LED pin definitions
* @
brief
LED pin definitions
and handlers
* @{
*/
#define LED0_PIN GPIO_PIN(2, 4)
#define LED1_PIN GPIO_PIN(2, 7)
#define LED2_PIN GPIO_PIN(2, 6)
#define LED3_PIN GPIO_PIN(2, 5)
#define LED_PORT GPIO_C
#define LED_RED_PIN (4)
#define LED_GREEN_PIN (7)
#define LED_YELLOW_PIN (6)
#define LED_ORANGE_PIN (5)
/** @} */
#define LED0_MASK (1 << 4)
#define LED1_MASK (1 << 7)
#define LED2_MASK (1 << 6)
#define LED3_MASK (1 << 5)
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED_RED_ON (LED_PORT->DATA |= (1 << LED_RED_PIN))
#define LED_RED_OFF (LED_PORT->DATA &= ~(1 << LED_RED_PIN))
#define LED_RED_TOGGLE (LED_PORT->DATA ^= (1 << LED_RED_PIN))
#define LED0_ON (LED_PORT->DATA |= LED0_MASK)
#define LED0_OFF (LED_PORT->DATA &= ~LED0_MASK)
#define LED0_TOGGLE (LED_PORT->DATA ^= LED0_MASK)
#define LED
_GREEN_ON
(LED_PORT->DATA |=
(1 << LED_GREEN_PIN)
)
#define LED
_GREEN_OFF
(LED_PORT->DATA &= ~
(1 << LED_GREEN_PIN)
)
#define LED
_GREEN
_TOGGLE (LED_PORT->DATA ^=
(1 << LED_GREEN_PIN)
)
#define LED
1_ON
(LED_PORT->DATA |=
LED1_MASK
)
#define LED
1_OFF
(LED_PORT->DATA &= ~
LED1_MASK
)
#define LED
1
_TOGGLE
(LED_PORT->DATA ^=
LED1_MASK
)
#define LED
_YELLOW_ON
(LED_PORT->DATA |=
(1 << LED_YELLOW_PIN)
)
#define LED
_YELLOW_OFF
(LED_PORT->DATA &= ~
(1 << LED_YELLOW_PIN)
)
#define LED
_YELLOW
_TOGGLE (LED_PORT->DATA ^=
(1 << LED_YELLOW_PIN)
)
#define LED
2_ON
(LED_PORT->DATA |=
LED2_MASK
)
#define LED
2_OFF
(LED_PORT->DATA &= ~
LED2_MASK
)
#define LED
2
_TOGGLE
(LED_PORT->DATA ^=
LED2_MASK
)
#define LED
_ORANGE_ON
(LED_PORT->DATA |=
(1 << LED_ORANGE_PIN)
)
#define LED
_ORANGE_OFF
(LED_PORT->DATA &= ~
(1 << LED_ORANGE_PIN)
)
#define LED
_ORANGE
_TOGGLE (LED_PORT->DATA ^=
(1 << LED_ORANGE_PIN)
)
#define LED
3_ON
(LED_PORT->DATA |=
LED3_MASK
)
#define LED
3_OFF
(LED_PORT->DATA &= ~
LED3_MASK
)
#define LED
3
_TOGGLE
(LED_PORT->DATA ^=
LED3_MASK
)
/** @} */
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment