Move alarm and time types into dedicated headers

This commit is contained in:
Camden Dixie O'Brien 2023-05-21 13:12:49 +01:00
parent 7434f4f037
commit 3d8ec33cd3
5 changed files with 54 additions and 29 deletions

View File

@ -6,17 +6,11 @@
#ifndef ALARM_STORE_H
#define ALARM_STORE_H
#include "time_manager.h"
#include "alarm_types.h"
#include "sdkconfig.h"
#include <stdbool.h>
typedef struct {
bool set;
Time time;
bool days[WEEK_DAY_COUNT];
} Alarm;
extern Alarm alarms[CONFIG_MAX_ALARMS];
/**

View File

@ -0,0 +1,19 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright (c) Camden Dixie O'Brien
*/
#ifndef ALARM_TYPE_H
#define ALARM_TYPE_H
#include "time_types.h"
#include <stdbool.h>
typedef struct {
bool set;
Time time;
bool days[WEEK_DAY_COUNT];
} Alarm;
#endif

View File

@ -8,6 +8,7 @@
#include "alarm_store.h"
#include "console.h"
#include "sound.h"
#include "time_manager.h"
#include "esp_log.h"
#include "freertos/FreeRTOS.h"

View File

@ -6,28 +6,7 @@
#ifndef TIME_MANAGER_H
#define TIME_MANAGER_H
typedef struct {
unsigned hour;
unsigned minute;
unsigned second;
} Time;
typedef struct {
unsigned year;
unsigned month;
unsigned day;
} Date;
typedef enum {
WEEK_DAY_MONDAY,
WEEK_DAY_TUESDAY,
WEEK_DAY_WEDNESDAY,
WEEK_DAY_THURSDAY,
WEEK_DAY_FRIDAY,
WEEK_DAY_SATURDAY,
WEEK_DAY_SUNDAY,
WEEK_DAY_COUNT,
} WeekDay;
#include "time_types.h"
typedef void (*TimeCallback)(Time now);

View File

@ -0,0 +1,32 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright (c) Camden Dixie O'Brien
*/
#ifndef TIME_TYPES_H
#define TIME_TYPES_H
typedef struct {
unsigned hour;
unsigned minute;
unsigned second;
} Time;
typedef struct {
unsigned year;
unsigned month;
unsigned day;
} Date;
typedef enum {
WEEK_DAY_MONDAY,
WEEK_DAY_TUESDAY,
WEEK_DAY_WEDNESDAY,
WEEK_DAY_THURSDAY,
WEEK_DAY_FRIDAY,
WEEK_DAY_SATURDAY,
WEEK_DAY_SUNDAY,
WEEK_DAY_COUNT,
} WeekDay;
#endif