Skip to content

boards/risc-v/k210/maix-bit: Add userled support#18596

Merged
linguini1 merged 1 commit intoapache:masterfrom
no1wudi:k210
Mar 24, 2026
Merged

boards/risc-v/k210/maix-bit: Add userled support#18596
linguini1 merged 1 commit intoapache:masterfrom
no1wudi:k210

Conversation

@no1wudi
Copy link
Contributor

@no1wudi no1wudi commented Mar 24, 2026

Summary

Replace GPIO driver with userled driver for maix-bit board (K210 RISC-V).

The previous implementation used a generic GPIO driver (k210_gpio.c) to control the LEDs on pins 12 and 13. This commit replaces it with a proper userled driver (k210_userleds.c) that follows the NuttX LED driver conventions. The userled driver better reflects the real hardware connection since these pins are connected to LEDs, not general purpose GPIO.

Changes:

  • Add user LED definitions in board.h (BOARD_LED1, BOARD_LED2)
  • Add k210_userleds.c implementing board_userled_* functions
  • Remove k210_gpio.c (GPIO driver no longer needed)
  • Update CMakeLists.txt and Makefile for userled build
  • Update k210_bringup.c to initialize userled instead of GPIO

The red LED on Pin 14 remains as system LED (CONFIG_ARCH_LEDS).

Impact

  • Impact on user: NO - Neither CONFIG_DEV_GPIO nor CONFIG_USERLED_LOWER is enabled in default nsh defconfig
  • Impact on build: NO - No changes to default configurations
  • Impact on hardware: NO
  • Impact on documentation: NO
  • Impact on security: NO
  • Impact on compatibility: YES - GPIO interface for pins 12/13 is removed (if CONFIG_DEV_GPIO was enabled)

Testing

Build Host: Linux, RISC-V toolchain
Target: maix-bit (K210)

Verified build with default nsh configuration (no LED drivers enabled):

LD: nuttx

Manual testing with CONFIG_USERLED_LOWER and CONFIG_EXAMPLES_LEDS enabled:

nsh> leds
leds_main: Starting the led_daemon
leds_main: led_daemon started

led_daemon (pid# 3): Running
led_daemon: Opening /dev/userleds
led_daemon: Supported LEDs 0x03
led_daemon: LED set 0x01
led_daemon: LED set 0x02
led_daemon: LED set 0x03
led_daemon: LED set 0x02
led_daemon: LED set 0x01
led_daemon: LED set 0x00
led_daemon: LED set 0x01
led_daemon: LED set 0x02
led_daemon: LED set 0x03
led_daemon: LED set 0x02

Replace GPIO driver with userled driver for Pin 12 and 13 LEDs.
The red LED on Pin 14 remains as system LED.

- Add user LED definitions in board.h (BOARD_LED1, BOARD_LED2)
- Add k210_userleds.c implementing board_userled_* functions
- Remove k210_gpio.c (GPIO driver no longer needed)
- Update CMakeLists.txt and Makefile for userled build
- Update k210_bringup.c to initialize userled instead of GPIO

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
@github-actions github-actions bot added Size: M The size of the change in this PR is medium Board: risc-v labels Mar 24, 2026
Copy link
Contributor

@linguini1 linguini1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@linguini1 linguini1 merged commit 26a476e into apache:master Mar 24, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Board: risc-v Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants