This chapter is the switch that sends data control LED lights through the Linux drive. At the beginning of the LED lights through the drive control we need to create the LED drive device files: Step One: Initialize Cdev using the Cdev-init function step two: Specify the device number step three: Use the Cdev-add function to add a character device to a character device array in the kernel fourth step: Create a struct with a Class-create macro Class Fifth: Using the device creat function to create the equipment files while uninstalling the LED-driven device files, you need to call Device-destory, Class-destory, and unregistor-chrder-region (dev __t from,.unsigned count)
We must be aware of the register before controlling the LED on and off: including the LED has two pins, the control led needs to be completed by 3 registers, each register can use 4 characters, use the low 4 bits of the Gpmdat register to control the light off of 4 LEDs.
The LED driver can control the driver using two methods: 1, controlling the led;2 via string, and control the LED through the I/O command
The LED driver test method can not only send strings to the LED device files, but also send I/O control commands. These test methods include executable program testing, NDK testing, and Java testing.
LED driver is a real Linux driver that deals with hardware. We need a more comprehensive understanding of the advanced technologies of Linux drivers and learn more about Linux drive technology so that you can skillfully write driver code.
LED will blink for me: Control curtain J-Glow two-stage tube