|
enum | CompassStatus {
CompassStatusUnavailable = -1,
CompassStatusDataInvalid = 0,
CompassStatusCalibrating,
CompassStatusCalibrated,
CompassStatusUnavailable = -1,
CompassStatusDataInvalid = 0,
CompassStatusCalibrating,
CompassStatusCalibrated
} |
| Enum describing the current state of the Compass Service. More...
|
|
enum | CompassStatus {
CompassStatusUnavailable = -1,
CompassStatusDataInvalid = 0,
CompassStatusCalibrating,
CompassStatusCalibrated,
CompassStatusUnavailable = -1,
CompassStatusDataInvalid = 0,
CompassStatusCalibrating,
CompassStatusCalibrated
} |
| Enum describing the current state of the Compass Service. More...
|
|
\brief The Compass Service combines information from Pebble's accelerometer and
magnetometer to automatically calibrate
the compass and transform the raw magnetic field information into a \ref CompassHeading,
that is an angle to north. It also
provides magnetic north and information about its status and accuracy through the \ref
CompassHeadingData structure. The API is designed to also provide true north in a future
release.
Note that not all platforms have compasses. To check for the presence of a compass at
compile time for the current platform use the `PBL_COMPASS` define.
To learn more about the Compass Service and how to use it, read the
<a href="https://developer.getpebble.com/guides/pebble-apps/sensors/magnetometer/">
Determining Direction</a> guide.
For available code samples, see the
<a href="https://github.com/pebble-examples/feature-compass">feature-compass</a> example.
◆ CompassHeading [1/2]
Represents an angle relative to get to a reference direction, e.g. (magnetic) north. The angle value is scaled linearly, such that a value of TRIG_MAX_ANGLE corresponds to 360 degrees or 2 PI radians. Thus, if heading towards north, north is 0, west is TRIG_MAX_ANGLE/4, south is TRIG_MAX_ANGLE/2, and so on.
◆ CompassHeading [2/2]
Represents an angle relative to get to a reference direction, e.g. (magnetic) north. The angle value is scaled linearly, such that a value of TRIG_MAX_ANGLE corresponds to 360 degrees or 2 PI radians. Thus, if heading towards north, north is 0, west is TRIG_MAX_ANGLE/4, south is TRIG_MAX_ANGLE/2, and so on.
◆ CompassHeadingHandler [1/2]
Callback type for compass heading events
- Parameters
-
heading | copy of last recorded heading |
◆ CompassHeadingHandler [2/2]
Callback type for compass heading events
- Parameters
-
heading | copy of last recorded heading |
◆ CompassStatus [1/2]
Enum describing the current state of the Compass Service.
Enumerator |
---|
CompassStatusUnavailable | The Compass Service is unavailable.
|
CompassStatusDataInvalid | Compass is calibrating: data is invalid and should not be used Data will become valid once calibration is complete
|
CompassStatusCalibrating | Compass is calibrating: the data is valid but the calibration is still being refined.
|
CompassStatusCalibrated | Compass data is valid and the calibration has completed.
|
CompassStatusUnavailable | The Compass Service is unavailable.
|
CompassStatusDataInvalid | Compass is calibrating: data is invalid and should not be used Data will become valid once calibration is complete
|
CompassStatusCalibrating | Compass is calibrating: the data is valid but the calibration is still being refined.
|
CompassStatusCalibrated | Compass data is valid and the calibration has completed.
|
◆ CompassStatus [2/2]
Enum describing the current state of the Compass Service.
Enumerator |
---|
CompassStatusUnavailable | The Compass Service is unavailable.
|
CompassStatusDataInvalid | Compass is calibrating: data is invalid and should not be used Data will become valid once calibration is complete
|
CompassStatusCalibrating | Compass is calibrating: the data is valid but the calibration is still being refined.
|
CompassStatusCalibrated | Compass data is valid and the calibration has completed.
|
CompassStatusUnavailable | The Compass Service is unavailable.
|
CompassStatusDataInvalid | Compass is calibrating: data is invalid and should not be used Data will become valid once calibration is complete
|
CompassStatusCalibrating | Compass is calibrating: the data is valid but the calibration is still being refined.
|
CompassStatusCalibrated | Compass data is valid and the calibration has completed.
|
◆ compass_service_peek()
Peek at the last recorded reading.
- Parameters
-
- Returns
- Always returns 0 to indicate success.
◆ compass_service_set_heading_filter()
Set the minimum angular change required to generate new compass heading events. The angular distance is measured relative to the last delivered heading event. Use 0 to be notified of all movements. Negative values and values > TRIG_MAX_ANGLE / 2 are not valid. The default value of this property is TRIG_MAX_ANGLE / 360.
- Returns
- 0, success.
-
Non-Zero, if filter is invalid.
- See also
- compass_service_subscribe
◆ compass_service_subscribe()
Subscribe to the compass heading event service. Once subscribed, the handler gets called every time the angular distance relative to the previous value exceeds the configured filter.
- Parameters
-
handler | A callback to be executed on heading events |
- See also
- compass_service_set_heading_filter
-
compass_service_unsubscribe
◆ compass_service_unsubscribe()
void compass_service_unsubscribe |
( |
void |
| ) |
|
Unsubscribe from the compass heading event service. Once unsubscribed, the previously registered handler will no longer be called.
- See also
- compass_service_subscribe