Browse code

Add source code of the XiPC emulator

Pawel Jablonski authored on 17/03/2023 16:46:08
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,51 @@
1
+/*
2
+ * Author: Pawel Jablonski
3
+ * E-mail: pj@xirx.net
4
+ * WWW: xirx.net
5
+ * GIT: git.xirx.net
6
+ *
7
+ * License: You can use this code however you like
8
+ * but leave information about the original author.
9
+ * Code is free for non-commercial and commercial use.
10
+ */
11
+
12
+#ifndef RTC_H
13
+#define RTC_H
14
+
15
+#include <QObject>
16
+#include <QDateTime>
17
+
18
+//! This class contains Real Time Clock functions
19
+class RTC : public QObject
20
+{
21
+	Q_OBJECT
22
+
23
+	public:
24
+		//! Fields used by RTC to describe date and time
25
+		struct DateTime
26
+		{
27
+			unsigned char year; //!< year
28
+			unsigned char month; //!< month
29
+			unsigned char day; //!< day
30
+			unsigned char hour; //!< hour
31
+			unsigned char minute; //!< minute
32
+			unsigned char second; //!< second
33
+		};
34
+
35
+		RTC(QObject *parent = nullptr);
36
+
37
+		void reset();
38
+
39
+		void setDateTime(const QDateTime &dateTime);
40
+		void setDateTime(const RTC::DateTime &dateTime);
41
+
42
+		RTC::DateTime getDateTime();
43
+
44
+	private:
45
+		QDateTime dateTime; //!< Current date and time
46
+
47
+	signals:
48
+		void updateDateTimeSignal(QDateTime dateTime);
49
+};
50
+
51
+#endif