Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
grove_compass_class.cpp@0:609518794a5d, 2015-06-09 (annotated)
- Committer:
- JackyZhangFromSeeed
- Date:
- Tue Jun 09 10:17:32 2015 +0000
- Revision:
- 0:609518794a5d
grove_compass
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| JackyZhangFromSeeed | 0:609518794a5d | 1 | |
| JackyZhangFromSeeed | 0:609518794a5d | 2 | |
| JackyZhangFromSeeed | 0:609518794a5d | 3 | #include "grove_compass_class.h" |
| JackyZhangFromSeeed | 0:609518794a5d | 4 | |
| JackyZhangFromSeeed | 0:609518794a5d | 5 | GroveCompass::GroveCompass(int pinsda, int pinscl) |
| JackyZhangFromSeeed | 0:609518794a5d | 6 | { |
| JackyZhangFromSeeed | 0:609518794a5d | 7 | this->i2c = (I2C_T *)malloc(sizeof(I2C_T)); |
| JackyZhangFromSeeed | 0:609518794a5d | 8 | grove_compass_init(this->i2c, pinsda, pinscl); |
| JackyZhangFromSeeed | 0:609518794a5d | 9 | } |
| JackyZhangFromSeeed | 0:609518794a5d | 10 | |
| JackyZhangFromSeeed | 0:609518794a5d | 11 | bool GroveCompass::write_setup(void) |
| JackyZhangFromSeeed | 0:609518794a5d | 12 | { |
| JackyZhangFromSeeed | 0:609518794a5d | 13 | return grove_compass_write_setup(this->i2c); |
| JackyZhangFromSeeed | 0:609518794a5d | 14 | } |
| JackyZhangFromSeeed | 0:609518794a5d | 15 | |
| JackyZhangFromSeeed | 0:609518794a5d | 16 | bool GroveCompass::read_compass_xyz(float *cx, float *cy, float *cz) |
| JackyZhangFromSeeed | 0:609518794a5d | 17 | { |
| JackyZhangFromSeeed | 0:609518794a5d | 18 | return grove_compass_getxyz_scaled(this->i2c, cx, cy, cz); |
| JackyZhangFromSeeed | 0:609518794a5d | 19 | } |
| JackyZhangFromSeeed | 0:609518794a5d | 20 | |
| JackyZhangFromSeeed | 0:609518794a5d | 21 | bool GroveCompass::read_compass_heading(float *heading) |
| JackyZhangFromSeeed | 0:609518794a5d | 22 | { |
| JackyZhangFromSeeed | 0:609518794a5d | 23 | return grove_compass_getheading(this->i2c, heading); |
| JackyZhangFromSeeed | 0:609518794a5d | 24 | } |