I need some pointers on finding documentation, Teensy3Clock

Status
Not open for further replies.

Kevin in NJ

New member
I am working on the learning curve with the Teensy.

What has been a challenge is learning about some of the functions and the options. I am working on a project to display GMT time and some text messages on a simple 16x2 display. Using the Teensy along with the Ultimate GPS Breakout to get the accurate GMT time.

Looking at examples I figured out how to move the time around. I have the time library list of commands, but can not find what all the options are for the Teensy3Clock class. All I have found is the reference to it in core_pins.h where it is just an extern reference.
I know there is .get and .set functions in the class, but are there more?
How do I find this out so I can find it all in the future on my own?

Just curious and having fun.

FWIW, I am also going to try and read IRIG-B time on the Teensy. If anyone has done this please send me pointers. I have a much bigger learning curve with that one. I have converted the WWVB code and have some loose code kind of working, but not. Nothing like having to work with 100 bits of data with 64 bit words and not being a very experienced programmer.
 
The forum is a great repository - that is hard to search - use Bing or something else. I just did a Bing with 'Teensy IRIG-B' and it found this post.

The installed Examples and source code (installed or GitHub Linked) may be the best resource you can find for supported libraries and devices. Some common libraries will be on http://www.pjrc.com/teensy/teensyduino.html the PJRC site - most anything on Arduino.cc will apply unless there is a custom Teensy version where it is unique to Teensy ARM versus Atmel AVR.

Assuming your working with a RTC aware Teensy 3.2/3.1 and installed a crystal - or are you only using external time data/devices?
 
I know there is .get and .set functions in the class, but are there more?
How do I find this out so I can find it all in the future on my own?

There is just one other function, to set the RTC's ability to compensate for known error in the crystal frequency. Normally this isn't used, but if you know your crystal has an error, you can try to adjust the time keeping slightly.

From the comments in the code:

Code:
// adjust is the amount of crystal error to compensate, 1 = 0.1192 ppm
// For example, adjust = -100 is slows the clock by 11.92 ppm
//
void rtc_compensate(int adjust)
 
Thanks guys!

I like the links that were sent. I have been a bit sidetracked as I got a GPS board and have time working using the GPS. I also had some issues with electrical differences between the 16X2 LCD vs the OLED. Seems the OLED is picky about what is powering it and the LCD is does not care. The OLED uses a different chipset and I guess does not like the 3.3 volt when coming from a USB wall power source. I am happy to work with LCD so that is not an issue.

I have managed to figure out some more items with getting the functions that are available in the libraries. So I am moving along.

Thanks!
 
But what file is this
Code:
Teensy3Clock
code in? I am trying to find it too, just to satisfy my curiosity mainly. I don't like to call a function without knowing where it comes from or what it does.
 
Also related is hardware initialization code in mk20dx128.c at line 1101.

https://github.com/PaulStoffregen/cores/blob/master/teensy3/mk20dx128.c#L1101

This code uses a magic variable called "__rtc_localtime", which is the time your program was compiled. It's inserted when Arduino runs the linker. See the linker command (and all other compiler commands... a lot info) by turning on verbose info while compiling in File > Preferences. This command is controlled by configuration in the platform.txt file, which uses lots of stuff defined in boards.txt (both located in your Arduino folder).

While technically not any part of Teensy3Clock, this init code and the special __rtc_localtime from the linker process are the magic that makes the RTC get set automatically to the correct time when you upload.
 
Status
Not open for further replies.
Back
Top