Commit edfb2899 authored by Jerome Hugues's avatar Jerome Hugues

* Added Bluetooth configuration from TASTE

parent 0e86b129
AUTOMAKE_OPTIONS = no-dependencies
C_FILES = $(srcdir)/1553.c \
$(srcdir)/ip.c \
$(srcdir)/serial.c \
$(srcdir)/spacewire.c
ASN_FILES = $(srcdir)/1553.asn \
$(srcdir)/ip.asn \
$(srcdir)/serial.asn \
$(srcdir)/spacewire.asn
C_FILES = $(srcdir)/1553.c $(srcdir)/ip.c $(srcdir)/serial.c \
$(srcdir)/spacewire.c $(srcdir)/bluetooth.c
ASN_FILES = $(srcdir)/1553.asn $(srcdir)/ip.asn $(srcdir)/serial.asn \
$(srcdir)/spacewire.asn $(srcdir)/bluetooth.asn
csrc = ${shell $(CYGPATH_U) '$(OCARINA_RUNTIME)/polyorb-hi-c/src/drivers/configuration'}
t:
echo $(shell shell which asn1.exe)
echo `shell which asn1.exe`
$(srcdir)/1553.c:
mono $(shell which asn1.exe) -c -typePrefix __po_hi_c_ 1553.asn
sed -e 's/Mil\_1553\_Conf\_T/mil\_1553\_conf\_t/g' 1553.h > 1553new.h
......@@ -61,6 +52,17 @@ $(srcdir)/serial.c:
mv serial.h ../../../include/drivers/configuration/
mv asn1crt.h ../../../include/drivers/configuration/
$(srcdir)/bluetooth.c:
mono $$(which asn1.exe) -c -typePrefix __po_hi_c_ bluetooth.asn
sed -e 's/Bluetooth\_Conf\_T/bluetooth\_conf\_t/g' bluetooth.h > bluetoothnew.h
mv bluetoothnew.h bluetooth.h
echo "#if (defined (__PO_HI_NEED_DRIVER_BLUETOOTH))\n" > bluetoothnew.c
sed -e 's/Bluetooth\_Conf\_T/bluetooth\_conf\_t/g' bluetooth.c >> bluetoothnew.c
echo "\n#endif" >> bluetoothnew.c
mv bluetoothnew.c bluetooth.c
mv bluetooth.h ../../../include/drivers/configuration/
mv asn1crt.h ../../../include/drivers/configuration/
regenerate:
rm -f $(C_FILES)
for v in $(C_FILES); do $(MAKE) $$v ; done
......
POHICDRIVER-BLUETOOTH DEFINITIONS AUTOMATIC TAGS ::= BEGIN
Datarate-T ::= ENUMERATED {d250K, d1M, d2M}
Address-T ::= OCTET STRING (SIZE (5))
Bluetooth-Conf-T ::= SEQUENCE {
channel INTEGER (0..125),
datarate Datarate-T DEFAULT d2M,
address Address-T DEFAULT 'E7E7E7E7E7'H
}
crazyflie-default Bluetooth-Conf-T ::= {
channel 80,
datarate d2M,
address 'E7E7E7E7E7'H
}
END
#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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment