Skip to content

zeoio/l3gd20-driver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

L3GD20 MEMS Motion Sensor Driver

L3GD20 MEMS Motion Sensor, Three-axis Digital Output Gyroscope.

Building the source

  1. Clone the driver code
https://github.com/Sarlor/l3gd20-driver.git
cd  l3gd20-driver/src
  1. Edit the 'Makefile' file, set the correct kernel directory 'KERN_DIR'
vim Makefile
  1. Copy the driver files to the 'hwmon' directory
make cp
  1. Add board-level support code to the appropriate place
vim arch/arm/plat-s5p4418/realarm/device.c
#if defined(CONFIG_SENSORS_L3GD20) || defined(CONFIG_SENSORS_L3GD20_MODULE)
#include <linux/i2c.h>

/* CODEC */
static struct i2c_board_info __initdata l3gd20_i2c_bdi = {
	.type   = "l3gd20",
	.addr   = 0x6A
};

#endif

#if defined(CONFIG_SENSORS_L3GD20) || defined(CONFIG_SENSORS_L3GD20_MODULE)
	printk("plat: add gyroscope l3gd20\n");
	i2c_register_board_info(1, &l3gd20_i2c_bdi, 1);
#endif
  1. Modify the kernel configuration file for l3gd20, and add the code to the appropriate place
vim drivers/hwmon/Kconfig
config SENSORS_L3GD20
	tristate "Three axis digital output gyroscope"
	depends on I2C
	default n
	help
		Say Y here to enable the gyroscope.

		If unsure, say N.
  1. Edit Makefile for add l3gd20 driver module
vim drivers/hwmon/Makefile
obj-$(CONFIG_SENSORS_L3GD20)    += l3gd20.o
  1. Configure the kernel for required submodule, then save config
make menuconfig
Device Drivers -> Hardware Monitoring support -> Three axis digital output gyroscope

About

L3GD20 MEMS Motion Sensor Driver

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published