GPIO based LEDs with USR LED functions

i really thought i would find this online someplace but,
can i use the trigger and heartbeat type functions on a LED connected to GPIO on my custom board based on the BBB design?
this would save me time in my code that is already quite busy.
i noticed some example from 3.14 kernel days
i’m 4.4.62 and ubuntu 16.04
and controlling them from c code.

thanks so much,
Michael

Can you ask a more specific question ? It seems as though as you;re asking if you can use the sysfs file system to control USR0-USR3 ?

The answer is yes, you can, but it largely depends on which drivers you’re loading with your hardware. Using /dev/mem/ + mmap all you need to know if the memory map for the GPIO pins. But for sysfs access, you need to load certain drivers at boot.

excellent, thanks.
this is my first exposure to overlays etc… now i see about sysfs.
i’ll just blink leds in my code. using threads won’t suck up hardly any processor time.
ciao,

OK so assuming you have everything loaded as per the normal Debian image . . .
root@wgd:~# ls /sys/class/leds/
beaglebone:green:usr0 beaglebone:green:usr1 beaglebone:green:usr2 beaglebone:green:usr3

This is the path you’re looking for then:
root@wgd:~# ls /sys/class/leds/beaglebone:green:usr0
brightness device invert max_brightness power subsystem trigger uevent

You can work with individual led files from there. Which I do not remember how closely this matched to earlier kernels . . . It’s been a long time for me since I’ve worked with anything but kernel 4.x . . .