134 #define CCAI_MSGP_SYS_RESET_IND_CMD 0x4180
138 #define CCAI_MSGR_SYS_VERION 0x6102
142 #define CCAI_MSGR_SYS_OSAL_NV_READ 0x6108
146 #define CCAI_MSGR_SYS_OSAL_NV_WRITE 0x6109
150 #define CCAI_MSGR_SYS_OSAL_START_TIMER 0x610A
154 #define CCAI_MSGR_SYS_OSAL_STOP_TIMER 0x610B
158 #define CCAI_MSGP_SYS_OSAL_TIMER_EXPIRED 0x4181
162 #define CCAI_MSGR_SYS_RANDOM 0x610C
166 #define CCAI_MSGR_SYS_ADC_READ 0x610D
170 #define CCAI_MSGR_SYS_GPIO 0x610E
174 #define CCAI_MSGR_SYS_TEST_LOOPBACK 0x6141
185 #define CCAI_MSGR_ZB_READ_CONFIGURATION 0x6604
189 #define CCAI_MSGR_ZB_WRITE_CONFIGURATION 0x6605
200 #define CCAI_MSGR_ZB_APP_REGISTER_REQUEST 0x660A
204 #define CCAI_MSGR_ZB_START_REQUEST 0x6600
208 #define CCAI_MSGP_ZB_START_CONFIRM 0x4680
212 #define CCAI_MSGR_ZB_PERMIT_JOINING_REQUEST 0x6608
216 #define CCAI_MSGR_ZB_BIND_DEVICE 0x6601
220 #define CCAI_MSGP_ZB_BIND_CONFIRM 0x4681
224 #define CCAI_MSGR_ZB_ALLOW_BIND 0x6602
228 #define CCAI_MSGP_ZB_ALLOW_BIND_CONFIRM 0x4682
232 #define CCAI_MSGR_ZB_SEND_DATA_REQUEST 0x6603
236 #define CCAI_MSGP_ZB_SEND_DATA_CONFIRM 0x4683
240 #define CCAI_MSGP_ZB_RECEIVE_DATA_INDICATION 0x4687
244 #define CCAI_MSGR_ZB_GET_DEVICE_INFO 0x6606
248 #define CCAI_MSGR_ZB_FIND_DEVICE_REQUEST 0x6607
252 #define CCAI_MSGP_ZB_FIND_DEVICE_CONFIRM 0x4685
263 #define CCAI_MSGR_AF_REGISTER 0x6400
267 #define CCAI_MSGR_AF_DATA_REQUEST 0x6401
271 #define CCAI_MSGP_AF_DATA_CONFIRM 0x4480
275 #define CCAI_MSGP_AF_INCOMING_MSG 0x4481
286 #define CCAI_MSGR_ZDO_NWK_ADDR_REQ 0x6500
290 #define CCAI_MSGP_ZDO_NWK_ADDR_RSP 0x4580
294 #define CCAI_MSGR_ZDO_IEEE_ADDR_REQ 0x6501
298 #define CCAI_MSGP_ZDO_IEEE_ADDR_RSP 0x4581
302 #define CCAI_MSGR_ZDO_NODE_DESC_REQ 0x6502
306 #define CCAI_MSGP_ZDO_NODE_DESC_RSP 0x4582
310 #define CCAI_MSGR_ZDO_SIMPLE_DESC_REQ 0x6504
314 #define CCAI_MSGP_ZDO_SIMPLE_DESC_RSP 0x4584
318 #define CCAI_MSGR_ZDO_ACTIVE_EP_REQ 0x6505
322 #define CCAI_MSGP_ZDO_ACTIVE_EP_RSP 0x4585
326 #define CCAI_MSGR_ZDO_MATCH_DESC_REQ 0x6506
330 #define CCAI_MSGP_ZDO_MATCH_DESC_RSP 0x4586
334 #define CCAI_MSGP_ZDO_MATCH_DESC_RSP_SENT 0x45C2
338 #define CCAI_MSGR_ZDO_USER_DESC_REQ 0x6508
342 #define CCAI_MSGP_ZDO_USER_DESC_RSP 0x4588
346 #define CCAI_MSGR_ZDO_USER_DESC_SET 0x650B
350 #define CCAI_MSGP_ZDO_USER_DESC_CONF 0x4589
354 #define CCAI_MSGR_ZDO_END_DEVICE_ANNCE 0x650A
358 #define CCAI_MSGP_ZDO_END_DEVICE_ANNCE_IND 0x45C1
362 #define CCAI_MSGR_ZDO_END_DEVICE_BIND_REQ 0x6520 // Unclear sender from this line
366 #define CCAI_MSGP_ZDO_END_DEVICE_BIND_RSP 0x45A0
370 #define CCAI_MSGR_ZDO_BIND_REQ 0x6521
374 #define CCAI_MSGP_ZDO_BIND_RSP 0x45A1
378 #define CCAI_MSGR_ZDO_UNBIND_REQ 0x6522
382 #define CCAI_MSGP_ZDO_UNBIND_RSP 0x45A2
386 #define CCAI_MSGR_ZDO_MGMT_LQI_REQ 0x6531
390 #define CCAI_MSGP_ZDO_MGMT_LQI_RSP 0x45B1
394 #define CCAI_MSGR_ZDO_MGMT_LEAVE_REQ 0x6534
398 #define CCAI_MSGP_ZDO_MGMT_LEAVE_RSP 0x45B4
402 #define CCAI_MSGR_ZDO_MGMT_PERMIT_JOIN_REQ 0x6536
406 #define CCAI_MSGP_ZDO_MGMT_PERMIT_JOIN_RSP 0x45B6
410 #define CCAI_MSGP_ZDO_STATE_CHANGE_IND 0x45C0
559 P4OUT |= BIT0 | BIT1;
560 P4DIR |= BIT0 | BIT1;
578 P4OUT |= BIT0 | BIT1;
579 P4DIR |= BIT0 | BIT1;
1257 if ((len == 0) || (len > 128)) {
1302 UInt16 DeviceId, UInt8 DeviceVersion, UInt8 inputCommandsNum,
1303 char *InputCommandsList, UInt8 OutputCommandsNum,
1304 char *OutputCommandsList) {
1305 if (
spi_reqBegin(9 + (inputCommandsNum << 1) + (OutputCommandsNum << 1),
1313 spi_reqData(inputCommandsNum << 1, InputCommandsList);
1315 spi_reqData(OutputCommandsNum << 1, OutputCommandsList);
1422 uint64_t destination) {
1518 UInt8 handle, UInt8 ack, UInt8 radius, UInt8 len,
void *pBuf) {
1558 UInt8 handle, UInt8 ack, UInt8 radius, UInt8 len) {
#define CCAI_MSGP_ZB_RECEIVE_DATA_INDICATION
Sent by CC2480 to indicate that it has received a packet from a remote device.
#define CCAI_MSGR_ZDO_UNBIND_REQ
Not yet implemented in this version.
#define CCAI_MSGP_ZDO_BIND_RSP
Not yet implemented in this version.
#define CCAI_MSGP_ZDO_MGMT_LEAVE_RSP
Not yet implemented in this version.
Network functions interface.
void ccai_p_af_data_confirm()
Not implemented.
#define CCAI_MSGR_ZDO_IEEE_ADDR_REQ
Not yet implemented in this version.
#define CCAI_MSGP_ZDO_NODE_DESC_RSP
Not yet implemented in this version.
void ccai_r_sys_osal_stop_timer()
Stop timer response.
#define CCAI_MSGP_ZDO_SIMPLE_DESC_RSP
Not yet implemented in this version.
UInt8 ccai_s_zdo_nwk_addr_req()
Not implemented.
void nwk_allow_bindConfirm(char *pBuf)
Allow bind confirmation.
UInt8 ccai_s_zb_start_request()
Start request.
void ccai_r_zb_find_device_request()
Find device response.
UInt8 ccai_s_sys_version()
Version request.
void ccai_p_zdo_match_desc_rsp()
Not implemented.
Waiting for power-up report.
void ccai_r_zb_send_data_request()
Send data response.
UInt8 spi_reqBegin(UInt8 len, UInt8 cmd0, UInt8 cmd1)
Request begin.
UInt8 spi_reqData(UInt8 len, void *pBuf)
Request data.
UInt8 ccai_s_zdo_user_desc_set()
Not implemented.
UInt8 ccai_s_zdo_user_desc_req()
Not implemented.
void ccai_p_zdo_end_device_annce_ind()
Not implemented.
#define CCAI_MSGR_ZB_ALLOW_BIND
Response to a request to put CC2480 in allow binding mode.
void ccai_r_zdo_mgmt_lqi_req()
Not implemented.
void ccai_p_sys_osal_timer_expired()
Timer expired.
#define CCAI_MSGR_AF_REGISTER
Not yet implemented in this version.
void ccai_r_zdo_match_desc_req()
Not implemented.
void ccai_r_zdo_user_desc_set()
Not implemented.
#define CCAI_MSGP_ZDO_MGMT_PERMIT_JOIN_RSP
Not yet implemented in this version.
UInt8 ccai_s_zb_find_device_request(uint64_t searchKey)
Find device request.
#define CCAI_MSGP_ZDO_ACTIVE_EP_RSP
Not yet implemented in this version.
#define CCAI_MSGP_ZB_SEND_DATA_CONFIRM
Sent from CC2480 to return the results from a ZB_SEND_DATA_REQUEST.
#define CCAI_MSGR_AF_DATA_REQUEST
Not yet implemented in this version.
void ccai_p_zb_bind_confirm()
Bind device confirmation.
#define CCAI_MSGR_ZDO_END_DEVICE_BIND_REQ
Not yet implemented in this version.
#define CCAI_MSGP_ZDO_END_DEVICE_BIND_RSP
Not yet implemented in this version.
void ccai_r_zdo_mgmt_permit_join_req()
Not implemented.
Waiting for power-up report.
void ccai_p_zdo_node_desc_rsp()
Not implemented.
UInt8 ccai_s_sys_random()
Random request.
UInt8 ccai_s_sys_osal_start_timer(UInt8 id, UInt16 timeout)
Timer start request.
void nwk_allow_bindRsp()
Allow bind response.
void ccai_p_zdo_user_desc_rsp()
Not implemented.
void ccai_r_af_register()
Not implemented.
void ccai_p_zb_start_confirm()
Start confirmation.
#define CCAI_MSGP_SYS_RESET_IND_CMD
Sent by CC2480 after a reset.
void nwk_registerRsp(UInt8 status)
Register application response.
void ccai_r_zdo_bind_req()
Not implemented.
#define CCAI_MSGP_ZDO_STATE_CHANGE_IND
Not yet implemented in this version.
UInt8 nwk_wakeUp()
Network wake up.
ccai_state ccai_currentState
Current state of the CC2480 Application Interface.
void ccai_p_zb_receive_data_indication()
Receive data indication.
void nwk_setPermitJoinRsp()
Permit join response.
#define CCAI_MSGR_ZDO_SIMPLE_DESC_REQ
Not yet implemented in this version.
#define CCAI_MSGP_ZDO_END_DEVICE_ANNCE_IND
Not yet implemented in this version.
void nwk_configureWriteRsp(UInt8 status)
Response to a configuration write.
void ccai_r_sys_osal_nv_read()
Read memory response.
void ccai_p_zdo_mgmt_permit_join_rsp()
Not implemented.
#define CCAI_MSGR_SYS_ADC_READ
Response to a request to read from CC2480 ADC.
void ccai_r_zb_read_configuration()
Read configuration response.
#define CCAI_MSGP_ZB_FIND_DEVICE_CONFIRM
Sent by CC2480 to return the results from a ZB_FIND_DEVICE_REQUEST.
UInt8 ccai_s_zb_bind_device(UInt8 create, UInt16 commandId, uint64_t destination)
Bind device request.
#define CCAI_MSGP_ZB_ALLOW_BIND_CONFIRM
Sent by CC2480 when it responds to a bind request from a remote device.
UInt8 ccai_s_zb_send_data_request_payload(UInt8 len, void *pBuf)
Append data to the payload of send data request.
void ccai_p_zdo_user_desc_conf()
Not implemented.
void nwk_bind_deviceRsp()
Bind device response.
void ccai_r_zdo_unbind_req()
Not implemented.
#define CCAI_MSGR_ZB_FIND_DEVICE_REQUEST
Response to a request to determine the short address for a device in the network. ...
#define CCAI_MSGR_ZDO_MGMT_LEAVE_REQ
Not yet implemented in this version.
Holding reset signal low.
#define CCAI_MSGR_ZDO_USER_DESC_SET
Not yet implemented in this version.
void ccai_r_zb_start_request()
Start response.
void ccai_p_zdo_match_desc_rsp_sent()
Not implemented.
UInt8 ccai_s_zdo_active_ep_req()
Not implemented.
UInt8 ccai_s_sys_osal_stop_timer(UInt8 id)
Stop timer request.
#define CCAI_MSGP_ZDO_MATCH_DESC_RSP_SENT
Not yet implemented in this version.
#define CCAI_MSGR_SYS_RANDOM
Response to a request to read a 16 bit random number.
void ccai_p_zb_allow_bind_confirm()
Confirm of a new devide bound.
UInt8 ccai_s_zb_allow_bind(UInt8 timeout)
Allow bind request.
UInt8 ccai_s_zdo_end_device_bind_req()
Not implemented.
void ccai_resetFull()
Full reset.
void ccai_r_zb_get_device_info()
Get device information response.
UInt8 ccai_s_zb_get_device_info(UInt8 param)
Get device information request.
void ccai_p_af_incoming_msg()
Not implemented.
Reset afer firt configuration.
void ccai_p_zdo_active_ep_rsp()
Not implemented.
#define CCAI_MSGR_ZDO_ACTIVE_EP_REQ
Not yet implemented in this version.
#define CCAI_MSGR_ZDO_NWK_ADDR_REQ
Not yet implemented in this version.
void ccai_p_zdo_mgmt_lqi_rsp()
Not implemented.
#define CCAI_MSGR_ZB_START_REQUEST
Response to a request to start the ZigBee stack.
void ccai_p_zdo_end_device_bind_rsp()
Not implemented.
Holding reset signal low.
void nwk_startRsp()
Start network response.
void ccai_r_zb_bind_device()
Bind device response.
#define CCAI_MSGP_AF_DATA_CONFIRM
Not yet implemented in this version.
#define CCAI_MSGR_SYS_TEST_LOOPBACK
Response to a request to test the physical interface, SPI or UART.
#define CCAI_MSGR_ZB_WRITE_CONFIGURATION
Response to a request to write a configuration parameter.
void nwk_setDeviceType(nwk_devType newType)
Set device type.
UInt8 ccai_s_zdo_mgmt_leave_req()
Not implemented.
#define CCAI_MSGR_ZDO_MGMT_LQI_REQ
Not yet implemented in this version.
#define CCAI_MSGR_ZDO_END_DEVICE_ANNCE
Not yet implemented in this version.
UInt8 ccai_s_zb_send_data_request_begin(UInt16 destination, UInt16 commandId, UInt8 handle, UInt8 ack, UInt8 radius, UInt8 len)
Begin request to send data.
void ccai_r_zdo_mgmt_leave_req()
Not implemented.
#define CCAI_MSGP_AF_INCOMING_MSG
Not yet implemented in this version.
#define CCAI_MSGP_ZDO_USER_DESC_CONF
Not yet implemented in this version.
void ccai_r_sys_test_loopback()
Loopback test request.
void nwk_resetResume()
Resume from CC2480 reset.
#define CCAI_MSGR_SYS_GPIO
Response to a command to access the CC2480 GPIO.
#define CCAI_MSGP_ZB_START_CONFIRM
Sent by CC2480 to return the results from a ZB_START_REQUEST.
#define CCAI_MSGP_ZDO_MATCH_DESC_RSP
Not yet implemented in this version.
void ccai_r_zdo_end_device_annce()
Not implemented.
ccai_state
States of the CC2480 Application Interface.
void ccai_p_zdo_nwk_addr_rsp()
Not implemented.
void ccai_r_sys_osal_start_timer()
Start timer response.
void ccai_r_sys_random()
Random response.
#define CCAI_MSGR_ZB_GET_DEVICE_INFO
Response to a request to read a device information property.
UInt8 ccai_s_af_register()
Not implemented.
void ccai_resetLight()
Reset.
#define CCAI_MSGP_ZDO_IEEE_ADDR_RSP
Not yet implemented in this version.
#define CCAI_MSGR_ZB_SEND_DATA_REQUEST
Response to a request to transmit data to another device.
UInt8 ccai_s_zdo_node_desc_req()
Not implemented.
UInt8 ccai_s_sys_adc_read(UInt8 channel, UInt8 resolution)
Read ADC request.
void ccai_r_zb_allow_bind()
Allow bind response.
UInt8 ccai_s_sys_test_loopback(UInt8 len, char *pBuf)
Loopback test request.
#define CCAI_MSGR_SYS_OSAL_NV_READ
Response to a request to read an item from CC2480 NV memory.
UInt8 ccai_s_zdo_end_device_annce()
Not implemented.
#define CCAI_MSGP_SYS_OSAL_TIMER_EXPIRED
Sent by CC2480 when a software timer event expires.
void ccai_r_sys_adc_read()
Read ADC response.
#define CCAI_MSGP_ZDO_MGMT_LQI_RSP
Not yet implemented in this version.
void ccai_r_sys_gpio()
GPIO access response.
void ccai_r_af_data_request()
Not implemented.
char spi_buf[SPI_BUFSIZE]
SPI buffer, used to send and receive data.
UInt8 ccai_s_zdo_simple_desc_req()
Not implemented.
#define CCAI_MSGR_ZDO_MATCH_DESC_REQ
Not yet implemented in this version.
void ccai_r_sys_version()
Version response.
UInt8 ccai_a_sys_reset_req()
Reset Request.
void ccai_r_zb_write_configuration()
Write configuration response.
UInt8 ccai_s_sys_osal_nv_write(UInt16 id, UInt8 offset, UInt8 len, char *pBuf)
Write memory request.
void nwk_rcv(char *pBuf)
Network receive.
void ccai_p_zdo_state_change_ind()
Not implemented.
#define CCAI_MSGR_SYS_OSAL_START_TIMER
Response to a request to start a software timer.
UInt8 ccai_s_zdo_bind_req()
Not implemented.
UInt8 ccai_s_sys_osal_nv_read(UInt16 id, UInt8 offset)
Read memory request.
void ccai_process_message()
Proccess a received message.
void nwk_send_dataConfirm(UInt8 dataHandle, UInt8 status)
Send data confirmation.
UInt8 ccai_s_zb_app_register_request(UInt8 appEndPoint, UInt16 appProfileId, UInt16 DeviceId, UInt8 DeviceVersion, UInt8 inputCommandsNum, char *InputCommandsList, UInt8 OutputCommandsNum, char *OutputCommandsList)
Application register request.
void spi_reqEnd(UInt8 forwardToSerial)
Request end.
void nwk_getDeviceInfoRsp(UInt8 param, void *pValue)
Get device information response.
UInt8 ccai_s_sys_gpio(UInt8 operation, UInt8 value)
GPIO access request.
void ccai_r_zdo_simple_desc_req()
Not implemented.
void ccai_p_sys_reset_ind()
Request Indication.
UInt8 ccai_s_zb_read_configuration(UInt8 configId)
Read configuration request.
#define CCAI_MSGR_SYS_VERION
Response to a request for CC2480 software version information.
#define CCAI_MSGR_ZB_READ_CONFIGURATION
Response to a request to read a configuration parameter.
void ccai_init()
This function initializes the CC2480 Application Interface variables.
void ccai_r_zdo_user_desc_req()
Not implemented.
#define NWK_DEVTYPE_DEFALUT
The default device type on network initialization.
#define CCAI_MSGP_ZB_BIND_CONFIRM
Sent by CC2480 to return the results from a ZB_BIND_DEVICE.
#define CCAI_MSGR_SYS_OSAL_STOP_TIMER
Response to a request to stop a previously scheduled software timer.
void ccai_p_zb_send_data_confirm()
Send data confirmation.
#define CCAI_MSGP_ZDO_USER_DESC_RSP
Not yet implemented in this version.
void ccai_p_zb_find_device_confirm()
Find device confirmation.
void ccai_r_zb_app_register_request()
Application register response.
Initial configuration, initialization of SPI.
void ccai_p_zdo_ieee_addr_rsp()
Not implemented.
UInt8 ccai_s_zdo_unbind_req()
Not implemented.
UInt8 ccai_s_zdo_mgmt_lqi_req()
Not implemented.
void nwk_bind_deviceConfirm(char *pBuf)
Bind device confirmation.
void ccai_p_zdo_simple_desc_rsp()
Not implemented.
#define CCAI_MSGR_ZB_APP_REGISTER_REQUEST
Response to a request to register the application with the CC2480 device.
void ccai_r_zdo_nwk_addr_req()
Not implemented.
UInt8 ccai_s_zdo_mgmt_permit_join_req()
Not implemented.
UInt16 ccai_proccess()
This function processes the tasks of the CC2480 Application Interface.
#define CCAI_MSGR_ZB_BIND_DEVICE
Response to a request to create or delete a binding to another device on the network.
#define CCAI_MSGP_ZDO_UNBIND_RSP
Not yet implemented in this version.
UInt8 ccai_s_zb_write_configuration(UInt8 configId, UInt8 len, void *pBuf)
Write configuration request.
void ccai_p_zdo_mgmt_leave_rsp()
Not implemented.
#define CCAI_MSGR_ZB_PERMIT_JOINING_REQUEST
Response to a request to change the joining permissions.
void ccai_r_zdo_active_ep_req()
Not implemented.
UInt8 ccai_s_zdo_match_desc_req()
Not implemented.
void ccai_p_zdo_unbind_rsp()
Not implemented.
void spi_init()
SPI initialization.
UInt8 ccai_s_zdo_ieee_addr_req()
Not implemented.
void ccai_p_zdo_bind_rsp()
Not implemented.
#define CCAI_MSGR_ZDO_MGMT_PERMIT_JOIN_REQ
Not yet implemented in this version.
UInt8 ccai_a_sys_test_rf(UInt8 testMode, UInt16 frequency, UInt8 txPower)
RF test configuration.
void ccai_r_zdo_end_device_bind_req()
Not implemented.
#define CCAI_MSGR_SYS_OSAL_NV_WRITE
Response to a request to write an item on CC2480 NV memory.
void ccai_r_zb_permit_joining_request()
Permit join change response.
#define CCAI_MSGR_ZDO_NODE_DESC_REQ
Not yet implemented in this version.
UInt8 ccai_s_af_data_request()
Not implemented.
void ccai_r_zdo_node_desc_req()
Not implemented.
#define CCAI_MSGR_ZDO_BIND_REQ
Not yet implemented in this version.
void ccai_r_zdo_ieee_addr_req()
Not implemented.
UInt8 ccai_s_zb_permit_joining_request(UInt16 destination, UInt8 timeOut)
Permit join change request.
#define CCAI_MSGP_ZDO_NWK_ADDR_RSP
Not yet implemented in this version.
void nwk_startConfirm(UInt8 status)
Start network confirmation.
void ccai_r_sys_osal_nv_write()
Write emory response.
UInt8 ccai_s_zb_send_data_request(UInt16 destination, UInt16 commandId, UInt8 handle, UInt8 ack, UInt8 radius, UInt8 len, void *pBuf)
Send data request.
#define CCAI_MSGR_ZDO_USER_DESC_REQ
Not yet implemented in this version.
void ccai_s_zb_send_data_request_end(UInt8 forwardToSerial)
Terminate the request to send data and send it to CC2480.