RTC Inteface - Terrapin-Rocket-Team/SRAD-Avionics GitHub Wiki
Home/Documentation/RTC Interface
The RTC Interface (RTC.h
) - UNUSED
This interface extends the Sensor
interface and is used to define the functions that all RTC sensors must implement. This specifically includes accurate time readings. The RTC
class is responsible for parsing the module's data into local variables. The State
class then reads these variables to get the data.
Note: The getDataString()
and getStaticDataString()
functions are expected to return heap-allocated char*
s. This is because the State
class is responsible for freeing the memory after the data is used. getCsvHeader()
is expected to return a char[]
as a string literal (i.e. Don't delete[]
it).
Rather than list out all the functions here, I will refer you to the header file for the RTC
class. This prevents outdated documentation. The functions are documented in the header file.
Some important ideas to note:
- The
RTC
interface overrides thegetType()
andgetTypeString()
functions itself rather than leaving it to the fully derived implementation. This just makes it a bit easier to use. - The
RTC
class has a dependency on Adafruit'slibrary for vector math and storage. This is used to store time variables asimumaths
vector
s ofdouble
s. The library is included in the project, so you shouldn't need to worry about it. - The
RTC
class also has a dependency on theRTClib
library for interfacing with the RTC module. As this class is unused, the library may or may not be currently included in the project.
-
Sensor.h
- The Sensor interface. -
- The Adafruit library used for vector math and storage.imumaths
-
State.h
- The State estimation system.
A Real-Time Clock (RTC) is a computer clock that keeps track of the current time. It is used to provide accurate time readings to the flight computer. Our current RTC is the DS3231
, which is a highly accurate RTC module that can provide time readings accurate to within a few seconds per year. The RTC is used to provide an accurate time reference for the flight computer, which is important for logging data and for time-sensitive operations.
We have decided not to use an RTC at this time because we do not need time data that is so incredibly precise. The Teensy's internal RTC is plenty accurate for the purposes of our flight computer.