Skip to content

Commit dd37057

Browse files
authored
Merge pull request #2 from NoahRosa/master
Implement LIS2MDL library
2 parents 40cacf7 + ec5c742 commit dd37057

File tree

7 files changed

+2300
-0
lines changed

7 files changed

+2300
-0
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,39 @@
11
# LIS2MDL
22
Arduino library to support the LIS2MDL high-performance 3-axis magnetometer
3+
4+
## API
5+
6+
This sensor uses I2C or SPI to communicate.
7+
For I2C it is then required to create a TwoWire interface before accessing to the sensors:
8+
9+
dev_i2c = new TwoWire(I2C_SDA, I2C_SCL);
10+
dev_i2c->begin();
11+
12+
For SPI it is then required to create a SPI interface before accessing to the sensors:
13+
14+
dev_spi = new SPIClass(SPI_MOSI, SPI_MISO, SPI_SCK);
15+
dev_spi->begin();
16+
17+
An instance can be created and enbaled when the I2C bus is used following the procedure below:
18+
19+
Magneto = new LIS2MDLSensor(dev_i2c);
20+
Magneto->Enable();
21+
22+
An instance can be created and enbaled when the SPI bus is used following the procedure below:
23+
24+
Magneto = new LIS2MDLSensor(dev_spi, CS_PIN);
25+
Magneto->Enable();
26+
27+
The access to the sensor values is done as explained below:
28+
29+
Read magnetometer.
30+
31+
Magneto->GetAxes(&magnetometer);
32+
33+
## Documentation
34+
35+
You can find the source files at
36+
https://github.com/stm32duino/LIS2MDL
37+
38+
The LIS2MDL datasheet is available at
39+
https://www.st.com/en/mems-and-sensors/lis2mdl.html

keywords.txt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#######################################
2+
# Syntax Coloring Map For LIS2MDL
3+
#######################################
4+
5+
#######################################
6+
# Datatypes (KEYWORD1)
7+
#######################################
8+
9+
LIS2MDLSensor KEYWORD1
10+
11+
#######################################
12+
# Methods and Functions (KEYWORD2)
13+
#######################################
14+
15+
ReadID KEYWORD2
16+
Enable KEYWORD2
17+
Disable KEYWORD2
18+
GetSensitivity KEYWORD2
19+
GetOutputDataRate KEYWORD2
20+
SetOutputDataRate KEYWORD2
21+
GetFullScale KEYWORD2
22+
SetFullScale KEYWORD2
23+
GetAxes KEYWORD2
24+
GetAxesRaw KEYWORD2
25+
ReadReg KEYWORD2
26+
WriteReg KEYWORD2
27+
SetSelfTest KEYWORD2
28+
GetDRDYStatus KEYWORD2
29+
30+
#######################################
31+
# Constants (LITERAL1)
32+
#######################################
33+
34+
LIS2MDL_OK LITERAL1
35+
LIS2MDL_ERROR LITERAL1
36+
LIS2MDL_MAG_SENSITIVITY_FS_50GAUSS LITERAL1

library.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name=STM32duino LIS2MDL
2+
version=1.0.0
3+
author=SRA
4+
maintainer=stm32duino
5+
sentence=Ultra Low Power 3D magnetometer.
6+
paragraph=This library provides Arduino support for the Ultra Low Power 3D magnetometer LIS2MDL for STM32 boards.
7+
category=Sensors
8+
url=https://github.com/stm32duino/LIS2MDL
9+
architectures=stm32, avr, sam

0 commit comments

Comments
 (0)