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
593ad5b2
Commit
593ad5b2
authored
9 years ago
by
Hauke Petersen
Browse files
Options
Downloads
Patches
Plain Diff
boards/arduino-due: cleaned up LED handling
parent
ec1bea38
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/arduino-due/board.c
+4
-34
4 additions, 34 deletions
boards/arduino-due/board.c
boards/arduino-due/include/board.h
+11
-10
11 additions, 10 deletions
boards/arduino-due/include/board.h
with
15 additions
and
44 deletions
boards/arduino-due/board.c
+
4
−
34
View file @
593ad5b2
...
@@ -18,44 +18,14 @@
...
@@ -18,44 +18,14 @@
* @}
* @}
*/
*/
#include
<stdio.h>
#include
"board.h"
#include
"cpu.h"
#include
"cpu.h"
#include
"board.h"
#include
"periph/gpio.h"
void
led_init
(
void
);
void
board_init
(
void
)
void
board_init
(
void
)
{
{
/* initialize the CPU */
/* initialize the CPU */
cpu_init
();
cpu_init
();
/* initialize the on-board Amber "L" LED @ pin PB27 */
/* initialize the boards LEDs */
gpio_init
(
LED_PIN
,
GPIO_DIR_OUT
,
GPIO_NOPULL
);
led_init
();
}
/**
* @brief Initialize the boards on-board LED (Amber LED "L")
*
* The LED initialization is hard-coded in this function. As the LED is soldered
* onto the board it is fixed to its CPU pins.
*
* The LED is connected to the following pin:
* - LED: PB27
*/
void
led_init
(
void
)
{
/* enable PIO control of pin PD27 */
LED_PORT
->
PIO_PER
=
LED_PIN
;
/* set pin as output */
LED_PORT
->
PIO_OER
=
LED_PIN
;
/* enable direct write access to the LED pin */
LED_PORT
->
PIO_OWER
=
LED_PIN
;
/* disable pull-up */
LED_PORT
->
PIO_PUDR
=
LED_PIN
;
/* clear pin */
LED_PORT
->
PIO_CODR
=
LED_PIN
;
}
}
This diff is collapsed.
Click to expand it.
boards/arduino-due/include/board.h
+
11
−
10
View file @
593ad5b2
...
@@ -33,24 +33,25 @@ extern "C" {
...
@@ -33,24 +33,25 @@ extern "C" {
* @{
* @{
*/
*/
#define LED_PORT PIOB
#define LED_PORT PIOB
#define LED_PIN PIO_PB27
#define LED_BIT PIO_PB27
#define LED_PIN GPIO_PIN(PB, 27)
/** @} */
/** @} */
/**
/**
* @name Macros for controlling the on-board LEDs.
* @name Macros for controlling the on-board LEDs.
* @{
* @{
*/
*/
#define LED_ON (LED_PORT->PIO_OD
S
R
|
= LED_
PIN
)
#define LED_ON (LED_PORT->PIO_
S
ODR = LED_
BIT
)
#define LED_OFF (LED_PORT->PIO_OD
S
R
&
=
~
LED_
PIN
)
#define LED_OFF (LED_PORT->PIO_
C
ODR = LED_
BIT
)
#define LED_TOGGLE (LED_PORT->PIO_ODSR ^= LED_
PIN
)
#define LED_TOGGLE (LED_PORT->PIO_ODSR ^= LED_
BIT
)
/* for compatability to other boards */
/* for compatability to other boards */
#define LED_GREEN_ON
/* not available */
#define LED_GREEN_ON
LED_ON
#define LED_GREEN_OFF
/* not available */
#define LED_GREEN_OFF
LED_OFF
#define LED_GREEN_TOGGLE
/* not available */
#define LED_GREEN_TOGGLE
LED_TOGGLE
#define LED_RED_ON
LED_ON
#define LED_RED_ON
/* not available */
#define LED_RED_OFF
LED_OFF
#define LED_RED_OFF
/* not available */
#define LED_RED_TOGGLE
LED_TOGGLE
#define LED_RED_TOGGLE
/* not available */
/** @} */
/** @} */
/**
/**
...
...
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