cpu/lpc1768: add gpio peripheral (+ board adaptions)#6472
cpu/lpc1768: add gpio peripheral (+ board adaptions)#6472basilfx merged 3 commits intoRIOT-OS:masterfrom
Conversation
|
is this still works in progress @basilfx ? |
boards/mbed_lpc1768/board.c
Outdated
| * - LED2: P1.20 | ||
| * - LED3: P1.21 | ||
| * - LED4: P1.23 | ||
| * @brief Initialize the boards on-board LEDs. |
There was a problem hiding this comment.
"boards on-board" => on-board is enough
| #define LED3_ON (LED_PORT->FIOCLR = LED3_MASK) | ||
| #define LED3_OFF (LED_PORT->FIOSET = LED3_MASK) | ||
| #define LED3_TOGGLE (LED_PORT->FIOPIN ^= LED3_MASK) | ||
| #define LED0_ON gpio_clear(LED0_PIN) |
There was a problem hiding this comment.
Why not keeping the previous defines ?
There was a problem hiding this comment.
I prefer to keep implementation in one place (gpio.c), and not having two different ways to toggle a LED.
cpu/lpc1768/periph/gpio.c
Outdated
| { | ||
| LPC_GPIO_TypeDef *base = _base(pin); | ||
|
|
||
| if (base->FIOSET & _pin(pin)) { |
There was a problem hiding this comment.
I think this can be done in one line using
base->FIOPIN ^= (1 << _pin(pin));
boards/seeeduino_arch-pro/board.c
Outdated
| * - LED4: P1.23 | ||
| * | ||
| * The LEDs are active-low (current-sink). | ||
| * @brief Initialize the boards on-board LEDs. |
There was a problem hiding this comment.
same comment about on-board leds
boards/mbed_lpc1768/include/board.h
Outdated
| #define LED3_ON (LED_PORT->FIOSET = LED3_MASK) | ||
| #define LED3_OFF (LED_PORT->FIOCLR = LED3_MASK) | ||
| #define LED3_TOGGLE (LED_PORT->FIOPIN ^= LED3_MASK) | ||
| #define LED0_ON gpio_clear(LED0_PIN) |
There was a problem hiding this comment.
Looks like this is inverted.
There was a problem hiding this comment.
Fixed.
On the Seeeduino Arch-Pro, they are inverted :-)
|
ping @basilfx |
|
@aabadie Sorry, I'm very busy with work-work. Will have to wait. |
|
ping @basilfx. Any chance to apply the requested changes for the next release ? |
|
@basilfx any chance for this one to be ready for the release ? |
af263b6 to
d8f7a1d
Compare
|
@aabadie I finally found the time to fix this one. Re-implemented the GPIO driver, added support for interrupts and fixed board LEDs. |
aabadie
left a comment
There was a problem hiding this comment.
Looks good codewise, just a minor thing.
Otherwise, I tested it and it works now. Well done !
| DEBUG_ADAPTER ?= dap | ||
|
|
||
| # this board uses openocd | ||
| export IMAGE_FILE = $(HEXFILE) |
There was a problem hiding this comment.
It's needed to flash the HEX file instead of the ELF file. #8845 would help, yes.
There was a problem hiding this comment.
I would prefer to make this change in a separate PR. Is it ok for you ?
There was a problem hiding this comment.
I'll put this in another PR.
a50c6e3 to
18e6e5c
Compare
|
Rebased and squashed. |
18e6e5c to
ceb8487
Compare
ceb8487 to
29b3798
Compare
|
Murdock is happy! |
I needed GPIO on the LPC1768 (more specific, on the Seeeduino Arch Pro), but I realized it wasn't there. Since I need it for a demo tomorrow, I decided to add it :-)
So far output mode works, but that's all I tested. Have to dig into interrupts, which seem to be a bit more complex.
Adapted
mbed_lpc1768andseeeduino-arch_proboards, including SAUL support for GPIO. I realize that they overlap a lot, but the boards are not quite similar.WIP, needs a lot of cleanup.