杰理-文字组合显示

杰理-文字组合显示

在这里插入图片描述
在这里插入图片描述

// -----------------------------------------睡眠-文字组合显示(星期)-------------------------------------------

static u16 T_Main_ItemString[1][7];


static const u16 Week_text[] = {
    M1080,
    M1074,
    M1075,
    M1076,
    M1077,
    M1078,
    M1079,
    
    M1072,
    M1073,
    M1097,
};

#define UI_RGB565(c)  \
        _RGB565((c>>16)&0xff,(c>>8)&0xff,c&0xff)

void week_text_combine_show(u16 *buf, u8 *show_buf)  
{
    u8 count = 0;

    for(u8 i=0;i<7;i++)
    {
        if(show_buf[i] == 1)
        {
            buf[count++] = Week_text[i];
        }
    }

    if(count == 0)
    {
        count = 1;
        memset(buf,0,sizeof(buf));
        buf[0] = Week_text[9];
        buf[1] = 0;
    }
    else if(count == 5)
    {
        if(show_buf[6] == 0 && show_buf[0] == 0)
        {
            count = 1;
            memset(buf,0,sizeof(buf));
            buf[0] = Week_text[7];
            buf[1] = 0;
        }

    }
    else if(count == 7)
    {
        count = 1;
        memset(buf,0,sizeof(buf));
        buf[0] = Week_text[8];
        buf[1] = 0;
    }

    for(u8 i=0;i<=count;i++)
    {
        G_log("-buf[%d] = %d ---",i,buf[i]);
    }

}



static int SLEEP_WEEK_CHOOSE_onchange(void *ctr, enum element_change_event e, void *arg)
{
    struct ui_grid *grid = (struct ui_grid *)ctr;
    struct ui_text *text = (struct ui_text *)ctr;
    switch (e) {
    case ON_CHANGE_INIT:

        memset(T_Main_ItemString,0,sizeof(T_Main_ItemString));
        week_text_combine_show(T_Main_ItemString[0],sleep_curr_week);
        text->attrs.str = (char *)(T_Main_ItemString[0]);
        text->attrs.format = "mulstr";
        break;
    }
    return false;
}

REGISTER_UI_EVENT_HANDLER(SLEEP_WEEK_CHOOSE) 
.onchange = SLEEP_WEEK_CHOOSE_onchange, 
.onkey = NULL, 
.ontouch = NULL, 
}; 
REGISTER_UI_EVENT_HANDLER(SLEEP_EDIT_TIMER_TEXT) 
.onchange = SLEEP_WEEK_CHOOSE_onchange, 
.onkey = NULL, 
.ontouch = NULL, 
}; 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值