-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mailbox: control LED through the little core
- Loading branch information
Showing
6 changed files
with
49 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include "milkv_duo_io.h" | ||
|
||
void duo_led_control(int enable) | ||
{ | ||
*(uint32_t*)(GPIO2 | GPIO_SWPORTA_DDR) = 1 << 24; | ||
|
||
if (enable) { | ||
*(uint32_t*)(GPIO2 | GPIO_SWPORTA_DR) = 1 << 24; | ||
} else { | ||
*(uint32_t*)(GPIO2 | GPIO_SWPORTA_DR) = 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <stdio.h> | ||
/* | ||
* The blue LED on Duo is GPIOC24. | ||
* The datasheet page 536 says: | ||
* Configure register GPIO_SWPORTA_DDR and set GPIO as input or output. | ||
* When the output pin is configured, write the output value to the | ||
* GPIO_SWPORTA_DR register to control the GPIO output level. | ||
*/ | ||
|
||
#define GPIO2 0x03022000 | ||
#define GPIO_SWPORTA_DR 0x000 | ||
#define GPIO_SWPORTA_DDR 0x004 | ||
|
||
void duo_led_control(int enable); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters