#ifndef __PACKET_H__
#define __PACKET_H__
#include <stdint.h>
#include "icm4x6xx.h"

#define PACKET_HAEDER_H         0x55
#define PACKET_HAEDER_L         0x55

typedef imu_wh_data imu_data_type;
#define UPLOAD_FIFO_SIZE        (8)

typedef struct
{
    uint8_t none;
}startup_upload_packet_t;


typedef struct
{
    uint8_t header_h;
    uint8_t header_l;
    imu_data_type imu;
    uint32_t rocker;
    uint32_t grip;
    uint8_t key;
    uint16_t power;
    uint8_t touch;
    uint32_t timestamp;
    uint16_t crc;
}period_upload_packet_t;

#define PERIOD_UPLOAD_DATA_LEN       sizeof(period_upload_packet_t)

typedef enum
{
    CELL_IDLE = 0,
    CELL_IN_PREPARING,
    CELL_READY,
    CELL_IN_UPLOADING,
}UPLOAD_CELL_STATE_t;


typedef struct
{
    period_upload_packet_t packet;
    UPLOAD_CELL_STATE_t state;
}upload_cell_t;


typedef struct
{
    //uint8_t cur_ul_idx;  /* current upload index */
    //uint8_t cur_prepare;  /* buffer is in filling data */
    upload_cell_t cell_array[UPLOAD_FIFO_SIZE];
}upload_fifo_t;


#endif  // @page end

