2 Replies Latest reply on Jan 5, 2017 3:52 AM by astic_1570356

    data size difference



      A struct contaning all data required for my application stored in an uneven fashion which I crated just like how I arranged sensor data in HID input report using PRoC BLE device. By uneven I mean,

      struct {     uint8 data0;     uint16 data1;     uint32 data2;     uint8 data3;     uint16 data4; } InputReport;

      The above type of declaration creates padding. Now since, CyBle_HidssSetCharacteristicValue() function requires character array as input for new data update, I did below coding for sending data.


      InputReport report;
      uint8 *dataForTransmission;
      dataForTransmission = (uint8 *)malloc(sizeof(InputReport));
      memcpy(dataForTransmission, &report, sizeof(InputReport));
      CyBle_HidssSetCharacteristicValue(0, CYBLE_HIDS_REPORT_MAP, sizeof(InputReport), dataForTransmission);


      Will the above code create any problem, since structure has padding and not sure if HID database for report map does not have any padding like thing?