Seventh Chapter LED will blink for us: Control Light Emitting diode
How LEDs work: Light emitting diodes It is a kind of semiconductor diode that can convert electrical energy into solar energy.;often abbreviated toLED. LEDs, like ordinary diodes, are made up of aPNand a unidirectional conductivity. When a forward voltage is added to the light emitting diode, theParea injected intoNarea of the hole and byNarea injected intoParea of electronics, inPNwithin a few microns near the junction, respectivelyNarea of electronic andPThe cavity of the zone is compounded to produce the fluorescence of spontaneous emission. The energy state of electrons and holes in different semiconductor materials is different. When electrons and holes are combined, the amount of energy released is different, and the more energy is released, the shorter the wavelength of light emitted. Commonly used is a red, green or yellow light diode.
LED Driver Implementation principle: TheLinux Drive and hardware to interact with the current I/o memory interaction,I/o Memory is through a variety of interfaces (PCI,USB, Bluetooth, Ethernet interface, etc.) connected to (PC, mobile) hardware (network card, Camera, etc.) on the host and then perform hardware interaction.
WriteLEDDrive: CreateLEDDrive the device file:1.UseCdev_initInitialization of functionsCdev;2.specify the device number;3.UseCdev_addfunction to add a character device to the kernel's character device array;4.Usestruct_createMacro CreationStruct_class;5.Usedevice_createfunction to create a device file. And then it's uninstall .LEDdrive the device file, then set the register and initialize theLEDDrive, Final controlLED.
Test led driver: First write the generic program for the test I/O control command, then the NDK test led driver, take the Java Code test and use the two code file paths in these steps.
LED driver Transplant: After the successful transplant can be perfect control LED4 a small light off!
Seventh chapter LED will blink for us: control Light Emitting diode