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
61724685
Commit
61724685
authored
9 years ago
by
Cenk Gündoğan
Browse files
Options
Downloads
Patches
Plain Diff
pba-d-01-kw2x: use GPIO_PIN for LED_*_GPIO
parent
85cfa6b9
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/pba-d-01-kw2x/board.c
+9
-9
9 additions, 9 deletions
boards/pba-d-01-kw2x/board.c
boards/pba-d-01-kw2x/include/board.h
+18
-15
18 additions, 15 deletions
boards/pba-d-01-kw2x/include/board.h
with
27 additions
and
24 deletions
boards/pba-d-01-kw2x/board.c
+
9
−
9
View file @
61724685
...
...
@@ -41,14 +41,14 @@ static void leds_init(void)
LED_G_PORT_CLKEN
();
LED_R_PORT_CLKEN
();
/* configure pins as gpio */
LED_B_PORT
->
PCR
[
LED_B_PIN
]
=
PORT_PCR_MUX
(
1
);
LED_G_PORT
->
PCR
[
LED_G_PIN
]
=
PORT_PCR_MUX
(
1
);
LED_R_PORT
->
PCR
[
LED_R_PIN
]
=
PORT_PCR_MUX
(
1
);
LED_B_GPIO
->
PDDR
|=
(
1
<<
LED_B_PIN
);
LED_G_GPIO
->
PDDR
|=
(
1
<<
LED_G_PIN
);
LED_R_GPIO
->
PDDR
|=
(
1
<<
LED_R_PIN
);
LED_B_PORT
_BASE
->
PCR
[
LED_B_PIN
]
=
PORT_PCR_MUX
(
1
);
LED_G_PORT
_BASE
->
PCR
[
LED_G_PIN
]
=
PORT_PCR_MUX
(
1
);
LED_R_PORT
_BASE
->
PCR
[
LED_R_PIN
]
=
PORT_PCR_MUX
(
1
);
LED_B_GPIO
_BASE
->
PDDR
|=
(
1
<<
LED_B_PIN
);
LED_G_GPIO
_BASE
->
PDDR
|=
(
1
<<
LED_G_PIN
);
LED_R_GPIO
_BASE
->
PDDR
|=
(
1
<<
LED_R_PIN
);
/* turn all LEDs off */
LED_B_GPIO
->
PSOR
|=
(
1
<<
LED_B_PIN
);
LED_G_GPIO
->
PSOR
|=
(
1
<<
LED_G_PIN
);
LED_R_GPIO
->
PSOR
|=
(
1
<<
LED_R_PIN
);
LED_B_GPIO
_BASE
->
PSOR
|=
(
1
<<
LED_B_PIN
);
LED_G_GPIO
_BASE
->
PSOR
|=
(
1
<<
LED_G_PIN
);
LED_R_GPIO
_BASE
->
PSOR
|=
(
1
<<
LED_R_PIN
);
}
This diff is collapsed.
Click to expand it.
boards/pba-d-01-kw2x/include/board.h
+
18
−
15
View file @
61724685
...
...
@@ -37,30 +37,33 @@ extern "C"
#define LED_R_PORT_CLKEN() (SIM->SCGC5 |= (SIM_SCGC5_PORTD_MASK))
/**< Clock Enable for PORTD*/
#define LED_G_PORT_CLKEN() (SIM->SCGC5 |= (SIM_SCGC5_PORTD_MASK))
/**< Clock Enable for PORTD*/
#define LED_B_PORT_CLKEN() (SIM->SCGC5 |= (SIM_SCGC5_PORTA_MASK))
/**< Clock Enable for PORTA*/
#define LED_R_PORT
PORTD
/**< PORT
for
Red LED*/
#define LED_
R_GPIO GPIOD
/**< GPIO-Device for Red
LED*/
#define LED_
G
_PORT
PORT
D
/**< PORT
for Green
LED*/
#define LED_
G
_GPIO
GPIOD
/**< GPIO
-Devic
e for
Green
LED*/
#define LED_
B_PORT
PORTA
/**<
PORT for Blue
LED*/
#define LED_B_GPIO
GPIOA
/**< GPIO
-Devic
e for Blue LED*/
#define LED_R_PORT
_BASE
PORTD
/**< PORT
base for the
Red LED
*/
#define LED_
G_PORT_BASE PORTD
/**< PORT base for the Green
LED
*/
#define LED_
B
_PORT
_BASE
PORT
A
/**< PORT
base for the Blue
LED
*/
#define LED_
R
_GPIO
_BASE
GPIOD
/**< GPIO
bas
e for
Red
LED
*/
#define LED_
G_GPIO_BASE
GPIOD
/**<
GPIO base for Green
LED
*/
#define LED_B_GPIO
_BASE
GPIOA
/**< GPIO
bas
e for Blue LED
*/
#define LED_R_PIN 6
/**< Red LED connected to PINx*/
#define LED_G_PIN 4
/**< Green LED connected to PINx*/
#define LED_B_PIN 4
/**< Blue LED connected to PINx*/
#define LED_R_GPIO GPIO_PIN(PORT_D, LED_R_PIN)
/**< GPIO-Device for Red LED */
#define LED_G_GPIO GPIO_PIN(PORT_D, LED_G_PIN)
/**< GPIO-Device for Green LED */
#define LED_B_GPIO GPIO_PIN(PORT_A, LED_B_PIN)
/**< GPIO-Device for Blue LED */
/** @} */
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED_B_ON (LED_B_GPIO->PCOR = (1 << LED_B_PIN))
#define LED_B_OFF (LED_B_GPIO->PSOR = (1 << LED_B_PIN))
#define LED_B_TOGGLE (LED_B_GPIO->PTOR = (1 << LED_B_PIN))
#define LED_G_ON (LED_G_GPIO->PCOR = (1 << LED_G_PIN))
#define LED_G_OFF (LED_G_GPIO->PSOR = (1 << LED_G_PIN))
#define LED_G_TOGGLE (LED_G_GPIO->PTOR = (1 << LED_G_PIN))
#define LED_R_ON (LED_R_GPIO->PCOR = (1 << LED_R_PIN))
#define LED_R_OFF (LED_R_GPIO->PSOR = (1 << LED_R_PIN))
#define LED_R_TOGGLE (LED_R_GPIO->PTOR = (1 << LED_R_PIN))
#define LED_B_ON (LED_B_GPIO
_BASE
->PCOR = (1 << LED_B_PIN))
#define LED_B_OFF (LED_B_GPIO
_BASE
->PSOR = (1 << LED_B_PIN))
#define LED_B_TOGGLE (LED_B_GPIO
_BASE
->PTOR = (1 << LED_B_PIN))
#define LED_G_ON (LED_G_GPIO
_BASE
->PCOR = (1 << LED_G_PIN))
#define LED_G_OFF (LED_G_GPIO
_BASE
->PSOR = (1 << LED_G_PIN))
#define LED_G_TOGGLE (LED_G_GPIO
_BASE
->PTOR = (1 << LED_G_PIN))
#define LED_R_ON (LED_R_GPIO
_BASE
->PCOR = (1 << LED_R_PIN))
#define LED_R_OFF (LED_R_GPIO
_BASE
->PSOR = (1 << LED_R_PIN))
#define LED_R_TOGGLE (LED_R_GPIO
_BASE
->PTOR = (1 << LED_R_PIN))
/* for compatability to other boards */
#define LED_GREEN_ON LED_G_ON
...
...
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