首页 > 其他分享 >没有对应芯片手册,不知道哪些IO口可以控,测试demo

没有对应芯片手册,不知道哪些IO口可以控,测试demo

时间:2024-04-25 11:14:20浏览次数:12  
标签:demo app flash 手册 IO cnt0 var gpio

 

//sdk\apps\earphone\include\app_config.h
//////////↓↓↓↓↓↓↓↓↓↓code snippet from xwh↓↓↓↓↓↓↓↓↓↓////////////////////
#define LED0_IO IO_PORTA_01
#define LED0_ONOFF(x) do{gpio_set_pull_down(   LED0_IO, 0);\
                         gpio_set_pull_up(     LED0_IO, 0);\
                         gpio_direction_output(LED0_IO, x);}while(0)
#define LED1_IO IO_PORTA_02
#define LED1_ONOFF(x) do{gpio_set_pull_down(   LED1_IO, 0);\
                         gpio_set_pull_up(     LED1_IO, 0);\
                         gpio_direction_output(LED1_IO, x);}while(0)
#define LED2_IO IO_PORTA_03
#define LED2_ONOFF(x) do{gpio_set_pull_down(   LED2_IO, 0);\
                         gpio_set_pull_up(     LED2_IO, 0);\
                         gpio_direction_output(LED2_IO, x);}while(0)
//////////↑↑↑↑↑↑↑↑↑↑code snippet from xwh↑↑↑↑↑↑↑↑↑↑////////////////////

//sdk\apps\earphone\include\app_main.h
typedef struct _APP_VAR {
//...
    //////////↓↓↓↓↓↓↓↓↓↓code snippet from xwh↓↓↓↓↓↓↓↓↓↓////////////////////
    u8 mutex_var0;
    u8 led0_flash;
    u8 led1_flash;
    u8 led2_flash;
    //////////↑↑↑↑↑↑↑↑↑↑code snippet from xwh↑↑↑↑↑↑↑↑↑↑////////////////////
} APP_VAR;

//sdk\apps\earphone\board\br36\board_ac700n_demo.c
//////////↓↓↓↓↓↓↓↓↓↓code snippet from xwh↓↓↓↓↓↓↓↓↓↓////////////////////
#include "app_main.h"
void delay_execute_func(void*priv)
{
    static unsigned char cnt0;cnt0++;cnt0%=2;
    if(app_var.led0_flash)
    {
        printfbl("cnt0:%d\n",cnt0);
        LED0_ONOFF(cnt0);
    }
    if(app_var.led1_flash)
    {
        printfbl("cnt0:%d\n",cnt0);
        LED1_ONOFF(cnt0);
    }
    if(app_var.led2_flash)
    {
        printfbl("cnt0:%d\n",cnt0);
        LED2_ONOFF(cnt0);
    }
    printfr("led0_flash:%d,led1_flash:%d,led2_flash:%d\n",app_var.led0_flash,app_var.led1_flash,app_var.led2_flash);
}
//////////↑↑↑↑↑↑↑↑↑↑code snippet from xwh↑↑↑↑↑↑↑↑↑↑////////////////////
void board_init()
{
//...
//////////↓↓↓↓↓↓↓↓↓↓code snippet from xwh↓↓↓↓↓↓↓↓↓↓////////////////////
    u16 timer_id=0;
    if(!timer_id)
    {
        timer_id=sys_timer_add(NULL,delay_execute_func,1500);
        printf("bg color 底色\n");
        for(u8 i=40;i<48;i++)
        {
            //font
            printf("\e[%dm                                                                   %d\e[0m不加粗\n",i,i);
            printf("\e[1;%dm                                                                   %d\e[0m  加粗\n",i,i);
        }
    }
//////////↑↑↑↑↑↑↑↑↑↑code snippet from xwh↑↑↑↑↑↑↑↑↑↑////////////////////
}

//sdk\apps\earphone\key_event_deal.c
//////////↓↓↓↓↓↓↓↓↓↓code snippet from xwh↓↓↓↓↓↓↓↓↓↓////////////////////
#include "asm/pwm_led.h"
u8 key_value_bak;
void delay_change_led_mode(void *priv)
{
    static unsigned char pwmled_mode=PWM_LED_MODE_START;
    if(pwmled_mode>=PWM_LED_MODE_END){
        pwmled_mode=PWM_LED_MODE_START;
    }
    else
    {
        if((*((u8*)priv))>=11&&(*((u8*)priv))<=20)
        {
            pwmled_mode=*((u8*)priv);
        }
        else
        {
            switch (*((u8*)priv))
            {
            case 9:
                pwmled_mode--;
                break;
            case 10:
                pwmled_mode++;
                break;
            default:
                break;
            }
        }
        printfc("pwmled_mode:%d\n",pwmled_mode);
        pwm_led_mode_set(pwmled_mode);
        app_var.mutex_var0=1;
    }
}
//////////↑↑↑↑↑↑↑↑↑↑code snippet from xwh↑↑↑↑↑↑↑↑↑↑////////////////////
int app_earphone_key_event_handler(struct sys_event *event)
{
//////////↓↓↓↓↓↓↓↓↓↓code snippet from xwh↓↓↓↓↓↓↓↓↓↓////////////////////
    key_value_bak=key->value;
    sys_timeout_add(&key_value_bak,delay_change_led_mode,100);
    // return;
    switch (key_value_bak)
    {
    case 6:
        app_var.led0_flash=!app_var.led0_flash;
        printfy("KEY 6\n");
        break;
    case 7:
        printfy("KEY 7\n");
        app_var.led1_flash=!app_var.led1_flash;
        break;
    case 8:
        printfy("KEY 8\n");
        app_var.led2_flash=!app_var.led2_flash;
        break;
    default:
        break;
    }
//////////↑↑↑↑↑↑↑↑↑↑code snippet from xwh↑↑↑↑↑↑↑↑↑↑////////////////////
//...
}

 

标签:demo,app,flash,手册,IO,cnt0,var,gpio
From: https://www.cnblogs.com/xuweihui/p/18157145

相关文章

  • Istio典型应用场景
    Istio作为服务治理的工具,使用户不需要在项目中编写代码即可实现微服务治理。主要应用分布式调用追踪、遥测度量收集、灰度发布应用、熔断、故障注入等几个方面场景。Istio提供灵活的适配器模型来执行授权策略,并为网络中的服务提供多项功能。Istio提供统一抽象,可以与一组开放式基......
  • Educational Codeforces Round 164 (Rated for Div. 2)
    A.PaintingtheRibbon题意:n个物体,m个颜色,alice要给每个物体任意涂一个颜色。bob可以给k个物体涂色,问alice能否阻止bob让所有的物体颜色都相同。思路:思维题。如果m=1,那么无解。如果m>1,那么bob如果想要染成同一个颜色,alice可以让bob需要染色的数量最多。如果染色的数量最多,那......
  • 关闭Visual Studio warning C4996 与 Security Enhancements in the CRT警告
    关闭VisualStudiowarningC4996与SecurityEnhancementsintheCRT警告将过去的工程用VisualStudio打开C/C++项目的时候。你有可能会遇到一大堆的警告:warningC4996错误,导致项目无法编译启动,原因是VisualC++2005使用了更加安全的run-timelibraryroutines。新的Securit......
  • dotnet 修复 GitHub Action 构建过程提示 NETSDK1127 错误
    本文告诉大家,如何修复GitHubAction构建过程提示errorNETSDK1127:ThetargetingpackMicrosoft.WindowsDesktop.App.WindowsFormsisnotinstalled.Pleaserestoreandtryagain.错误在进行GitHubAction构建时,如果自己的项目是一个旧项目,采用旧的.NETSDK版本,将可......
  • dotnet 已知问题 错误标记 MethodImplOptions.InternalCall 特性参数将会在类型访问之
    本文将记录一个dotnet的已知问题。当自己不小心在方法上不正确标记了MethodImplAttribute特性时,错误选择了MethodImplOptions.InternalCall参数,那将会在运行的过程在,在此类型被访问之前就抛出了System.TypeLoadException异常,错误信息是Internalcallmethodwithnon_NUL......
  • WPF 触摸下如何给 StylusPointCollection 添加点
    本文告诉大家如何在触摸下给WPF的StylusPointCollection添加新的点在自己默认创建的StylusPointCollection里面添加点是十分简单的,如以下代码,可以非常简单添加到集合StylusPointCollectionstylusPointCollection=newStylusPointCollection();stylus......
  • WPF 使用 ManipulationDemo 工具辅助调试设备触摸失效问题
    本文将和大家介绍我所在的团队开源的ManipulationDemo工具。通过ManipulationDemo工具可以提升调试设备触摸失效的效率此工具在GitHub上完全开源,请看https://github.com/dotnet-campus/ManipulationDemo/软件界面效果大概如下可以显示接收到的Win32消息、当前的触摸......
  • dotnet 8 破坏性改动 在 AssemblyInformationalVersionAttribute 添加上 git 的 commi
    我在一个WPF项目里面,在界面显示应用的版本号,更新到dotnet8的SDK之后,发现我的界面布局损坏了。本质上这个破坏性改动和WPF没有什么关系,是dotnet的SDK或编译器的破坏性变更,在AssemblyInformationalVersionAttribute的InformationalVersion属性里面写入了当前的git......
  • UOS 开启 VisualStudio 远程调试 .NET 应用之旅
    本文记录的是在Windows系统里面,使用VisualStudio2022远程调试运行在UOS里面dotnet应用的配置方法本文写于2024.03.19如果你阅读本文的时间距离本文编写的时间过于长,那本文可能包含过期的知识我将以我的UOS虚拟机作为例子告诉大家如何在Windows系统里面,使用Visua......
  • WPF 已知问题 开启 IsManipulationEnabled 之后触摸长按 RepeatButton 不会触发连续的
    本文记录WPF的一个已知问题,在RepeatButton上开启IsManipulationEnabled漫游支持之后,将会导致触摸长按到RepeatButton之上时,不会收到源源不断的Click事件这是有个伙伴在WPF官方仓库报告的问题,详细请看https://github.com/dotnet/wpf/issues/8223原始的问题是他发现......