Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: extlib/PS2/PS2KB_INIT.h
- Revision:
- 5:61ad1a6be0fd
- Parent:
- 4:47b51250a168
diff -r 47b51250a168 -r 61ad1a6be0fd extlib/PS2/PS2KB_INIT.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/extlib/PS2/PS2KB_INIT.h Sun Jun 07 14:36:40 2020 +0000
@@ -0,0 +1,64 @@
+/**
+ * PS/2 keyboard interface control class (Version 0.0.1)
+ *
+ * Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems)
+ * http://shinta.main.jp/
+ */
+#ifndef _PS2KB_INIT_H_
+#define _PS2KB_INIT_H_
+
+#include "mbed.h"
+
+/**
+ * PS2 keyboard initializer.
+ */
+class PS2KB_INIT {
+public:
+
+ /**
+ * Create.
+ */
+ PS2KB_INIT(PinName clk_pin, PinName dat_pin);
+
+ /**
+ * Destroy.
+ */
+ ~PS2KB_INIT();
+private:
+ DigitalInOut clk;
+ DigitalInOut dat;
+
+ static const int MAX_RETRY = 1000000;
+
+ /**
+ * Send a byte data.
+ *
+ * @param c a character.
+ *
+ * @return Negative value is a error number.
+ */
+ int send(uint8_t c);
+
+ /**
+ * Receive a byte data.
+ *
+ * @return return a data. Negative value is a error number.
+ */
+ int recv(void);
+
+ /**
+ * Wait a clock down edge.
+ *
+ * @return true if wait done.
+ */
+ bool waitClockDownEdge(void);
+
+ /**
+ * Wait a clock up level.
+ *
+ * @return true if wait done.
+ */
+ bool waitClockUpLevel(void);
+};
+
+#endif