mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
More HID work.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@173 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
eb7787e2ee
commit
e39f2801d1
@ -42,7 +42,8 @@
|
||||
|
||||
/* ISTR events */
|
||||
/* mask defining which events has to be handled by the device application software */
|
||||
#define IMR_MSK (CNTR_CTRM | CNTR_WKUPM | CNTR_SUSPM | CNTR_ERRM | CNTR_SOFM | CNTR_ESOFM | CNTR_RESETM)
|
||||
/* Unused; #define IMR_MSK (CNTR_CTRM | CNTR_WKUPM | CNTR_SUSPM | CNTR_ERRM | CNTR_SOFM | CNTR_ESOFM | CNTR_RESETM) */
|
||||
#define IMR_MSK (CNTR_RESETM | CNTR_SOFM | CNTR_CTRM)
|
||||
|
||||
/* Local types */
|
||||
typedef enum _DEVICE_STATE {
|
||||
@ -220,6 +221,7 @@ static const USER_STANDARD_REQUESTS My_User_Standard_Requests = {
|
||||
static DEVICE_INFO My_Device_Info;
|
||||
/* USB device status */
|
||||
static volatile uint32_t bDeviceState = UNCONNECTED;
|
||||
__IO uint8_t bIntPackSOF = 0;
|
||||
|
||||
/**
|
||||
* Initialises USB interface
|
||||
|
@ -44,6 +44,7 @@ static uint8_t sdcard_available;
|
||||
|
||||
/* Function Prototypes */
|
||||
static void TaskTick(void *pvParameters);
|
||||
static void TaskHIDTest(void *pvParameters);
|
||||
static void TaskServos(void *pvParameters);
|
||||
static void TaskHooks(void *pvParameters);
|
||||
static void TaskSDCard(void *pvParameters);
|
||||
@ -61,6 +62,8 @@ int main()
|
||||
/* Delay system */
|
||||
PIOS_DELAY_Init();
|
||||
|
||||
|
||||
|
||||
/* SPI Init */
|
||||
PIOS_SPI_Init();
|
||||
|
||||
@ -101,34 +104,14 @@ int main()
|
||||
|
||||
PIOS_USB_Init(0);
|
||||
|
||||
__IO uint8_t Send_Buffer[2];
|
||||
uint8_t count = 0;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
/* Report ID */
|
||||
Send_Buffer[0] = 0x07;
|
||||
|
||||
/* Report Data */
|
||||
Send_Buffer[1] = count;
|
||||
USB_SIL_Write(EP1_IN, (uint8_t*) Send_Buffer, 2);
|
||||
|
||||
if(count >= 255) {
|
||||
count = 0;
|
||||
} else {
|
||||
count++;
|
||||
}
|
||||
|
||||
PIOS_DELAY_WaitmS(50);
|
||||
}
|
||||
|
||||
//PIOS_COM_ReceiveCallbackInit(CONSOLE_Parse);
|
||||
PIOS_COM_ReceiveCallbackInit(CONSOLE_Parse);
|
||||
|
||||
/* Initialise OpenPilot application */
|
||||
// OpenPilotInit();
|
||||
|
||||
/* Create a FreeRTOS task */
|
||||
xTaskCreate(TaskTick, (signed portCHAR *)"Test", configMINIMAL_STACK_SIZE , NULL, 1, NULL);
|
||||
xTaskCreate(TaskHIDTest, (signed portCHAR *)"HIDTest", configMINIMAL_STACK_SIZE , NULL, 4, NULL);
|
||||
//xTaskCreate(TaskServos, (signed portCHAR *)"Servos", configMINIMAL_STACK_SIZE , NULL, 4, NULL);
|
||||
//xTaskCreate(TaskHooks, (signed portCHAR *)"Hooks", configMINIMAL_STACK_SIZE, NULL, PRIORITY_TASK_HOOKS, NULL);
|
||||
//xTaskCreate(TaskSDCard, (signed portCHAR *)"SDCard", configMINIMAL_STACK_SIZE, NULL, (tskIDLE_PRIORITY + 2), NULL);
|
||||
@ -187,6 +170,35 @@ static void TaskTick(void *pvParameters)
|
||||
}
|
||||
}
|
||||
|
||||
static void TaskHIDTest(void *pvParameters)
|
||||
{
|
||||
portTickType xDelay = 250 / portTICK_RATE_MS;;
|
||||
|
||||
__IO uint8_t Send_Buffer[2];
|
||||
uint8_t count = 0;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
/* Report ID */
|
||||
Send_Buffer[0] = 0x07;
|
||||
|
||||
/* Report Data */
|
||||
Send_Buffer[1] = count;
|
||||
|
||||
/* Write the data to the pipe */
|
||||
USB_SIL_Write(EP1_IN, (uint8_t*) Send_Buffer, 2);
|
||||
SetEPTxValid(ENDP1);
|
||||
|
||||
if(count >= 255) {
|
||||
count = 0;
|
||||
} else {
|
||||
count++;
|
||||
}
|
||||
|
||||
vTaskDelay(xDelay);
|
||||
}
|
||||
}
|
||||
|
||||
static void TaskServos(void *pvParameters)
|
||||
{
|
||||
/* For testing servo outputs */
|
||||
|
Loading…
Reference in New Issue
Block a user