Control Light Emitting Diodes

Source: Internet
Author: User

For most Linux drivers, the need to interact directly with the hardware, this chapter focuses on the use of Linux drivers to control the light and dark of the diode, that is, the Linux drive to send data control on the Development board LED lights switch.

First, we need to understand the principle of LED driver implementation. The Linux driver does not write data directly to the memory in the hardware, but interacts with the native I/O memory, the Linux kernel provides multiple functions that interact with I/O memory, each hardware connected to Linux has a map header in I/O memory, and the LED on the Board has its first address.

Then start writing LED drivers:

1. Test the Development Board, turn on the power switch

2. Create the LED drive device file

3. Uninstalling the LED-driven device files

4. Setting the register and initializing the LED driver

5. Control LED

6. Set the module parameters of the LED driver

This chapter gives the complete code of LED driver can be used for reference

The final test led driver, this chapter describes a number of complex testing methods, not only can send strings to the LED device files, but also send I/O control commands.

1. General procedures for writing test I/O control commands

2. Test led driver with NDK

3. Test LED driver using Java

In addition to LED-driven porting, the simplest porting is to compile it under different Linux kernel versions, while porting drivers should be careful to modify the driver's source code as much as possible without modifying the driver's interface.

Although the LED drivers are not complicated, we have to be aware that different Linux kernel versions and less hardware platform-driven porting can help us understand Linux technology in depth.

Control Light Emitting Diodes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.