bluetooth.c 2.28 KB
Newer Older
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#if (defined (__PO_HI_NEED_DRIVER_BLUETOOTH))\n
/*
Code automatically generated by asn1scc tool
*/
#include <limits.h>
#include <string.h>
#include <math.h>


#include "bluetooth.h"

const __po_hi_c_bluetooth_conf_t crazyflie_default = {
    .channel = 80,
    .datarate = __po_hi_c_d2M,
    .address = {
        {
            0xE7,
            0xE7,
            0xE7,
            0xE7,
            0xE7
        }
    },
    .exist = {
        .datarate = 1,
        .address = 1
    }
};


void __po_hi_c_Datarate_T_Initialize(__po_hi_c_Datarate_T* pVal)
{
	(void)pVal;


	(*(pVal)) = __po_hi_c_d250K;
}

flag __po_hi_c_Datarate_T_IsConstraintValid(const __po_hi_c_Datarate_T* pVal, int* pErrCode)
{
    flag ret = TRUE;
	(void)pVal;
	
    ret = ((((((*(pVal)) == __po_hi_c_d250K)) || (((*(pVal)) == __po_hi_c_d1M)))) || (((*(pVal)) == __po_hi_c_d2M)));
    *pErrCode = ret ? 0 :  ERR_DATARATE_T; 

	return ret;
}



void __po_hi_c_Address_T_Initialize(__po_hi_c_Address_T* pVal)
{
	(void)pVal;


	memset(pVal->arr, 0x0, 5);


}

flag __po_hi_c_Address_T_IsConstraintValid(const __po_hi_c_Address_T* pVal, int* pErrCode)
{
    flag ret = TRUE;
	(void)pVal;
	
    ret = TRUE;
    *pErrCode = 0;

	return ret;
}



void __po_hi_c_bluetooth_conf_t_channel_Initialize(__po_hi_c_bluetooth_conf_t_channel* pVal)
{
	(void)pVal;


	(*(pVal)) = 0;
}
void __po_hi_c_bluetooth_conf_t_Initialize(__po_hi_c_bluetooth_conf_t* pVal)
{
	(void)pVal;



	/*set channel */
	__po_hi_c_bluetooth_conf_t_channel_Initialize((&(pVal->channel)));
	/*set datarate */
	pVal->exist.datarate = 1;
	pVal->datarate = __po_hi_c_d2M;
	/*set address */
	pVal->exist.address = 1;
	pVal->address.arr[0] = 0xe7;
	pVal->address.arr[1] = 0xe7;
	pVal->address.arr[2] = 0xe7;
	pVal->address.arr[3] = 0xe7;
	pVal->address.arr[4] = 0xe7;
}

flag __po_hi_c_bluetooth_conf_t_IsConstraintValid(const __po_hi_c_bluetooth_conf_t* pVal, int* pErrCode)
{
    flag ret = TRUE;
	(void)pVal;
	
    ret = (pVal->channel <= 125UL);
    *pErrCode = ret ? 0 :  ERR_BLUETOOTH_CONF_T_CHANNEL; 
    if (ret) {
        if (pVal->exist.datarate) {
        	ret = (((((pVal->datarate == __po_hi_c_d250K)) || ((pVal->datarate == __po_hi_c_d1M)))) || ((pVal->datarate == __po_hi_c_d2M)));
        	*pErrCode = ret ? 0 :  ERR_BLUETOOTH_CONF_T_DATARATE; 
        }
    }

	return ret;
}

\n#endif