void main(void) { USBCDC_ResetBehaviour(&cdcBehaviour); USB_Init(&usbDefinition, &usbDevice); USB_SoftConnect(&usbDevice); GPIO_SetDir(LED_PORT, LED_PIN, GPIO_Output); GPIO_WriteOutput(LED_PORT, LED_PIN, false); counter = 0; while (1) { uint8_t ch; if (USBCDC_ReadBytes(&usbDevice, &cdcBehaviour, &ch, 1)) { counter++; GPIO_WriteOutput(LED_PORT, LED_PIN, counter & 1); if ((ch >= 'a') && (ch <= 'z')) ch -= 'a'-'A'; else if ((ch >= 'A') && (ch <= 'Z')) ch += 'a'-'A'; if ((ch == 'a') || (ch == 'A')) ch = '4'; if ((ch == 'i') || (ch == 'I')) ch = '1'; if ((ch == 'o') || (ch == 'O')) ch = '0'; if ((ch == 'e') || (ch == 'E')) ch = '3'; if ((ch == 'l') || (ch == 'L')) ch = '7'; if (ch == 's') ch = 'z'; if (ch == 'S') ch = 'Z'; USBCDC_WriteBytes(&usbDevice, &cdcBehaviour, &ch, 1); } } }
void main () { everypio_digital_input_set(BUTTON, PULL_UP); everypio_analog_input_set(X, true); everypio_analog_input_set(Y, true); USB_Init(&mouse_deviceDefinition, &mouse_device); USB_SoftConnect (&mouse_device); SYSCON_StartSystick_10ms(); }
void main () { every_gpio_set_dir (LED_PORT, LED_PIN, OUTPUT); every_gpio_write (LED_PORT, LED_PIN, false); every_gpio_set_dir (KEY_PORT, KEY_PIN, INPUT); EVERY_GPIO_SET_PULL (KEY_PORT, KEY_PIN, PULL_UP); buttonWasDown = false; downKey = 0; counter = -1; KeyboardInit (&usbDeviceDefinition, &usbDevice, &hidBehaviour, inBuffer, outBuffer, &idleValue, ¤tProtocol, inReportHandler, outReportHandler); USB_SoftConnect (&usbDevice); SYSCON_StartSystick (71999); // 1KHz }
void Upstream_Start() { USB_SoftConnect(&usbDevice); }