Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
fwatch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
8
Issues
8
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
fwatch
Commits
dc7b44ec
Commit
dc7b44ec
authored
Aug 18, 2014
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lsm303: apply hard-iron calibration to each compass sample, hardcoded
parent
97552746
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
lsm303c.c
sw/common/drivers/LSM303C/lsm303c.c
+10
-1
lsm303c.h
sw/common/drivers/LSM303C/lsm303c.h
+4
-0
No files found.
sw/common/drivers/LSM303C/lsm303c.c
View file @
dc7b44ec
...
...
@@ -124,7 +124,7 @@ int lsm303_init()
lsm303_fifo_mode
(
DEV_ACC
,
LSM303_FMODE_BYPASS
,
0
);
lsm303_odr
(
DEV_ACC
,
LSM303_ACC_ODR_10_Hz
);
lsm303_odr
(
DEV_MAG
,
LSM303_MAG_ODR_
1_25
_Hz
);
lsm303_odr
(
DEV_MAG
,
LSM303_MAG_ODR_
20
_Hz
);
lsm303_opmode
(
DEV_MAG
,
LSM303_MAG_OPM_MED
,
LSM303_MAG_CONV_CONT
);
lsm303_fullscale
(
DEV_MAG
,
LSM303_16Ga
);
lsm303_selftest
(
DEV_MAG
,
0
,
0
);
...
...
@@ -358,6 +358,13 @@ int lsm303_fifo_mode(int dev, LSM303_FMODE_t mode, int en)
return
LSM303_SUCCESS
;
}
static
void
lsm303_iron_calib
(
lsm303_smpl
*
smpl
)
{
smpl
->
x
-=
LSM303_IRON_X
;
smpl
->
y
-=
LSM303_IRON_Y
;
smpl
->
z
-=
LSM303_IRON_Z
;
}
int
lsm303_get_sample
(
int
dev
,
lsm303_smpl
*
smpl
)
{
uint8_t
val_l
,
val_h
;
...
...
@@ -377,6 +384,8 @@ int lsm303_get_sample(int dev, lsm303_smpl *smpl)
return
LSM303_ERROR
;
smpl
->
z
=
(
int16_t
)
((
val_h
<<
8
)
|
val_l
);
lsm303_iron_calib
(
smpl
);
return
LSM303_SUCCESS
;
}
...
...
sw/common/drivers/LSM303C/lsm303c.h
View file @
dc7b44ec
...
...
@@ -20,6 +20,10 @@
#define DEV_ACC 0
#define DEV_MAG 1
#define LSM303_IRON_X 176
#define LSM303_IRON_Y 368
#define LSM303_IRON_Z 484
/* Accelerometer & Magnetometer registers */
//#define LSM303_ACC_TEMP_L 0x0B
//#define LSM303_ACC_TEMP_H 0x0C
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment