1, Kermit-C
Install: sudo apt-Get install ckermit
Enable serial port: Run The sudo Kermit-C command on the terminal.
Close the serial port: Hold down the "Ctrl" and "\" keys at the same time, loosen the port, press "C", enter "exit" (or "Q"), and press Enter.
2, g_sensor
Android acceleration sensor type is sendsor. type_accelerometer
Return the value of the accelerometer through Android. Hardware. sensorenent.
The Unit returned by the accelerometer is the unit of acceleration: M/s ^ 2, which has three values in the following directions:
Values [0]: X-axis Acceleration
Values [1]: X-axis Acceleration
Values [2]: X-axis Acceleration
X, Y, and Z are defined as the coordinates of the reference system at the bottom right of the horizontally placed mobile phone.
The X direction is the horizontal direction, and the right is positive.
The Y direction is the horizontal direction of the vertical phone, and the front is positive.
The Z direction is the vertical direction of the mobile phone space, the direction of the sky is positive, and the direction of the earth is negative.
Note that the earth's inherent gravity acceleration is 9.8
Therefore, in reality, the actual acceleration is the return value in the z direction-9.8.
For example, if you push the phone up at 2 Mb/s ^ 2, this is the return value in the z direction. It should be 11.8.
If the mobile phone drops down at 2 Mbit/s ^ 2 acceleration, the return value in the z direction is 7.8.
The X and Y directions do not have the preceding restrictions.
3. Include/Linux/gpio. h
Static inline int gpio_direction_input (unsigned gpio)
{
Return-enosys;
} // One parameter, that is, the pin name
Static inline int gpio_direction_output (unsigned gpio, int value)
{
Return-enosys;
} // Two parameters, pin name and level value
4. When printing information is added, for example, "printk (" <\ n "); "(remember \ n line breaks and semicolons ;)
5. kzarloc Function
This function is the integration of the original two functions.
That is, we do this every time we apply for memory.
First, use
Kmalloc () Request Space
And then use
Memset () to initialize
But now it's easy
, One step in place
, Directly call
Kzarloc (), equivalent to the two functions
, All applied elements are initialized
0. For the write driver
You know you should use
Kzarloc () replaces the original
Kmalloc () and
Memset ().
This is a change made in the memory management part of the kernel.
To be exact, it is an improvement.
And the goal of the sibling responsible for memory management is to make the kernel run faster.
From
Kmalloc/memset
To kzarloc
Is indeed to achieve this optimization.