MinnowBoard Max
  • Cover
  • Introduction
  • Getting Started
  • Hardware
    • Processor
    • Peripherals
    • Interfaces
    • PCIe
  • Customization
    • Lures
  • Build Systems
    • Yocto
  • BIOS
  • Operating Systems
  • Linux
    • Installation
    • Kernel
    • Subsystems
      • UART
      • Camera
      • Audio
      • General Purpose Input Output
      • I2C
      • Pwm
      • Serial Peripheral Interface
      • Led
    • Package Management
    • Libraries
      • MRAA
      • UPM
  • Programming Languages
    • Python
      • Calamari Lure
        • Main
        • 7 Segments
        • Buttons
        • Pulse Width Modulation
        • Red Green Blue
  • SandBox
Powered by GitBook
On this page
  • Led
  • LED, Drivers Enablement
  • LED, Module Test
  • Resources
  • End of File
  1. Linux
  2. Subsystems

Led

Led

LED, Drivers Enablement

Compile your kernel, once compiled we enable all needed drivers via menuconfig

user@Minnowboard:~$ cd linux
user@Minnowboard:~$ make menuconfig

@Linux Kernel Menuconfig > Device Drivers
Symbol: NEW_LEDS [=y]
Prompt: LED Support

@Linux Kernel Menuconfig > Device Drivers > LED Support
Symbol: LEDS_CLASS [=y]
Prompt: LED Class Support

@Linux Kernel Menuconfig > Device Drivers > LED Support
Symbol: LEDS_GPIO [=m]
Prompt: LED Support for GPIO connected LEDs

@Linux Kernel Menuconfig > Device Drivers > LED Support > LED Trigger support
Symbol: LEDS_TRIGGERS [=y]
Prompt: LED Trigger support

And within this "LED Trigger support" section select a variety of triggers to work with, let's start with Hearbeat and OneShot

@Linux Kernel Menuconfig > Device Drivers > LED Support > LED Trigger support
Symbol: LEDS_TRIGGER_ONESHOT [=m]
Prompt: LED One-shot Trigger

@Linux Kernel Menuconfig > Device Drivers > LED Support > LED Trigger support
Symbol: LEDS_TRIGGER_HEARTBEAT [=m]
Prompt: LED Heartbeat Trigger

Once configured, we save the changes, compile and reboot

LED, Module Test

root@Minnowboard:~# modprobe leds_gpio
root@Minnowboard:~# modprobe ledtrig_heartbeat
root@Minnowboard:~# modprobe ledtrig_oneshot
user@Minnowboard:~$ lsmod | grep led
ledtrig_oneshot        16384  0
ledtrig_heartbeat      16384  0
leds_gpio              16384  0
user@Minnowboard:~$ cd linuxlearning/kernelspace
user@Minnowboard:~$ make

Now insert and make use of both triggers, ledtrig_heartbeat and ledtrig_oneshot. You can also go back to your kernel menuconfig and enable the rest of the triggers

root@Minnowboard:~# insmod linuxlearning/kernelspace/seabass-leds.ko
user@Minnowboard:~$ ls /sys/class/leds/
mmc0::    mmc1::    mmc2::    seabass:green:user  seabass:red:user  seabass:yellow:user
user@Minnowboard:~$ cat /sys/class/leds/seabass\:red\:user/trigger
none mmc0 mmc1 mmc2 [heartbeat] oneshot

Resources

End of File

PreviousSerial Peripheral InterfaceNextPackage Management

Last updated 7 years ago

Download, modify and compile the following code: You might need to specify different GPIO numbers. Wait! There is an easy way to do that

https://github.com/mjoldfield/seabass/blob/master/seabass-leds/seabass-leds.c
Martin's Atelier Blog LEDs