The MPU3050 is a three-axis gyroscope chip from Invensense. The biggest function of the three-axis gyroscope is to measure the angular velocity to determine the motion state of the object, so it is also called motion sensor.
The following figure is the system block diagram of the MPU3050. The chip has one interrupt pin, which can be controlled by i2c to obtain xGyro, yGyro, zGyro.
The device driver uses the mpu3050_sensor structure to describe the MPU3050 device object (the object contains the i2c client and the input device to process the transfer of the acquired x, y, and z-axis data)
Structmpu3050_sensor{//mpu3050 sensor
strucTI2c_client*client;//i2c client
Structdevice*dev;//device file
strucTInput_dev*idev;//Input device
};
Use axis_data to describe the values ​​of xGyro, yGyro, and zGyro.
Structaxis_data{//axis data
S16x; / / x axis
S16y; / / y axis
S16z;//z axis
};
First register the i2c device
Module_i2c_driver(mpu3050_i2c_driver);
staTIcstrucTI2c_drivermpu3050_i2c_driver={
.driver={
.name=“mpu3050â€,
.owner=THIS_MODULE,
.pm=&mpu3050_pm,
.of_match_table=mpu3050_of_match,
},
.probe=mpu3050_probe, //i2cprobe method
.remove=__devexit_p(mpu3050_remove),
.id_table=mpu3050_ids,
};
The i2c device matches the driver and needs to register the i2c driver in the board driver.
The practice of htconemax board is as follows
Staticstructi2c_board_info__initdatampu3050_GSBI12_boardinfo[]={
{
I2C_BOARD_INFO ("mpu3050", 0xD0" 1),
.irq=PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PM_GYRO_INT),
.platform_data=&mpu3050_data,
},
};
Then call
I2c_register_board_info(MSM8064_GSBI2_QUP_I2C_BUS_ID,
mpu3050_GSBI12_boardinfo,
ARRAY_SIZE(mpu3050_GSBI12_boardinfo));
Dongguan Deli Plastic Co.,Ltd is a manufacturer specialized in the research, development ,plastic injection mould and making mass production with well-equipped facilities and strong technical force.
Our products are extensively used in household industry/electronic industry/automobile industry/building industry and other industries.
We have rich experience on one-stop solution, provide various services from new product design,prototype,mold making,mass production,assembly and logistics. The most important advantage is we have our own R&D team to help clients to turn ideas into actual parts. All of these engineers and designers have over 15 years experience in these plastic products fields.
We have a strict quality control system, an excellent management team and also a dedicated sales force, enable us to fulfill our commitment in high quality products and outstanding services.
If you are looking for a trustworthy supplier of customized items, please do not hesitate to contact us. We are always striving to establish a win-win partnership with customers from all over the world and help our partners to stay one step in front of your competitors.
Rechargeable fan ,usb Rechargeable fan ,Rechargeable fan for home
Dongguan Yuhua Electronic Plastic Technology Co.,Ltd , https://www.yuhuaportablefan.com