Exemple de test
Fork of AS5600 by
AS5600.h@0:ec69fa9832e5, 2017-02-28 (annotated)
- Committer:
- gr66
- Date:
- Tue Feb 28 12:26:56 2017 +0000
- Revision:
- 0:ec69fa9832e5
Exemple de classe
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gr66 | 0:ec69fa9832e5 | 1 | |
gr66 | 0:ec69fa9832e5 | 2 | #include "mbed.h" |
gr66 | 0:ec69fa9832e5 | 3 | |
gr66 | 0:ec69fa9832e5 | 4 | |
gr66 | 0:ec69fa9832e5 | 5 | |
gr66 | 0:ec69fa9832e5 | 6 | class AS5600 { |
gr66 | 0:ec69fa9832e5 | 7 | public: |
gr66 | 0:ec69fa9832e5 | 8 | AS5600(PinName sda, PinName scl); |
gr66 | 0:ec69fa9832e5 | 9 | float getAngleDegrees(); |
gr66 | 0:ec69fa9832e5 | 10 | int getAngleAbsolute(); |
gr66 | 0:ec69fa9832e5 | 11 | int getAngleRelative(); |
gr66 | 0:ec69fa9832e5 | 12 | float getAngleMinMax(float angleMax); |
gr66 | 0:ec69fa9832e5 | 13 | |
gr66 | 0:ec69fa9832e5 | 14 | int isMagnetPresent(); |
gr66 | 0:ec69fa9832e5 | 15 | |
gr66 | 0:ec69fa9832e5 | 16 | void init(); |
gr66 | 0:ec69fa9832e5 | 17 | void setZero(); |
gr66 | 0:ec69fa9832e5 | 18 | |
gr66 | 0:ec69fa9832e5 | 19 | private: |
gr66 | 0:ec69fa9832e5 | 20 | char read(char address); |
gr66 | 0:ec69fa9832e5 | 21 | I2C i2c; |
gr66 | 0:ec69fa9832e5 | 22 | unsigned char addresse; |
gr66 | 0:ec69fa9832e5 | 23 | int relative_zero ; |
gr66 | 0:ec69fa9832e5 | 24 | }; |
gr66 | 0:ec69fa9832e5 | 25 | |
gr66 | 0:ec69fa9832e5 | 26 | |
gr66 | 0:ec69fa9832e5 | 27 |