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

📄 selring.c

📁 在ARM7和UC/OSII的平台上实现了GPS自动报站的功能,涉及GPS模块LEA_4S的驱动,位置速寻算法,语音芯片ISD4004的录放音驱动,LED页面管理等等.从启动代码到操作系统的移植以及到业
💻 C
字号:
/****************************************************************
**                                                              *
**  FILE         :  SelRing.C                                   *
**  COPYRIGHT    :  (c) 2001 .Xiamen Yaxon NetWork CO.LTD       *
**                                                              *
**                                                              *
**  By : CCH 2002.1.15                                          *
****************************************************************/
#include "includes.h"
#include "tools.h"
#include "hstctl.h"
#include "public.h"
#include "prompt.h"
#include "menuwin.h"
#include "itemmenu.h"
#include "selring.h"



#if EN_HANDSET > 0


/*
********************************************************************************
*                  DEFINE op_type
********************************************************************************
*/
#define OP_CALLRING                                 0

/*
********************************************************************************
*                  DEFINE MODULE VARIANT
********************************************************************************
*/
static INT8U optype;
static char *CallRing[]                         = {"一般铃声", "笑傲江湖", "我的中国心", 
                                                   "康定情歌", "外婆的澎湖湾", "北京的金山上"};
static char *SMRing[]                           = {"铃声1", "铃声2", "铃声3",
                                                   "铃声4", "铃声5"};


static void Handler_KEY_ACK(void)
{
    if (optype == OP_CALLRING) {
        HstCfg.CallRing = GetMenuWinRecordNum();
    } else {
        HstCfg.SMRing   = GetMenuWinRecordNum() + 0x06;
    }
    CancelRing();
    PopMenuWin();
    ActivateStringPrompt("设置成功!");
    StorePubPara(HSTCFG_);
}

static void Handler_KEY_NAK(void)
{
    CancelRing();
}

static void Handler_KEY_SEL(void)
{
    INT8U selnum;
    
    if (optype == OP_CALLRING) {
        selnum = GetMenuWinRecordNum();
    } else {
        selnum = GetMenuWinRecordNum() + 0x06;
    }
    RequestRing(selnum);
}

static INT16U MaxRecordProc(void)
{
    if (optype == OP_CALLRING) {
        return 6;
    } else {
        return 5;
    }
}

static INT16U InitRecordProc(void)
{
    INT8U initnum;
    
    if (optype == OP_CALLRING) {
        initnum = HstCfg.CallRing;
        if (initnum >= 6) initnum = 0;
    } else {
        initnum = HstCfg.SMRing - 6;
        if (initnum >= 5) initnum = 0;
    }
    return initnum;
}

static INT16U ReadRecordProc(INT16S numrec, INT8U *ptr)
{
    if (optype == OP_CALLRING) {
        if (numrec >= 6) numrec = 0;
        memcpy(ptr, CallRing[numrec], strlen(CallRing[numrec]));
        return strlen(CallRing[numrec]);
    } else {
        if (numrec >= 5) numrec = 0;
        memcpy(ptr, SMRing[numrec], strlen(SMRing[numrec]));
        return strlen(SMRing[numrec]);
    }
}

static MENUWIN_STRUCT MenuWinEntry = 
{WIN_LMENU, Handler_KEY_ACK, Handler_KEY_NAK, 0, Handler_KEY_SEL, 0, MaxRecordProc, InitRecordProc, ReadRecordProc};

static void SelRing(void)
{
    optype = GetMenuWinRecordNum();
    ActivateMenuWin(&MenuWinEntry);
}


static ITEMMENU_STRUCT  MENU_CALLRING           = {ITEM_FCN,   "来电铃声",  SelRing, 0, 0};
static ITEMMENU_STRUCT  MENU_SMRING             = {ITEM_FCN,   "信息铃声",  SelRing, 0, 0};
static ITEMMENU_STRUCT *MENU_SELRING_CHILD[]    = {&MENU_CALLRING, &MENU_SMRING};
ITEMMENU_STRUCT MENU_SELRING                    = {ITEM_LMENU, "    选择\n   振铃音",  0, 2, MENU_SELRING_CHILD};

#endif

⌨️ 快捷键说明

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