/* Serializes a sensors_event_t object as a byte array.  */
size_t sensorsSerializeSensorsEvent(uint8_t *buffer, const sensors_event_t *event)
/* Serializes a sensors_event_t object as a byte array.  */
size_t sensorsSerializeSensorsEvent(uint8_t *buffer, const sensors_event_t *event)
{
   size_t i = 0;
   memcpy(&buffer[i], &event->version, sizeof event->version);
   i += sizeof event->version;
   memcpy(&buffer[i], &event->sensor_id, sizeof event->sensor_id);
   i += sizeof event->sensor_id;
   memcpy(&buffer[i], &event->type, sizeof event->type);
   i += sizeof event->type;
   memcpy(&buffer[i], &event->reserved0, sizeof event->reserved0);
   i += sizeof event->reserved0;
   memcpy(&buffer[i], &event->timestamp, sizeof event->timestamp);
   i += sizeof event->timestamp;
   memcpy(&buffer[i], &event->data, sizeof event->data);
   i += sizeof event->data;
   return i;
}