Escribiendo un valor de 32 bits en el búfer HID

0

Quiero saber cómo escribo un valor de 32 bits en el búfer escondido aquí está mi descriptor oculto.


0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x04, // USAGE (Joystick)
0xa1, 0x01, // COLLECTION (Application)
0x09, 0x01, // USAGE (Pointer)
0xa1, 0x00, // COLLECTION (Physical)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x30, // USAGE (X)
0x09, 0x31, // USAGE (Y)
0x09, 0x32, // USAGE (Z)
0x09, 0x33, // USAGE (Rx)
0x09, 0x34, // USAGE (Ry)
0x09, 0x35, // USAGE (Rz)
0x09, 0x36, // USAGE (Slider)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x03, // LOGICAL_MAXIMUM (1023)
0x75, 0x10, // REPORT_SIZE (16)
0x95, 0x07, // REPORT_COUNT (7)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x36, // USAGE (Slider)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x27, 0x3c, 0x86, 0x01, 0x00, // LOGICAL_MAXIMUM (99900)
0x75, 0x20, // REPORT_SIZE (32)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0xc0, // END_COLLECTION
0x06, 0x00, 0xff,   //   USAGE_PAGE (Vendor Defined Page 1)
0x09, 0x01, // USAGE (Vendor Usage 1)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x40, // REPORT_COUNT (64)
0x91, 0x00, // OUTPUT (Data,Ary,Abs)
0xc0 // END_COLLECTION

Aquí está el siguiente código de demostración para escribir el valor de 32 bits en el búfer hid pero no funciona. pero el valor de 16 bits está funcionando.


    unsigned int za, zb;
    long counter=99900;
    x_axis = Adc_Read(0);      //Read 10 bits of the ADC
    y_axis = Adc_Read(1);
    spoiler   = Adc_Read(2);
    throttle1 = Adc_Read(3);
    throttle2 = Adc_Read(4);
    flap      = Adc_Read(5);
    rudder    = Adc_Read(6);

    //USB Buffer
    writebuff[0]  = Lo(x_axis);
    writebuff[1]  = Hi(x_axis);
    writebuff[2]  = Lo(y_axis);
    writebuff[3]  = Hi(y_axis);
    writebuff[4]  = Lo(spoiler);
    writebuff[5]  = Hi(spoiler);
    writebuff[6] = Lo(throttle1);
    writebuff[7] = Hi(throttle1);
    writebuff[8] = Lo(throttle2);
    writebuff[9] = Hi(throttle2);
    writebuff[10] = Lo(flap);
    writebuff[11] = Hi(flap);
    writebuff[12]  = Lo(rudder);
    writebuff[13]  = Hi(rudder);

    za = LoWord(counter);
    zb = HiWord(counter);
    writebuff[14]  = Lo(za);
    writebuff[15]  = Hi(za);
    writebuff[16]  = Lo(zb);
    writebuff[17]  = Hi(zb);
    while(!HID_Write(&writebuff,18));

    
pregunta Omais Ahmed

0 respuestas

Lea otras preguntas en las etiquetas