资源简介
cc2530无线点灯实验
代码片段和文件信息
/***********************************************************************************
Filename: light_switch.c
Description: This application function either as a light or a
switch toggling the ligh. The role of the
application is chosen in the menu with the joystick at initialisation.
Push S1 to enter the menu. Choose either switch or
light and confirm choice with S1.
Joystick Up: Sends data from switch to light
***********************************************************************************/
/***********************************************************************************
* INCLUDES
*/
#include
#include
#include
#include
#include
#include
#include “hal_mcu.h“
#include “hal_button.h“
#include “hal_rf.h“
#include “util_lcd.h“
#include “basic_rf.h“
/***********************************************************************************
* CONSTANTS
*/
// Application parameters
#define RF_CHANNEL 25 // 2.4 GHz RF channel
// BasicRF address definitions
#define PAN_ID 0x2007
#define SWITCH_ADDR 0x2520
#define LIGHT_ADDR 0xBEEF
#define APP_PAYLOAD_LENGTH 1
#define LIGHT_TOGGLE_CMD 0
// Application states
#define IDLE 0
#define SEND_CMD 1
// Application role
#define NONE 0
#define SWITCH 1
#define LIGHT 2
#define APP_MODES 2
/***********************************************************************************
* LOCAL VARIABLES
*/
static uint8 pRxData[APP_PAYLOAD_LENGTH];
static basicRfCfg_t basicRfConfig;
#ifdef SECURITY_CCM
// Security key
static uint8 key[]= {
0xc0 0xc1 0xc2 0xc3 0xc4 0xc5 0xc6 0xc7
0xc8 0xc9 0xca 0xcb 0xcc 0xcd 0xce 0xcf
};
#endif
/***********************************************************************************
* LOCAL FUNCTIONS
*/
static void appLight();
/***********************************************************************************
* @fn appLight
*
* @brief Application code for light application. Puts MCU in endless
* loop waiting for user input from joystick.
*
* @param basicRfConfig - file scope variable. Basic RF configuration data
* pRxData - file scope variable. Pointer to buffer for RX data
*
* @return none
*/
static void appLight()
{
halLcdWriteLine(HAL_LCD_LINE_1 “Light“);
halLcdWriteLine(HAL_LCD_LINE_2 “Ready“);
#ifdef ASSY_EXP4618_CC2420
halLcdClearLine(1);
halLcdWriteSymbol(HAL_LCD_SYMBOL_RX 1);
#endif
// Initialize BasicRF
basicRfConfig.myAddr = LIGHT_ADDR;
if(basicRfInit(&basicRfConfig)==FAILED) {
HAL_ASSERT(FALSE);
}
basicRfReceiveOn();
// 循环接收数据并显示
while (TRUE)
{
while(!b
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 715806 2011-06-27 12:27 无线点灯\无线RX\BasicRF实验例程1--无线控制电灯实验.pdf
文件 581497 2011-06-27 12:30 无线点灯\无线RX\BasicRF实验例程2--误包率测试实验.pdf
文件 456246 2009-10-27 13:13 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\docs\CC2530_Software_Examples.pdf
文件 1263 2009-10-28 09:29 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\cc2530_sw_examples.eww
文件 3922 2012-10-27 10:05 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\settings\cc2530_sw_examples.wsdt
文件 13542 2009-10-27 13:13 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\Backup of light_switch.ewd
文件 32542 2009-10-27 13:13 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\Backup of light_switch.ewp
文件 13542 2009-10-27 13:13 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\Backup of per_test.ewd
文件 32675 2009-10-27 13:13 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\Backup of per_test.ewp
文件 138595 2017-06-08 09:42 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\light_switch.d51
文件 16475 2017-06-08 09:44 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\light_switch.dep
文件 17205 2017-06-08 08:58 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\light_switch.ewd
文件 34054 2017-06-08 08:58 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\light_switch.ewp
文件 166 2009-10-27 13:13 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\light_switch.eww
文件 11981 2017-06-08 09:42 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\light_switch.hex
文件 220528 2017-06-08 09:17 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\per_test.d51
文件 16444 2017-06-08 09:22 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\per_test.dep
文件 17205 2017-06-08 09:16 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\per_test.ewd
文件 34187 2017-06-08 09:17 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\per_test.ewp
文件 162 2009-10-27 13:13 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\per_test.eww
文件 25516 2017-06-08 09:17 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\per_test.hex
文件 1131 2017-06-08 09:44 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\settings\light_switch.cspy.bat
文件 3853 2017-06-08 09:44 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\settings\light_switch.dbgdt
文件 1316 2017-06-08 09:44 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\settings\light_switch.dni
文件 3428 2017-06-08 09:44 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\settings\light_switch.wsdt
文件 1131 2017-06-08 09:17 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\settings\per_test.cspy.bat
文件 3423 2017-06-08 09:22 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\settings\per_test.dbgdt
文件 573 2017-06-08 09:22 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\settings\per_test.dni
文件 2862 2017-06-08 09:22 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\settings\per_test.wsdt
文件 2496 2010-11-20 10:19 无线点灯\无线RX\CC2530 BasicRF\CC2530 BasicRF\ide\srf05_cc2530\iar\settings\spectrum_analyzer.cspy.bat
............此处省略493个文件信息
评论
共有 条评论