• 大小: 506KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-11
  • 语言: 其他
  • 标签: CC2530  TI  

资源简介

本资源位TI提供的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 pTxData[APP_PAYLOAD_LENGTH];
static uint8 pRxData[APP_PAYLOAD_LENGTH];
static basicRfCfg_t basicRfConfig;

// Mode menu
static menuItem_t pMenuItems[] =
{
#ifdef ASSY_EXP4618_CC2420
  // Using Softbaugh 7-seg display
  “ L S    “ SWITCH
  “ LIGHT  “ LIGHT
#else
  // SRF04EB and SRF05EB
  “Switch“   SWITCH
  “Light“    LIGHT
#endif
};

static menu_t pMenu =
{
  pMenuItems
  N_ITEMS(pMenuItems)
};


#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();
static void appSwitch();
static uint8 appSelectMode(void);


/***********************************************************************************
* @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()
{
    halLcdWriteLi

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        3385  2009-10-27 12:13  source\apps\per_test\per_test.h
     文件       14194  2009-10-27 12:13  source\apps\per_test\per_test.c
     文件        3527  2009-10-27 12:13  source\apps\per_test\per_test_menu.h
     文件        6852  2009-10-27 12:13  source\apps\per_test\per_test_menu.c
     文件       13899  2009-10-27 12:13  source\components\utils\util_lcd.c
     文件        3414  2009-10-27 12:13  source\components\utils\util_lcd.h
     文件        6001  2009-10-27 12:13  source\components\utils\util_buffer.c
     文件        3589  2009-10-27 12:13  source\components\utils\util_buffer.h
     文件        5745  2009-10-27 12:13  source\components\utils\util.c
     文件        3386  2009-10-27 12:13  source\components\utils\util.h
     文件       20499  2009-10-27 12:13  source\components\basicrf\basic_rf.c
     文件        5088  2009-10-27 12:13  source\components\basicrf\basic_rf.h
     文件        3957  2009-10-27 12:13  source\components\common\hal_int.c
     文件        6128  2009-10-27 12:13  source\components\common\hal_defs.h
     文件        5345  2009-10-27 12:13  source\components\common\hal_types.h
     文件        6227  2009-10-27 12:13  source\components\common\cc8051\hal_cc8051.h
     文件        4897  2009-10-27 12:13  source\components\targets\interface\hal_rf.h
     文件        2776  2009-10-27 12:13  source\components\targets\interface\hal_assert.h
     文件        3489  2009-10-27 12:13  source\components\targets\interface\hal_mcu.h
     文件        3872  2009-10-27 12:13  source\components\targets\interface\hal_digio.h
     文件        3827  2009-10-27 12:13  source\components\targets\interface\hal_lcd.h
     文件        3942  2009-10-27 12:13  source\components\targets\interface\hal_uart.h
     文件        3000  2009-10-27 12:13  source\components\targets\interface\hal_button.h
     文件        2865  2009-10-27 12:13  source\components\targets\interface\hal_led.h
     文件        3365  2009-10-27 12:13  source\components\targets\interface\hal_joystick.h
     文件        4434  2009-10-27 12:13  source\components\targets\interface\hal_int.h
     文件        3198  2009-10-27 12:13  source\components\targets\interface\hal_timer_32k.h
     文件        7239  2009-10-27 12:13  source\components\targets\srf05_soc\hal_board.h
     文件        6943  2009-10-27 12:13  source\components\targets\srf05_soc\hal_board.c
     文件        2151  2009-10-27 12:13  source\components\targets\srf05_soc\hal_button.c
     文件       15744  2009-10-27 12:13  source\components\targets\srf05_soc\hal_digio.c
............此处省略40个文件信息

评论

共有 条评论