//
// Created by ZK on 2023/3/14.
//

//#include "Communication.h"
#include "APP_Main.h"

#define BYTE0(dwTemp)     (*(char*)(&dwTemp))
#define BYTE1(dwTemp)     (*((char*)(&dwTemp) + 1))
#define BYTE2(dwTemp)     (*((char*)(&dwTemp) + 2))
#define BYTE3(dwTemp)     (*((char*)(&dwTemp) + 3))

uint8_t USBCDC_SendBuffur[APP_TX_DATA_SIZE];

void SendCurrent_Vofa(float a, float b, float c) {
    uint16_t USBCDC_SendBuffur_count = 0;

    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = BYTE0(a);
    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = BYTE1(a);
    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = BYTE2(a);
    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = BYTE3(a);
    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = BYTE0(b);
    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = BYTE1(b);
    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = BYTE2(b);
    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = BYTE3(b);
    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = BYTE0(c);
    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = BYTE1(c);
    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = BYTE2(c);
    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = BYTE3(c);
//    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = BYTE0(a);
//    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = BYTE1(a);
//    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = BYTE0(b);
//    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = BYTE1(b);
//    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = BYTE0(c);
//    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = BYTE1(c);

    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = 0x00;
    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = 0x00;
    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = 0x80;
    USBCDC_SendBuffur[USBCDC_SendBuffur_count++] = 0x7f;

    CDC_Transmit_FS(USBCDC_SendBuffur, USBCDC_SendBuffur_count);
}
