diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/atkbd.c | 25 | ||||
| -rw-r--r-- | app/prototypes.h | 2 | ||||
| -rw-r--r-- | app/tims_keyboard.c | 27 | ||||
| -rw-r--r-- | app/usb.c | 8 | 
4 files changed, 21 insertions, 41 deletions
diff --git a/app/atkbd.c b/app/atkbd.c index 1ba599a..d450bc2 100644 --- a/app/atkbd.c +++ b/app/atkbd.c @@ -470,23 +470,16 @@ atkbd_set_mbr (void)  } -void -atkbd_start (void) -{ - -  atkbd_reset (); -  atkbd_request_echo (); -  atkbd_set_mbr (); -  atkbd_set_scanset (2); -  atkbd_set_leds (saved_leds); - -  ready++; -}  void  atkbd_init (void)  {    atkbd_set (1, 1); +} + +void atkbd_start(void) +{ +  if (ready) return;    nvic_enable_irq (NVIC_EXTI0_IRQ); @@ -498,6 +491,14 @@ atkbd_init (void)    exti_reset_request (KBCLK);    nvic_enable_irq (KBCLK_IRQ); +  delay_ms(AT_KBD_INIT_TIME); +  atkbd_reset (); +  atkbd_request_echo (); +  atkbd_set_mbr (); +  atkbd_set_scanset (2); +  atkbd_set_leds (saved_leds); + +  ready++;  } diff --git a/app/prototypes.h b/app/prototypes.h index 8849f83..16aa300 100644 --- a/app/prototypes.h +++ b/app/prototypes.h @@ -33,8 +33,8 @@ extern int atkbd_set_leds(uint8_t leds);  extern int atkbd_set_scanset(uint8_t scanset);  extern int atkbd_set_mb(void);  extern int atkbd_set_mbr(void); -extern void atkbd_start(void);  extern void atkbd_init(void); +extern void atkbd_start(void);  /* ring.c */  extern void ring_init(volatile ring_t *r, uint8_t *buf, size_t len);  extern int ring_write_byte(volatile ring_t *r, uint8_t c); diff --git a/app/tims_keyboard.c b/app/tims_keyboard.c index 4897c4d..b67e46a 100644 --- a/app/tims_keyboard.c +++ b/app/tims_keyboard.c @@ -26,33 +26,12 @@ main (void)    nvic_set_priority (NVIC_SYSTICK_IRQ, 0x80);    nvic_set_priority (NVIC_EXTI0_IRQ, 0xc0); -  usart_init (); -  ticker_init (); - -#ifdef DEBUG -  printf ("USART and ticker started\r\n"); -#endif +  atkbd_init();    usb_init (); -#ifdef DEBUG -  printf ("USB started\r\n"); -#endif - -  atkbd_init (); - -#ifdef DEBUG -  printf ("ATKBD i/f started\r\n"); -#endif - -  while (ticks < AT_KBD_INIT_TIME) -    usb_poll (); - -  atkbd_start (); - -#ifdef DEBUG -  printf ("Keyboard started\r\n"); -#endif +  usart_init (); +  ticker_init ();    usb_run ();    return 0; @@ -90,12 +90,10 @@ usb_control_request (usbd_device * usbd_dev, struct usb_setup_data *req,        return 1;      case 1:        consumer_get_descriptor (buf, len); -      return 1; -    } -  *len = 0; -  return 0; +      return 1; +    }    *len = 0;    return 0; @@ -124,6 +122,8 @@ usb_set_config (usbd_device * usbd_dev, uint16_t wValue)                                    USB_REQ_TYPE_TYPE | USB_REQ_TYPE_RECIPIENT,                                    usb_control_class_request); + +  atkbd_start ();  }  /* Buffer to be used for control requests. */  | 
