]> git.friedersdorff.com Git - max/tmk_keyboard.git/commitdiff
ibmpc: Add intruppt disable and enable function
authortmk <hasu@tmk-kbd.com>
Fri, 17 Jan 2020 13:34:44 +0000 (22:34 +0900)
committertmk <hasu@tmk-kbd.com>
Sat, 29 Feb 2020 08:29:54 +0000 (17:29 +0900)
tmk_core/protocol/ibmpc.c
tmk_core/protocol/ibmpc.h

index 92fc2beeb43dbbb1beb6b11912442ad70a698e40..f9374089a92bc322fffdcde8b9855c492259902e 100644 (file)
@@ -70,13 +70,26 @@ volatile uint8_t ibmpc_error = IBMPC_ERR_NONE;
 
 void ibmpc_host_init(void)
 {
-    clock_init();
-    data_init();
-    idle();
+    // initialize reset pin
+    IBMPC_RST_PORT |=  (1<<IBMPC_RST_BIT1);
+    IBMPC_RST_DDR  |=  (1<<IBMPC_RST_BIT1);
+    IBMPC_RST_PORT |=  (1<<IBMPC_RST_BIT2);
+    IBMPC_RST_DDR  |=  (1<<IBMPC_RST_BIT2);
+    inhibit();
     IBMPC_INT_INIT();
+    IBMPC_INT_OFF();
+}
+
+void ibmpc_host_enable(void)
+{
     IBMPC_INT_ON();
-    // POR(150-2000ms) plus BAT(300-500ms) may take 2.5sec([3]p.20)
-    //wait_ms(2500);
+    idle();
+}
+
+void ibmpc_host_disable(void)
+{
+    inhibit();
+    IBMPC_INT_OFF();
 }
 
 int16_t ibmpc_host_send(uint8_t data)
index 47e71e27e60288607b425bf29f4bd7b499db8787..ebaac137d720ee16eb98fb5e7e335b6ae4d0136c 100644 (file)
@@ -89,6 +89,8 @@ extern volatile uint8_t ibmpc_protocol;
 extern volatile uint8_t ibmpc_error;
 
 void ibmpc_host_init(void);
+void ibmpc_host_enable(void);
+void ibmpc_host_disable(void);
 int16_t ibmpc_host_send(uint8_t data);
 int16_t ibmpc_host_recv_response(void);
 int16_t ibmpc_host_recv(void);
@@ -102,12 +104,6 @@ void ibmpc_host_set_led(uint8_t usb_led);
 /*
  * Clock
  */
-static inline void clock_init(void)
-{
-    IBMPC_CLOCK_PORT &= ~(1<<IBMPC_CLOCK_BIT);
-    IBMPC_CLOCK_DDR  |=  (1<<IBMPC_CLOCK_BIT);
-}
-
 static inline void clock_lo(void)
 {
     IBMPC_CLOCK_PORT &= ~(1<<IBMPC_CLOCK_BIT);
@@ -132,12 +128,6 @@ static inline bool clock_in(void)
 /*
  * Data
  */
-static inline void data_init(void)
-{
-    IBMPC_DATA_DDR  &= ~(1<<IBMPC_DATA_BIT);
-    IBMPC_DATA_PORT |=  (1<<IBMPC_DATA_BIT);
-}
-
 static inline void data_lo(void)
 {
     IBMPC_DATA_PORT &= ~(1<<IBMPC_DATA_BIT);