#pragma once

#ifndef _CLOCK_H
#define _CLOCK_H

/* Includes */
#include "main.h"

/* type defs */
typedef enum {
  Lvl_Off = 0,
  Lvl_Min = 1,
  Lvl_2 = 2,
  Lvl_3 = 3,
  Lvl_Mdl = 4,
  Lvl_5 = 5,
  Lvl_Max = 6,
  Lvl_On = 7
} brigh_level_t;

/* macro */
#define FADE_START      0
#define FADE_STOP       15
#define FADE_STEP       1

// Day/Night mode
#define MORNING_HOUR    0x06
#define EVENING_HOUR    0x22
#define DAY_BR_LVL      (brigh_level_t)5
#define NIGHT_BR_LVL    (brigh_level_t)2

// Color HUE angle
#define COLOUR_RED      0
#define COLOUR_GREEN    20
#define COLOUR_BLUE     40
#define COLOUR_NIXIE    1

/* time constant in ms */
#define BTN_SCAN_PERIOD     10
#define BTN_SCAN_PAUSE      200
#define BTN_TIME_PRESSED    30
#define BTN_TIME_HOLDED     500
#define BTN_TIME_REPEATED   50

/* Display timeout, sec */
#define DISP_WDT_TIME   10

/* variables */
extern rtc_t Clock;

/* function prototypes */
void Clock_Init(void);
void btnProcess(void);
void new_Second(void);

#endif /* _CLOCK_H */
