GPS class
#include <main/devices/GPS/GPS.h>
Contents
A GPS peripheral. Tested on Adafruit's Ultimate GPS breakout.
Base classes
- class UARTPerif
Constructors, destructors, conversion operators
- GPS(uint8_t updateInterval = 2) explicit
Public functions
- auto begin() -> bool override
- auto isConnected() -> bool override
- void update()
- void registerHook(function<void(DevMap&)>&& hook)
Public variables
Protected functions
Protected variables
Private functions
- void updateData() override
- void representData() override
Function documentation
bool perif:: GPS:: begin() override
| Returns | whether the peripheral initialization succeeded |
|---|
Performs initialization of a peripheral. Necessary to avoid initialization in the constructor which causes many side effects.
bool perif:: GPS:: isConnected() override
#include <main/perif/UARTPerif.hpp>
| Returns | if the sensor is connected |
|---|
Returns whether the sensor is connected or not.
void perif:: GPS:: update()
#include <main/perif/Perif.hpp>
Performs a manual update of peripheral data and notifies observers.
void perif:: GPS:: registerHook(function<void(DevMap&)>&& hook)
#include <main/perif/Perif.hpp>
| Parameters | |
|---|---|
| hook | the observer function |
Registers a hook for obtaining sensor data on update in Json format.
Timer& perif:: GPS:: getTimer() protected
#include <main/perif/Perif.hpp>
| Returns | a timer reference |
|---|
Obtains a reference to this peripheral's timer.
void perif:: GPS:: updateData() override private
Updates sensor data. Subclasses should maintain a reference to the data obtained from this function so it can be provided to observers.
void perif:: GPS:: representData() override private
The representation of this peripheral's data in a meaningful way for debugging, caching, and database operations.
Variable documentation
DevMap perif:: GPS:: data
#include <main/perif/Perif.hpp>
The key-value mapping of peripheral data.
list<function<void(DevMap&)>> perif:: GPS:: hooks
#include <main/perif/Perif.hpp>
Hooks registered to this peripheral so observers can be notified of any necessary changes.
int perif:: GPS:: baud protected
#include <main/perif/UARTPerif.hpp>
The baud rate.
uint8_t perif:: GPS:: txPin protected
#include <main/perif/UARTPerif.hpp>
The transmit GPIO pins.
uint8_t perif:: GPS:: rxPin protected
#include <main/perif/UARTPerif.hpp>
The receive GPIO pins.
Timer perif:: GPS:: timer protected
#include <main/perif/Perif.hpp>
A timer for managing peripheral updates.