完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
'''c++ 1. /* 2. * Copyright (C) 2019-2020 Alibaba Group Holding Limited 3. */ 4. #include 5. #include "app_main.h" 6. //#include "app_lpm.h" 7. //#include 8. #include "app_sys.h" 9. 10. #define TAG "keyusr" 11. 12. extern int wIFi_prov_method; 13. 14. typedef enum { 15. button_id0 = 0, 16. } button_id_t; 17. 18. typedef enum { 19. nothing = 1, 20. network, 21. } button_event_t; 22. 23. void button_evt(int event_id, void *priv) 24. { 25. LOGD(TAG, "button(%s)n", (char *)priv); 26. switch (event_id) { 27. case network: 28. LOGE(TAG, "ble prov"); 29. aos_kv_setint("wprov_method", wifi_prov_method); 30. if (wifi_prov_method == WIFI_PROVISION_SL_BLE) { 31. printf("wifi_prov_method=WIFI_PROVISION_SL_BLEn"); 32. aos_kv_del("AUTH_AC_AS"); 33. aos_kv_del("AUTH_KEY_PAIRS"); 34. } 35. app_sys_set_boot_reason(BOOT_REASON_WIFI_CONFIG);//zz 36. //aos_reboot(); 37. printf("BUTTON_PRESS——LONG_DOWNn"); 38. // //g_pwm_LED_ctx = {1, 60, PWM1_PIN, PWM1_CH, PWM1_PIN_FUNC}; 39. app_pwm_led_control(0); 40. 41. break; 42. case nothing: 43. printf("BUTTON_PRESSn"); 44. // //g_pwm_led_ctx = {1, 60, PWM1_PIN, PWM1_CH, PWM1_PIN_FUNC}; 45. app_pwm_led_control(1); 46. 47. //TODO 48. break; 49. default: 50. break; 51. } 52. } 53. 54. void app_button_init(void) 55. { 56. button_init(); 57. button_add_gpio(button_id0, PB5, LOW_LEVEL);//添加gpio按键 58. 59. button_evt_t b_tbl[] = { 60. { 61. .button_id = button_id0, 62. .event_id = BUTTON_PRESS_UP,//1 63. .press_time = 20, 64. } 65. }; 66. button_add_event(nothing, b_tbl, sizeof(b_tbl)/sizeof(button_evt_t), button_evt, "nothing");//为当前按键表参数 添加事件 67. 68. b_tbl[0].button_id = button_id0; 69. b_tbl[0].event_id = BUTTON_PRESS_LONG_DOWN;//2 70. b_tbl[0].press_time = 2000; 71. button_add_event(network, b_tbl, sizeof(b_tbl)/sizeof(button_evt_t), button_evt, "network");//为当前按键表参数 添加事件 72. } 73. F7编译 size of target: text data bss dec hex filename 698864 5264 191980 896108 dac6c ./Obj/lst.elf checksum value of target:0x3D2346AF(4,323,264) Obj/lst.elf is modified at: 2021/11/30/Öܶþ12:20:15 Executing Post Build commands ... [INFO] Generated output files ... ---------------------------------------------------------------- boot, 0, 0, 0x08002400,0x0000dc00, 0x08010000, boot misc, 0, 0, 0x08010000,0x000c0000, 0x080d0000 prim, 1, 2, 0x080d0400,0x000efc00, 0x081c0000, prim imtb, 0, 0, 0x081c0000,0x00001000, 0x081c1000, imtb kv, 0, 0, 0x081c1000,0x00008000, 0x081c9000 boot, 43088 bytes prim, 704128 bytes imtb, 4096 bytes ---------------------------------------------------------------- Create wm bin files generate normal image completed. generate normal image completed. compress binary completed. generate compressed image completed. generate normal image completed. Done ====0 error(s), 0 warning(s), total time :28s849ms==== com口 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC[ 0.000]INIT Build:Nov 302021,12:02:58 [ 0.310]INIT find 5 partitions [ 0.660] [ 0.680] [ 0.700] [ 0.910get_free_info_id]<, D26>, ch app_net0 ,tart net configget_free_info_id _wifi_pair_thread36, , idx 3212 [ 1.030] [ 1.100] [ 1.110] [2841.930] BUTTON_PRESS [2841.950] [2841.960] [2851.290] [4230.940] wifi_prov_method=WIFI_PROVISION_SL_BLE BUTTON_PRESS鈥斺€擫ONG_DOWN [4231.090] 正常工作: 文章转载自:平头哥芯片开放社区 作者:lust |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
【平头哥Sipeed LicheeRV 86开发板试用体验】Waft初体验
15641 浏览 1 评论
13691 浏览 4 评论
【平头哥Sipeed LicheeRV 86开发板试用体验】四、烧写waft系统&搭建waft测试环境
19603 浏览 2 评论
58986 浏览 19 评论
【限时福利】加入芯片开发社区,领100G电子工程师资料大礼包
87536 浏览 121 评论
邀请函 | 3月2日 来上海参加平头哥“玄铁RISC-V生态大会”
729浏览 0评论
读书分享会 | 玄铁RISC-V处理器入门与实战电子书免费下载!
618浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-9 03:27 , Processed in 1.192577 second(s), Total 71, Slave 54 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号