#include <msp430.h>#include <stdbool.h>#include <stdint.h>Go to the source code of this file.
Macros | |
| #define | timerCountsInDay 60 * 60 * 24 / (capacityTimer / clockFreq) |
| #define | toothGearStepper 15.0 |
| #define | toothGearClock 24.0 |
| #define | gearRatio (toothGearClock / toothGearStepper) |
| #define | stepsFullRotationStepper 2048.0 |
| #define | stepsClockHour (stepsFullRotationStepper * gearRatio) |
| #define | stepsClockMinute (stepsClockHour / 60.0) |
| #define | stepsClockSecond (stepsClockMinute / 60.0) |
| #define | timePerStep (3600.0 / (stepsFullRotationStepper * gearRatio)) |
| #define | stepsToggleThreshold 20 |
| #define | clockWraparoundThresholdSec (10 * 60) |
| #define | stepsWrap (stepsClockHour * 24) |
| #define | secondsInDay 86400 |
| #define | stepsInDay (stepsClockSecond * secondsInDay) |
Functions | |
| void | calculateTimeDifference () |
| calculate the difference between the mechanical time and the current time to have the time difference which the stepper needs to be advanced with, gets called from end interrupt of ISR_TA0(void). | |
| uint32_t | calculateStepsToTake () |
| void | storeTimeLastCompleteDcfMessage () |
| void | resetTimeKeeping () |
| Reset the time settings on startup, gets called from main() | |
Variables | |
| bool | toggleCalculateTimeDifference |
| uint32_t | timeOfLastDcfMessage |
| uint32_t | timeSinceLastCompleteDcfMessage |
| double | mechanicalTimeFloat |
| uint32_t | stepsRemaining |
| volatile bool | toggleTimer1Direction |
| #define clockWraparoundThresholdSec (10 * 60) |
Definition at line 34 of file timeKeeping.h.
Referenced by calculateTimeDifference().
| #define gearRatio (toothGearClock / toothGearStepper) |
Definition at line 27 of file timeKeeping.h.
| #define secondsInDay 86400 |
Definition at line 36 of file timeKeeping.h.
Referenced by calculateTimeDifference().
| #define stepsClockHour (stepsFullRotationStepper * gearRatio) |
Definition at line 29 of file timeKeeping.h.
| #define stepsClockMinute (stepsClockHour / 60.0) |
Definition at line 30 of file timeKeeping.h.
| #define stepsClockSecond (stepsClockMinute / 60.0) |
Definition at line 31 of file timeKeeping.h.
Referenced by calculateStepsToTake().
| #define stepsFullRotationStepper 2048.0 |
Definition at line 28 of file timeKeeping.h.
| #define stepsInDay (stepsClockSecond * secondsInDay) |
Definition at line 37 of file timeKeeping.h.
Referenced by calculateTimeDifference().
| #define stepsToggleThreshold 20 |
Definition at line 33 of file timeKeeping.h.
Referenced by calculateTimeDifference().
| #define stepsWrap (stepsClockHour * 24) |
Definition at line 35 of file timeKeeping.h.
| #define timePerStep (3600.0 / (stepsFullRotationStepper * gearRatio)) |
Definition at line 32 of file timeKeeping.h.
Referenced by stepperAdvance().
| #define timerCountsInDay 60 * 60 * 24 / (capacityTimer / clockFreq) |
Definition at line 23 of file timeKeeping.h.
Referenced by ISR_TA1_CCR0().
| #define toothGearClock 24.0 |
Definition at line 26 of file timeKeeping.h.
| #define toothGearStepper 15.0 |
Definition at line 25 of file timeKeeping.h.
| uint32_t calculateStepsToTake | ( | ) |
Referenced by calculateTimeDifference().
| void calculateTimeDifference | ( | ) |
calculate the difference between the mechanical time and the current time to have the time difference which the stepper needs to be advanced with, gets called from end interrupt of ISR_TA0(void).
It then calculates the amount of steps that are needed to advance the clock to display the current time. The function take in to account which way it is the fastest to fully wrap the clock or to wait until the time synchronizes
Definition at line 26 of file timeKeeping.c.
References calculateStepsToTake(), clockWraparoundThresholdSec, countDcf77Messages, mechanicalTimeFloat, secondsInDay, stepsInDay, stepsRemaining, stepsToggleThreshold, timeOfLastDcfMessage, timerCompareStepperSpeedToggle, timeSinceLastCompleteDcfMessage, toggleCalculateTimeDifference, toggleFwdInterrupt, toggleFwdInterruptISR, and toggleInterruptDcf.
Referenced by ISR_TA0().
| void resetTimeKeeping | ( | ) |
Reset the time settings on startup, gets called from main()
Definition at line 142 of file timeKeeping.c.
References mechanicalTimeFloat, timeOfLastDcfMessage, and timeSinceLastCompleteDcfMessage.
Referenced by main().
| void storeTimeLastCompleteDcfMessage | ( | ) |
| double mechanicalTimeFloat |
Definition at line 40 of file timeKeeping.h.
Referenced by calculateTimeDifference(), decodeBitStream2Seconds(), main(), resetTimeKeeping(), and stepperAdvance().
| uint32_t stepsRemaining |
Definition at line 43 of file timeKeeping.h.
Referenced by calculateTimeDifference(), and stepperAdvance().
| uint32_t timeOfLastDcfMessage |
Definition at line 21 of file timeKeeping.h.
Referenced by calculateTimeDifference(), decodeBitStream2Seconds(), main(), and resetTimeKeeping().
| uint32_t timeSinceLastCompleteDcfMessage |
Definition at line 22 of file timeKeeping.h.
Referenced by calculateTimeDifference(), decodeBitStream2Seconds(), ISR_TA1_CCR0(), resetTimeKeeping(), and setupTimer1().
|
extern |
Definition at line 16 of file timeKeeping.c.
Referenced by calculateTimeDifference(), ISR_TA0(), and stepperAdvance().
| volatile bool toggleTimer1Direction |
Definition at line 46 of file timeKeeping.h.
Referenced by interruptDcf(), ISR_TA1(), ISR_TA1_CCR0(), and setupTimer1().