keil_examples/USBHID/demo.c
/*
 *  Set HID Output Report <- OutReport
 */
Set HID Output Report <- OutReport
Set HID Output Report < - OutReport
void SetOutReport (void) {
  static unsigned long led_mask[] = { 1<<28, 1<<29, 1UL<<31, 1<<2, 1<<3, 1<<4, 1<<5, 1<<6 };
  int i;
  for (i = 0; i < LED_NUM; i++) {
    if (OutReport & (1<<i)) {
      if (i < 3) LPC_GPIO1->FIOPIN |= led_mask[i];
      else       LPC_GPIO2->FIOPIN |= led_mask[i];
    } else {
      if (i < 3) LPC_GPIO1->FIOPIN &= ~led_mask[i];
      else       LPC_GPIO2->FIOPIN &= ~led_mask[i];
    }
  }
}
void SetOutReport ( void ) { static unsigned long led_mask [ ] = { 1 << 28 , 1 << 29 , 1UL << 31 , 1 << 2 , 1 << 3 , 1 << 4 , 1 << 5 , 1 << 6 } ; int i ; for ( i = 0 ; i < LED_NUM ; i ++ ) { if ( OutReport & ( 1 << i ) ) { if ( i < 3 ) LPC_GPIO1 -> FIOPIN |= led_mask [ i ] ; else LPC_GPIO2 -> FIOPIN |= led_mask [ i ] ; } else { if ( i < 3 ) LPC_GPIO1 -> FIOPIN &= ~ led_mask [ i ] ; else LPC_GPIO2 -> FIOPIN &= ~ led_mask [ i ] ; } } }
Set HID Output Report <- OutReport
Set HID Output Report < - OutReport