Add some comment headers in my libraries
This commit is contained in:
@@ -2,6 +2,12 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TimeLib
|
||||||
|
* Based on the Time library by Michael Margolis (make and break time functions)
|
||||||
|
* Additions by: Sani7 (Sander Speetjens)
|
||||||
|
*/
|
||||||
|
|
||||||
// to transform a number of seconds into a current time you need to do some maths
|
// to transform a number of seconds into a current time you need to do some maths
|
||||||
#define NUMBEROFSECONDSPERDAY 86400UL
|
#define NUMBEROFSECONDSPERDAY 86400UL
|
||||||
#define NUMBEROFSECONDSPERHOUR 3600UL
|
#define NUMBEROFSECONDSPERHOUR 3600UL
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
|
|
||||||
/* An STM32 HAL library written for the DS3231 real-time clock IC. */
|
/* An STM32 HAL library written for the DS3231 real-time clock IC.
|
||||||
/* Based on a Library by @eepj www.github.com/eepj */
|
* Based on a Library by @eepj www.github.com/eepj
|
||||||
/* Moddifications by Sani7 */
|
* Moddifications by Sani7
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef DS3231_FOR_STM32_HAL_H
|
#ifndef DS3231_FOR_STM32_HAL_H
|
||||||
#define DS3231_FOR_STM32_HAL_H
|
#define DS3231_FOR_STM32_HAL_H
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
#include "Time.h"
|
#include "Time.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TimeLib
|
||||||
|
* Based on the Time library by Michael Margolis (make and break time functions)
|
||||||
|
* Additions by: Sani7 (Sander Speetjens)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fn uint8_t IsDST(ts*)
|
* @fn uint8_t IsDST(ts*)
|
||||||
* @brief This function calculates if we are in EDST
|
* @brief This function calculates if we are in EDST
|
||||||
@@ -14,13 +21,13 @@ uint8_t IsDST(ts *utc)
|
|||||||
// number of days of each month
|
// number of days of each month
|
||||||
uint8_t days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
uint8_t days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
||||||
|
|
||||||
// January, february, and december are out.
|
// November, December, January, february are out of DST.
|
||||||
if (utc->Month < 3 || utc->Month > 10)
|
if (utc->Month < 3 || utc->Month > 10)
|
||||||
{
|
{
|
||||||
utc->IsDST = 0;
|
utc->IsDST = 0;
|
||||||
return utc->IsDST;
|
return utc->IsDST;
|
||||||
}
|
}
|
||||||
// April to september are in
|
// April to september are in DST
|
||||||
if (utc->Month > 3 && utc->Month < 10)
|
if (utc->Month > 3 && utc->Month < 10)
|
||||||
{
|
{
|
||||||
utc->IsDST = 1;
|
utc->IsDST = 1;
|
||||||
@@ -32,7 +39,7 @@ uint8_t IsDST(ts *utc)
|
|||||||
days[1] -= (y % 4) || (!(y % 100) && (y % 400));
|
days[1] -= (y % 4) || (!(y % 100) && (y % 400));
|
||||||
d = days[m - 1];
|
d = days[m - 1];
|
||||||
|
|
||||||
/* dow is in normal format*/
|
// dow is in normal format
|
||||||
nextSunday = days[m - 1] - ((d += m < 3 ? y-- : y - 2, 23 * m / 9 + d + 4 + y / 4 - y / 100 + y / 400) % 7);
|
nextSunday = days[m - 1] - ((d += m < 3 ? y-- : y - 2, 23 * m / 9 + d + 4 + y / 4 - y / 100 + y / 400) % 7);
|
||||||
// Start: Last Sunday in March
|
// Start: Last Sunday in March
|
||||||
if (utc->Month == 3)
|
if (utc->Month == 3)
|
||||||
|
|||||||
Reference in New Issue
Block a user