]> git.rkrishnan.org Git - dttsp.git/blobdiff - jDttSP/keyer.c
Major update
[dttsp.git] / jDttSP / keyer.c
index 581e51e548b67341837290ff87cf0074a4537d33..031b5f0ec1a347a0155e20b3d147385b3a88aaac 100644 (file)
@@ -201,116 +201,6 @@ klogic(KeyerLogic kl,
   return kl->timeout.beep > 0 && kl->timeout.dlay <= 0;
 }
 
-//========================================================================
-
-/* Read a straight key connected to a serial port, do debouncing, then
-   return the key state */
-
-BOOLEAN
-read_straight_key_serial(KeyerState ks, int fd) {
-  int i, j, serstatus;
-  static BOOLEAN keystate = 0;
-  static int debounce_buf_i = 0,
-             debounce_buf[DEBOUNCE_BUF_MAX_SIZE];
-
-  //***************************************************
-  // replace this with parallel port logic if necessary
-  //***************************************************
-  //
-  /* Read the key state */
-  if (ioctl(fd, TIOCMGET, &serstatus) != -1) {
-    debounce_buf[debounce_buf_i] =
-      (serstatus & (TIOCM_DSR | TIOCM_CTS)) ?
-      DSR_LINE_CLOSED_KEY : !DSR_LINE_CLOSED_KEY;
-
-    debounce_buf_i++;
-  }
-  //
-  //***************************************************
-  // back to business as usual
-  //***************************************************
-
-  /* If the debounce buffer is full, determine the state of the key */
-  if (debounce_buf_i >= ks->debounce) {
-    debounce_buf_i = 0;
-
-    j = 0;
-    for (i = 0; i < ks->debounce; i++)
-      if (debounce_buf[i])
-       j++;
-    keystate = (j > ks->debounce / 2) ? 1 : 0;
-  }
-
-  return keystate;
-}
-
-//------------------------------------------------------------------------
-
-/* Read an iambic key connected to a serial port, do debouncing, emulate a
-   straight key, then return the emulated key state */
-
-BOOLEAN
-read_iambic_key_serial(KeyerState ks, int fd, KeyerLogic kl, double ticklen) {
-  int i, j, serstatus;
-  static BOOLEAN dah_debounce_buf[DEBOUNCE_BUF_MAX_SIZE],
-                 dit_debounce_buf[DEBOUNCE_BUF_MAX_SIZE];
-  static int dah = 0, debounce_buf_i = 0, dit = 0;
-
-  //***************************************************
-  // replace this with parallel port logic if necessary
-  //***************************************************
-  //
-  /* Read the key states */
-  if (ioctl(fd, TIOCMGET, &serstatus) != -1) {
-    if (ks->flag.revpdl) {
-      dah_debounce_buf[debounce_buf_i] =
-       (serstatus & TIOCM_DSR) ? DSR_LINE_CLOSED_KEY : !DSR_LINE_CLOSED_KEY;
-      dit_debounce_buf[debounce_buf_i] =
-       (serstatus & TIOCM_CTS) ? CTS_LINE_CLOSED_KEY : !CTS_LINE_CLOSED_KEY;
-    } else {
-      dit_debounce_buf[debounce_buf_i] =
-       (serstatus & TIOCM_DSR) ? DSR_LINE_CLOSED_KEY : !DSR_LINE_CLOSED_KEY;
-      dah_debounce_buf[debounce_buf_i] =
-       (serstatus & TIOCM_CTS) ? CTS_LINE_CLOSED_KEY : !CTS_LINE_CLOSED_KEY;
-    }
-
-    debounce_buf_i++;
-  }
-  //
-  //***************************************************
-  // back to business as usual
-  //***************************************************
-
-  /* If the debounce buffer is full, determine the state of the keys */
-  if (debounce_buf_i >= ks->debounce) {
-    debounce_buf_i = 0;
-
-    j = 0;
-    for (i = 0; i < ks->debounce; i++)
-      if (dah_debounce_buf[i]) j++;
-    dah = (j > ks->debounce / 2) ? 1 : 0;
-
-    j = 0;
-    for (i = 0; i < ks->debounce; i++)
-      if (dit_debounce_buf[i]) j++;
-    dit = (j > ks->debounce / 2) ? 1 : 0;
-  }
-
-  return klogic(kl,
-               dit,
-               dah,
-               ks->wpm,
-               ks->mode,
-               ks->flag.mdlmdB,
-               ks->flag.memory.dit,
-               ks->flag.memory.dah,
-               ks->flag.autospace.khar,
-               ks->flag.autospace.word,
-               ks->weight,
-               ticklen);
-}
-
-//========================================================================
 
 KeyerState
 newKeyerState(void) {