-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDataTransmission.cpp
76 lines (63 loc) · 2.13 KB
/
DataTransmission.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include "stdafx.h"
#include "Includes_app.h"
DataTransmission::DataTransmission()
{
}
DataTransmission::~DataTransmission()
{
}
void DataTransmission::doGetNormalData(int loop_times, uchar CMD, uchar DataType, uchar* target, const char* strFlag)
{
unsigned int i;
for (i = 0; i < loop_times; i++) //循环三次,防止数据传输异常
{
sdata_cmd[0] = CMD;
PC_SEND_FRAME(sdata_cmd, SPI_TYPE_CMD);
if (0 == PC_RECEIVE_FRAME(target, DataType))//正常得到数据,返回0
break;
}
if (i == loop_times)
fprintf(stderr, "Error: \"Get data of normal test \" --%s\n", strFlag);
}
void DataTransmission::GetNormalData_BASO(sample_info* psampledata)
{
doGetNormalData(3, SPI_CMD_REQBASO, SPI_TYPE_BASORES, (uchar*)psampledata->basograph, "BASO");
doGetNormalData(3, SPI_CMD_REQBASO_2, SPI_TYPE_BASORES, basograph_2, "BASO_2");
}
void DataTransmission::GetNormalData_LMNE(sample_info* psampledata)
{
doGetNormalData(6, SPI_CMD_REQLMNE, SPI_TYPE_LMNERES, (uchar*)psampledata->lmnegraph, "LMNE");
}
void DataTransmission::GetNormalData_HGB()
{
doGetNormalData(3, SPI_CMD_REQHGB, SPI_TYPE_HGBRES, hgbgraph, "HGB");
}
void DataTransmission::GetNormalData_RBC(sample_info* psampledata)
{
doGetNormalData(3, SPI_CMD_REQRBC, SPI_TYPE_RBCRES, (uchar*)psampledata->rbcgraph, "RBC");
doGetNormalData(3, SPI_CMD_REQRBC_2, SPI_TYPE_RBCRES, rbcgraph_2, "RBC_2");
}
void DataTransmission::GetNormalData_PLT(sample_info* psampledata)
{
doGetNormalData(3, SPI_CMD_REQPLT, SPI_TYPE_PLTRES, (uchar*)psampledata->pltgraph, "PLT");
doGetNormalData(3, SPI_CMD_REQPLT_2, SPI_TYPE_PLTRES, pltgraph_2, "PLT_2");
}
/***********************************************************
*Function: GetNormalTestData
*Description: SPI通信接收测试数据
*Called by:
*Params illustration:
*Other:
*History:
************************************************************/
void DataTransmission::GetNormalTestData(uchar TestMode, sample_info* psampledata)
{
GetNormalData_BASO(psampledata);
if (WHOLEDIFF == TestMode || DILUENTDIFF == TestMode) //CBC模式不需要接收Lmne信号
{
GetNormalData_LMNE(psampledata);
}
GetNormalData_HGB();
GetNormalData_RBC(psampledata);
GetNormalData_PLT(psampledata);
}