⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mtel.s51

📁 cc2430应用实例
💻 S51
📖 第 1 页 / 共 5 页
字号:
// 1234       case SPI_CMD_SAPI_START_REQ:
// 1235       case SPI_CMD_SAPI_BIND_DEVICE:
// 1236       case SPI_CMD_SAPI_ALLOW_BIND:
// 1237       case SPI_CMD_SAPI_SEND_DATA:
// 1238       case SPI_CMD_SAPI_READ_CFG:
// 1239       case SPI_CMD_SAPI_WRITE_CFG:
// 1240       case SPI_CMD_SAPI_GET_DEV_INFO:
// 1241       case SPI_CMD_SAPI_FIND_DEV:
// 1242       case SPI_CMD_SAPI_PMT_JOIN:
// 1243         ret = MT_sapiCommandProcessing( cmd , len , pData );
// 1244         if ( ret == 0xff )
// 1245           len = 0;
// 1246         else
// 1247           len = 1;
// 1248         break;
// 1249 #endif
// 1250 
// 1251 #if defined ( MT_USER_TEST_FUNC )
// 1252       case SPI_CMD_USER_TEST:
// 1253         MT_ProcessAppUserCmd( pData );
// 1254         break;
// 1255 #endif
// 1256 
// 1257       default:
// 1258         break;
// 1259     }
// 1260 
// 1261     if ( len )
// 1262     {
// 1263       MT_BuildAndSendZToolResponse( (SPI_0DATA_MSG_LEN + len),
// 1264                                     (SPI_RESPONSE_BIT | cmd),
// 1265                                     len, retValue );
// 1266     }
// 1267   }
// 1268 #endif // ZTOOL
// 1269 
// 1270 #if (defined HAL_LED) && (HAL_LED == TRUE)
// 1271 /***************************************************************************************************
// 1272  * @fn      MTProcessLedControl
// 1273  *
// 1274  * @brief
// 1275  *
// 1276  *   Process the LED Control Message
// 1277  *
// 1278  * @param   data - input serial buffer
// 1279  *
// 1280  * @return  status
// 1281  ***************************************************************************************************/
// 1282 byte MTProcessLedControl( byte *pData )
// 1283 {
// 1284   byte iLed;
// 1285   byte Led;
// 1286   byte iMode;
// 1287   byte Mode;
// 1288 
// 1289   iLed = *pData++;
// 1290   iMode = *pData;
// 1291 
// 1292   if ( iLed == 1 )
// 1293     Led = HAL_LED_1;
// 1294   else if ( iLed == 2 )
// 1295     Led = HAL_LED_2;
// 1296   else if ( iLed == 3 )
// 1297     Led = HAL_LED_3;
// 1298   else if ( iLed == 4 )
// 1299     Led = HAL_LED_4;
// 1300   else if ( iLed == 0xFF )
// 1301     Led = HAL_LED_ALL;
// 1302   else
// 1303     Led = 0;
// 1304 
// 1305   if ( iMode == 0 )
// 1306     Mode = HAL_LED_MODE_OFF;
// 1307   else if ( iMode == 1 )
// 1308     Mode = HAL_LED_MODE_ON;
// 1309   else if ( iMode == 2 )
// 1310     Mode = HAL_LED_MODE_BLINK;
// 1311   else if ( iMode == 3 )
// 1312     Mode = HAL_LED_MODE_FLASH;
// 1313   else if ( iMode == 4 )
// 1314     Mode = HAL_LED_MODE_TOGGLE;
// 1315   else
// 1316     Led = 0;
// 1317 
// 1318   if ( Led != 0 )
// 1319   {
// 1320     HalLedSet (Led, Mode );
// 1321     return ( ZSuccess );
// 1322   }
// 1323   else
// 1324     return ( ZFailure );
// 1325 }
// 1326 #endif // HAL_LED
// 1327 
// 1328 #if !defined ( NONWK )
// 1329 /*********************************************************************
// 1330  * @fn      MTProcessAppMsg
// 1331  *
// 1332  * @brief
// 1333  *
// 1334  *   Process the User App Message
// 1335  *
// 1336  * @param   data - input serial buffer
// 1337  * @param   len - data length
// 1338  *
// 1339  * @return  status
// 1340  */
// 1341 byte MTProcessAppMsg( byte *pData, byte len )
// 1342 {
// 1343   byte ret = ZFailure;
// 1344   byte endpoint;
// 1345   endPointDesc_t *epDesc;
// 1346   mtSysAppMsg_t *msg;
// 1347 
// 1348   // Get the endpoint and skip past it.
// 1349   endpoint = *pData++;
// 1350   len--;
// 1351 
// 1352   // Look up the endpoint
// 1353   epDesc = afFindEndPointDesc( endpoint );
// 1354 
// 1355   if ( epDesc )
// 1356   {
// 1357     // Build and send the message to the APP
// 1358     msg = (mtSysAppMsg_t *)osal_msg_allocate( sizeof( mtSysAppMsg_t ) + len );
// 1359     if ( msg )
// 1360     {
// 1361       msg->hdr.event = MT_SYS_APP_MSG;
// 1362       msg->endpoint = endpoint;
// 1363       msg->appDataLen = len;
// 1364       msg->appData = (uint8*)(msg+1);
// 1365 
// 1366       osal_memcpy( msg->appData, pData, len );
// 1367 
// 1368       osal_msg_send( *(epDesc->task_id), (uint8 *)msg );
// 1369 
// 1370       ret = ZSuccess;
// 1371     }
// 1372   }
// 1373 
// 1374   return ret;
// 1375 }
// 1376 #endif // NONWK
// 1377 
// 1378 #if defined ( ZTOOL_PORT )
// 1379 /*********************************************************************
// 1380  * @fn      MTProcessAppRspMsg
// 1381  *
// 1382  * @brief
// 1383  *
// 1384  *   Process the User App Response Message
// 1385  *
// 1386  * @param   data - output serial buffer.  The first byte must be the
// 1387  *          endpoint that send this message.
// 1388  * @param   len - data length
// 1389  *
// 1390  * @return  none
// 1391  */
// 1392 void MTProcessAppRspMsg( byte *pData, byte len )
// 1393 {
// 1394   // Send out Reset Response message
// 1395   MT_BuildAndSendZToolResponse( (SPI_0DATA_MSG_LEN + len),
// 1396                                 (SPI_RESPONSE_BIT | SPI_CMD_SYS_APP_MSG),
// 1397                                 len, pData );
// 1398 }
// 1399 #endif // ZTOOL_PORT
// 1400 
// 1401 
// 1402 #if defined (ZTOOL_P1) || defined (ZTOOL_P2)
// 1403 #if defined ( MT_USER_TEST_FUNC )
// 1404 /*********************************************************************
// 1405  * @fn      MT_ProcessAppUserCmd
// 1406  *
// 1407  * @brief
// 1408  *
// 1409  *   Temp function for testing
// 1410  *
// 1411  * @param   data - received message
// 1412  *
// 1413  * @return  void
// 1414  */
// 1415 void MT_ProcessAppUserCmd( byte *pData) 						
// 1416 {
// 1417   uint16 app_cmd;
// 1418   byte srcEp;
// 1419   uint16 param1;
// 1420   uint16 param2;
// 1421   byte len;
// 1422   uint16 ret;
// 1423 
// 1424   ret = INVALID_TASK;     //should be changed later
// 1425 
// 1426   srcEp = *pData++;
// 1427 
// 1428   app_cmd = BUILD_UINT16( pData[1] , pData[0] );
// 1429   pData = pData + sizeof( uint16 );
// 1430 
// 1431   param1 = BUILD_UINT16( pData[1] , pData[0] );
// 1432   pData = pData + sizeof( uint16 );
// 1433 
// 1434   param2 = BUILD_UINT16( pData[1] , pData[0] );
// 1435 
// 1436   len = SPI_RESP_MSG_LEN_DEFAULT;
// 1437 
// 1438 
// 1439   switch ( app_cmd )
// 1440   {
// 1441 
// 1442 #if defined (APP_TGEN)
// 1443     case TGEN_START:
// 1444       TrafficGenApp_SendCmdMSG( param1, param2, TRAFFICGENAPP_CMD_START );
// 1445       ret = ZSUCCESS;
// 1446       break;
// 1447 
// 1448     case TGEN_STOP:
// 1449       TrafficGenApp_SendCmdMSG( param1, param2, TRAFFICGENAPP_CMD_STOP );
// 1450       ret = ZSUCCESS;
// 1451       break;
// 1452 
// 1453     case TGEN_COUNT:
// 1454       ret = TrafficGenApp_CountPkt( param1, param2 );
// 1455       return;		// so that spi_resp is not sent...
// 1456       //ret = ZSUCCESS;
// 1457       break;				
// 1458 #endif
// 1459 
// 1460 #if defined (NWK_TEST)
// 1461     case HW_TEST:
// 1462       HwApp_Start( HI_UINT16(param1), LO_UINT16(param1), HI_UINT16(param2),
// 1463                     1000, LO_UINT16(param2), 3, 0 );
// 1464       break;
// 1465 
// 1466     case HW_DISPLAY_RESULT:
// 1467       HwApp_TestInfo();
// 1468       break;
// 1469 
// 1470     case HW_SEND_STATUS:
// 1471       HwApp_SendStats();
// 1472       break;
// 1473 #endif
// 1474 
// 1475 #if defined( APP_TP ) || defined ( APP_TP2 )
// 1476   #if defined( APP_TP )
// 1477     case TP_SEND_NODATA:
// 1478       ret = TestProfileApp_SendNoData( srcEp, (byte)param1 );
// 1479       break;
// 1480   #endif // APP_TP
// 1481 			
// 1482     case TP_SEND_BUFFERTEST:
// 1483       ret = TestProfileApp_SendBufferReq( srcEp, (byte)param1 );
// 1484       break;
// 1485 			
// 1486   #if defined( APP_TP )
// 1487     case TP_SEND_UINT8:
// 1488       ret = TestProfileApp_SendUint8( srcEp, (byte)param1 );
// 1489       break;
// 1490 
// 1491     case TP_SEND_INT8:
// 1492       ret = TestProfileApp_SendInt8( srcEp, (byte)param1 );
// 1493       break;
// 1494 
// 1495     case TP_SEND_UINT16:
// 1496       ret = TestProfileApp_SendUint16( srcEp, (byte)param1 );
// 1497       break;
// 1498 
// 1499     case TP_SEND_INT16:
// 1500       ret = TestProfileApp_SendInt16( srcEp, (byte)param1 );
// 1501       break;
// 1502 
// 1503     case TP_SEND_SEMIPREC:
// 1504       ret = TestProfileApp_SendSemiPrec( srcEp, (byte)param1 );
// 1505       break;
// 1506 
// 1507     case TP_SEND_FREEFORM:
// 1508       ret = TestProfileApp_SendFreeFormReq( srcEp, (byte)param1 );
// 1509       break;
// 1510 			
// 1511   #else // APP_TP
// 1512     case TP_SEND_FREEFORM:
// 1513       ret = TestProfileApp_SendFreeFormReq(srcEp, (byte)param1, (byte)param2);
// 1514       break;
// 1515   #endif
// 1516 			
// 1517   #if defined( APP_TP )
// 1518     case TP_SEND_ABS_TIME:
// 1519       ret = TestProfileApp_SendAbsTime( srcEp, (byte)param1 );
// 1520       break;
// 1521 
// 1522     case TP_SEND_REL_TIME:
// 1523       ret = TestProfileApp_SendRelativeTime( srcEp, (byte)param1 );
// 1524       break;
// 1525 
// 1526     case TP_SEND_CHAR_STRING:
// 1527       ret = TestProfileApp_SendCharString( srcEp, (byte)param1 );
// 1528       break;
// 1529 
// 1530     case TP_SEND_OCTET_STRING:
// 1531       ret = TestProfileApp_SendOctetString( srcEp, (byte)param1 );
// 1532       break;		
// 1533   #endif // APP_TP
// 1534 				
// 1535     case TP_SET_DSTADDRESS:			
// 1536       ret = TestProfileApp_SetDestAddress(HI_UINT16(param1), LO_UINT16(param1), param2);
// 1537       break;	
// 1538 
// 1539   #if defined( APP_TP2 )
// 1540     case TP_SEND_BUFFER_GROUP:
// 1541       ret = TestProfileApp_SendBufferGroup( srcEp, (byte)param1 );
// 1542       break;
// 1543   #endif // APP_TP
// 1544 
// 1545     case TP_SEND_BUFFER:
// 1546       ret = TestProfileApp_SendBuffer( srcEp, (byte)param1 );
// 1547       break;
// 1548 				
// 1549   #if defined( APP_TP )
// 1550     case TP_SEND_MULT_KVP_8BIT:
// 1551       TestProfileApp_SendMultiKVP_8bit( srcEp, (byte)param1 );
// 1552       ret = ZSuccess;
// 1553       break;
// 1554 
// 1555     case TP_SEND_MULT_KVP_16BIT:
// 1556       TestProfileApp_SendMultiKVP_16bit( srcEp, (byte)param1 );
// 1557       ret = ZSuccess;
// 1558       break;
// 1559 
// 1560     case TP_SEND_MULT_KVP_TIME:
// 1561       TestProfileApp_SendMultiKVP_Time( srcEp, (byte)param1 );
// 1562       ret = ZSuccess;
// 1563       break;
// 1564 
// 1565     case TP_SEND_MULT_KVP_STRING:
// 1566       TestProfileApp_SendMultiKVP_String( srcEp, (byte)param1 );
// 1567       ret = ZSuccess;
// 1568       break;
// 1569 
// 1570     case TP_SEND_MULTI_KVP_STR_TIME:
// 1571       ret = ZSuccess;
// 1572       TestProfileApp_SendMultiKVP_String_Time( srcEp, (byte)param1 );
// 1573       break;
// 1574   #endif // APP_TP
// 1575 				
// 1576     case TP_SEND_COUNTED_PKTS:
// 1577       TestProfileApp_SendCountedPktsReq(HI_UINT16(param1), LO_UINT16(param1), param2);
// 1578       ret = ZSucce

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -