Serial Wombat Arduino Library
Loading...
Searching...
No Matches
SerialWombat8BOscillatorTuner Class Reference

A class which tunes the oscillator on a CH32V003 based Serial Wombat 8B chip. More...

#include <SerialWombat.h>

Public Member Functions

 SerialWombat8BOscillatorTuner (SerialWombatChip &serialWombatChip)
 Class constructor for SerialWombat8BOscillatorTuner.
 
void update ()
 Call periodically to tune the SW8B oscillator to reported millis.
 

Detailed Description

A class which tunes the oscillator on a CH32V003 based Serial Wombat 8B chip.

This class is designed to be called periodically in the program main loop. It compares the 1mS execution frame count to the millis() funciton provided by the host. When at least 10 seconds of execution have occured the class compares the counts and adjusts the CH32V003 HSI oscillator trim value slightly slower or faster. This can reduce the error in the Serial Wombat's nominal clock. Simply call update() periodically and the class will take care of the rest. Allow up to 10 calls at least 10 seconds apart each to reach optimal timing. See the example sketch for an example.

Definition at line 1786 of file SerialWombat.h.

Constructor & Destructor Documentation

◆ SerialWombat8BOscillatorTuner()

SerialWombat8BOscillatorTuner::SerialWombat8BOscillatorTuner ( SerialWombatChip & serialWombatChip)
inline

Class constructor for SerialWombat8BOscillatorTuner.

Parameters
serialWombatChipThe Serial Wombat chip on which the Oscillator will be tuned;

Definition at line 1817 of file SerialWombat.h.

Member Function Documentation

◆ update()

void SerialWombat8BOscillatorTuner::update ( )
inline

Call periodically to tune the SW8B oscillator to reported millis.

Definition at line 1822 of file SerialWombat.h.