Pico GPS Teseo I2C
Loading...
Searching...
No Matches
teseo::teseo Class Referenceexport
module teseo

Driver class for ST Teseo IC. More...

Collaboration diagram for teseo::teseo:
Collaboration graph

Public Member Functions

 teseo ()
 constructor.
 
callbackmanager::Callback< void, const std::string & > & writer ()
 expose the callback manager for writing to Teseo.
 
callbackmanager::Callback< void, std::string & > & reader ()
 expose the callback manager for reading from Teseo
 
callbackmanager::Callback< void > & resetter ()
 expose the callback manager for resetting the Teseo
 
void initialize ()
 configure the Teseo for use as a position sensor (optional).
 
void write (const std::string &s)
 write command to the Teseo
 
void read (std::string &s)
 read data from the Teseo
 
bool ask_nmea (const nmea_rr &command, std::string &s)
 send NMEA request to the Teseo and return reply
 
bool ask_nmea_multiple (const nmea_rr &command, std::span< std::string > strings, unsigned int &count)
 send NMEA request to the Teseo and return multi line reply
 
bool ask_gll (std::string &s)
 get GLL request to the Teseo and read reply
 
bool ask_gsv (std::span< std::string > strings, unsigned int &count)
 get GSV request to the Teseo and read reply
 
bool ask_gsa (std::span< std::string > strings, unsigned int &count)
 get GSA request to the Teseo and read reply
 
bool ask_rmc (std::string &s)
 get RMC request to the Teseo and read reply
 
bool ask_gga (std::string &s)
 get GGA request to the Teseo and read reply
 
bool ask_vtg (std::string &s)
 get VTG request to the Teseo and read reply
 

Static Public Member Functions

static bool parse_multiline_reply (std::span< std::string > strings, const std::string s, unsigned int &count, const nmea_rr &command)
 utility to parse a multiline Teseo reply into separate strings
 

Detailed Description

Driver class for ST Teseo IC.

Understands the Teseo command set and replies. For the communication, it relies on I2C or UART functions that the user has to provide.
Callbacks are required for:

  • writing comms protocol
  • reading comms protocol
  • resetting the Teseo (optional, see init() documentation)

Definition at line 28 of file teseo_iface.cpp.

Constructor & Destructor Documentation

◆ teseo()

teseo::teseo::teseo ( )
inlineexport

constructor.

Definition at line 32 of file teseo_iface.cpp.

Member Function Documentation

◆ ask_gga()

bool teseo::teseo::ask_gga ( std::string & s)
export

get GGA request to the Teseo and read reply

Parameters
sstd::string reference gets the reply.
Returns
bool true if valid reply

Send request for GGA data to the Teseo. Retrieve the repy.

Definition at line 120 of file teseo.cpp.

◆ ask_gll()

bool teseo::teseo::ask_gll ( std::string & s)
export

get GLL request to the Teseo and read reply

Parameters
sstd::string reference gets the reply.
Returns
bool true if valid reply

Send request for GLL data to the Teseo. Retrieve the repy.

Definition at line 109 of file teseo.cpp.

◆ ask_gsa()

bool teseo::teseo::ask_gsa ( std::span< std::string > strings,
unsigned int & count )
export

get GSA request to the Teseo and read reply

Parameters
stringsstd::span<std::string> gets the reply.
countunsigned int reference gets count of replies.
Returns
boold true if validated.

Send request for GSA data to the Teseo. Retrieve the replies.

Definition at line 117 of file teseo.cpp.

◆ ask_gsv()

bool teseo::teseo::ask_gsv ( std::span< std::string > strings,
unsigned int & count )
export

get GSV request to the Teseo and read reply

Parameters
stringsstd::span<std::string> gets the reply.
countunsigned int reference gets count of replies.
Returns
boold true if validated.

Send request for GSV data to the Teseo. Retrieve the replies.

Definition at line 113 of file teseo.cpp.

◆ ask_nmea()

bool teseo::teseo::ask_nmea ( const nmea_rr & command,
std::string & s )
export

send NMEA request to the Teseo and return reply

Parameters
commandconst nmea_rr reference holds the NMEA command.
sstd::string reference gets the reply.
Returns
bool true if valid reply

Send NMEA request to the Teseo. Validate and Return the repy.

Definition at line 90 of file teseo.cpp.

◆ ask_nmea_multiple()

bool teseo::teseo::ask_nmea_multiple ( const nmea_rr & command,
std::span< std::string > strings,
unsigned int & count )
export

send NMEA request to the Teseo and return multi line reply

Parameters
commandconst nmea_rr reference holds the NMEA command.
stringsastd::span<std::string> gets the replies.
countunsigned int reference count of strings parsed.
Returns
bool true if valid reply

Send NMEA request that expects more than 1 reply to the Teseo. Validate and Return the repies.

Definition at line 100 of file teseo.cpp.

◆ ask_rmc()

bool teseo::teseo::ask_rmc ( std::string & s)
export

get RMC request to the Teseo and read reply

Parameters
sstd::string reference gets the reply.
Returns
bool true if valid reply

Send request for RMC data to the Teseo. Retrieve the repy.

Definition at line 124 of file teseo.cpp.

◆ ask_vtg()

bool teseo::teseo::ask_vtg ( std::string & s)
export

get VTG request to the Teseo and read reply

Parameters
sstd::string reference gets the reply.
Returns
bool true if valid reply

Send request for VTG data to the Teseo. Retrieve the repy.

Definition at line 128 of file teseo.cpp.

◆ initialize()

void teseo::teseo::initialize ( )
export

configure the Teseo for use as a position sensor (optional).

init() is used for dynamic configuration of the Teseo.
Precondition (asserted): the handlers have to be set by the developer before calling init().
Optional. When the Teseo is preset for i2c according to AN5203, init is not required, and developer can cut the 4s 10ms from the startup sequence, that are consumed during the reset sequence.
https://www.st.com/resource/en/application_note/an5203-teseoliv3f&ndash;i2c-positioning-sensor&ndash;stmicroelectronics.pdf
In that case, the developer doesn't need to provide a resetter callback handler.

Definition at line 26 of file teseo.cpp.

◆ parse_multiline_reply()

bool teseo::teseo::parse_multiline_reply ( std::span< std::string > strings,
const std::string s,
unsigned int & count,
const nmea_rr & command )
staticexport

utility to parse a multiline Teseo reply into separate strings

Parameters
stringsstd::span<std::string> will get the individual strings.
sconstant std::string reference string to be parsed.
countunsigned int reference gets count of strings parsed.
commandnmea_rr const reference used to validate the status line.
Returns
bool true if valid reply

split a big Teseo reply in its individual strings. The separator is "\r\n"

Definition at line 52 of file teseo.cpp.

◆ read()

void teseo::teseo::read ( std::string & s)
export

read data from the Teseo

Parameters
sstd::string reference.

Read replies from the Teseo by invoking the provided callback handler.
Precondition (asserted): the handler has to be set by the developer before first use.

Definition at line 85 of file teseo.cpp.

◆ reader()

callbackmanager::Callback< void, std::string & > & teseo::teseo::reader ( )
inlineexport

expose the callback manager for reading from Teseo

The developer has to register the logic for reading from the device.
Callback parameter: std::string reference where the data returned by the Teseo will be stored.
For instructions on how to register your handler, check the documentation of writer().

Definition at line 65 of file teseo_iface.cpp.

◆ resetter()

callbackmanager::Callback< void > & teseo::teseo::resetter ( )
inlineexport

expose the callback manager for resetting the Teseo

The developer has to register the logic that resets the device. It is optional. See the init() documentation.
The handler has to pull reset low then high. Then it needs to wait 4 seconds to allow the Teseo to boot.
Callback parameter: none.
For instructions on how to register your handler, check the documentation of writer().

Definition at line 76 of file teseo_iface.cpp.

◆ write()

void teseo::teseo::write ( const std::string & s)
export

write command to the Teseo

Parameters
sconstant std::string reference.

Write command to the Teseo by invoking the provided callback handler.
Precondition (asserted): the handler has to be set by the developer before first use.

Definition at line 80 of file teseo.cpp.

◆ writer()

callbackmanager::Callback< void, const std::string & > & teseo::teseo::writer ( )
inlineexport

expose the callback manager for writing to Teseo.

The developer has to register the logic for writing to the device.
Callback parameter: const std::string reference with data to be written to Teseo.
This can be a C style function, an object method, a static class object method, or lambda code.

Example code:

// device specific I2C writer function. Classic C style.
void write(const std::string& s) {
i2c_write_blocking(i2c_default, I2C_ADDR, reinterpret_cast<const uint8_t*>(s.c_str()), s.length() +1, false);
return;
}
// register that write() function as the handler for writing to the Teseo.
gps.writer().set([](const std::string& s) -> void {
write(s);
});
teseo()
constructor.
void write(const std::string &s)
write command to the Teseo
Definition teseo.cpp:80
#define I2C_ADDR

Definition at line 55 of file teseo_iface.cpp.


The documentation for this class was generated from the following files: