【板子开箱】Ai-M61-32S(点灯)

[复制链接]
查看748 | 回复4 | 2023-11-21 09:00:15 | 显示全部楼层 |阅读模式
博主环境:win10 vscode
设备:usb数据线+Ai-M61-32S

首先vscode打开文件夹AiPi-Open-Kits,就会下图,该文件夹其实就已经提供了一个模板工程Project_basic,用终端打开。

8189e893cb5f7621d08e5d2be857ac7010cbe14d0da3662f923bc8771dfc532e.png

如何对应的api函数:
D:\my_project\AiPi-Open-Kits\aithinker_Ai-M6X_SDK\drivers\soc\bl616\std\include路径下有gpio操作有关的函数库:
#include <bl616_glb.h>

#include <bl616_gpio.h>(有关gpio的typedef)
#include <bl616_glb_gpio.h>(有关gpio的操作函数,如读写)
代码:
  1. /**
  2. * @file main.c
  3. * @author your name (you@domain.com)
  4. * @brief
  5. * @version 0.1
  6. * @date 2023-08-22
  7. *
  8. * @copyright Copyright (c) 2023
  9. *
  10. */

  11. #include "board.h"
  12. #include <FreeRTOS.h>
  13. #include <task.h>
  14. #include <stdbool.h>
  15. #include <stdio.h>
  16. #include <bl616_glb.h>
  17. #include <bl616_gpio.h>
  18. #include <bl616_glb_gpio.h>
  19. // #include "log.h"


  20. #define DBG_TAG "MAIN"
  21. #define PIN_LED (12)

  22. void led(void)
  23. {
  24.     GLB_GPIO_Cfg_Type cfg;
  25.     cfg.drive = 0;
  26.     cfg.smtCtrl = 1;
  27.     cfg.gpioFun = GPIO_FUN_GPIO;
  28.     cfg.outputMode = 0;
  29.     cfg.pullType = GPIO_PULL_NONE;

  30.     cfg.gpioPin = PIN_LED;
  31.     cfg.gpioMode = GPIO_MODE_OUTPUT;
  32.     GLB_GPIO_Init(&cfg);
  33. }
  34. int main(void)
  35. {
  36.     board_init();
  37.     led();
  38.     // LOG_I("Hello world");
  39.     while(1)
  40.     {
  41.         GLB_GPIO_Write(PIN_LED, 1);
  42.     }
  43. }
复制代码


编译烧写代码:
  1.   make clean
  2.     make
  3.     make flash CHIP=bl616 COMX=COM4
复制代码

实物:
f6037fe57141362f265fcbc265fb6e4b68bd29ffb9936498d8e2cadd241418ad.png
工程附件:
链接:https://pan.baidu.com/s/1LL0VUuLO6uwelucCWRHNyA
提取码:h392

本帖被以下淘专辑推荐:

回复

使用道具 举报

爱笑 | 2023-11-21 09:17:20 | 显示全部楼层
很不错~继续加油
用心做好保姆工作
回复 支持 1 反对 0

使用道具 举报

lsrly | 2023-11-21 09:38:42 | 显示全部楼层
666
回复

使用道具 举报

496199544 | 2023-11-21 10:20:30 | 显示全部楼层
回复

使用道具 举报

wuboy19 | 2023-11-23 10:21:33 | 显示全部楼层
爱笑 发表于 2023-11-21 09:17
很不错~继续加油

谢谢
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则