2012-11-27 17:51:59 +07:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <cr_section_macros.h>
|
|
|
|
#include <NXP/crp.h>
|
|
|
|
#include "tusb.h"
|
|
|
|
|
|
|
|
// Variable to store CRP value in. Will be placed automatically
|
|
|
|
// by the linker when "Enable Code Read Protect" selected.
|
|
|
|
// See crp.h header for more information
|
|
|
|
__CRP const unsigned int CRP_WORD = CRP_NO_CRP ;
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2012-11-28 11:53:23 +07:00
|
|
|
uint32_t currentSecond, lastSecond;
|
|
|
|
currentSecond = lastSecond = 0;
|
|
|
|
|
2012-11-27 17:51:59 +07:00
|
|
|
SystemInit();
|
2012-11-28 11:53:23 +07:00
|
|
|
|
|
|
|
systickInit(1);
|
|
|
|
GPIOInit();
|
|
|
|
|
|
|
|
#define CFG_LED_PORT (0)
|
|
|
|
#define CFG_LED_PIN (7)
|
|
|
|
#define CFG_LED_ON (1)
|
|
|
|
#define CFG_LED_OFF (0)
|
|
|
|
|
|
|
|
GPIOSetDir(CFG_LED_PORT, CFG_LED_PIN, 1);
|
|
|
|
LPC_GPIO->CLR[CFG_LED_PORT] = (1 << CFG_LED_PIN);
|
|
|
|
|
2012-11-27 17:51:59 +07:00
|
|
|
tusb_init();
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
2012-11-28 11:53:23 +07:00
|
|
|
currentSecond = systickGetSecondsActive();
|
|
|
|
if (currentSecond != lastSecond)
|
|
|
|
{
|
|
|
|
/* Toggle LED once per second */
|
|
|
|
lastSecond = currentSecond;
|
|
|
|
GPIOSetBitValue(CFG_LED_PORT, CFG_LED_PIN, lastSecond % 2);
|
|
|
|
|
|
|
|
#if !defined(CFG_USB_CDC)
|
|
|
|
if (usb_isConfigured())
|
|
|
|
{
|
|
|
|
#ifdef CFG_CLASS_HID_KEYBOARD
|
|
|
|
uint8_t keys[6] = {HID_USAGE_KEYBOARD_aA};
|
|
|
|
usb_hid_keyboard_sendKeys(0x00, keys, 1);
|
|
|
|
#endif
|
2012-11-27 17:51:59 +07:00
|
|
|
|
2012-11-29 16:32:49 +07:00
|
|
|
#ifdef CFG_CLASS_HID_MOUSE
|
2012-11-28 11:53:23 +07:00
|
|
|
usb_hid_mouse_send(0, 10, 10);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
2012-11-27 17:51:59 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|