zoukankan      html  css  js  c++  java
  • CC2640R2F&TI-RTOS 拿到 TI CC2640R2F 开发板 第二件事就是 LED 驱动 ,点个灯

    /*
     * board_led.c
     *
     *  Created on: 2018年7月3日
     *      Author: admin
     */
    
    
    
    #include "board_uart.h"
    
    #include "board.h"
    
    #include "board_led.h"
    
    static PIN_State  ledBoardPinsState;
    static PIN_Handle ledBoardPinsHandle = NULL;
    
    PIN_Config LedBoardPinsCfg[] ={
     ledRedBoard  | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
     ledBlueBoard | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
     PIN_TERMINATE};
    
    
    void ledBoardInit( void )
    {/* 初始化LED0,2018年7月3日15:36:20 */
    
       /* 打开LED0 */
       ledBoardPinsHandle = PIN_open(&ledBoardPinsState, LedBoardPinsCfg);
    
       if (ledBoardPinsHandle == NULL) {
           /* PIN_open() failed */
           while (1);
       }
       else
       {
           PIN_setOutputValue( ledBoardPinsHandle, ledRedBoard, true );
           PIN_setOutputValue( ledBoardPinsHandle, ledBlueBoard, true );
    
         bspDebugPrintf( true,"led1,led2 Board Init end.
    " );
       }
    
    }
    
    uint32_t ledBoardToggle( PIN_Id pinId )
    {
         if( PIN_getOutputValue( pinId ) )
         {
             PIN_setOutputValue( ledBoardPinsHandle, pinId, false );
         }
         else
         {
             PIN_setOutputValue( ledBoardPinsHandle, pinId, true );
         }
    
         return true;
    }
    
    uint32_t ledBoardOff( PIN_Id pinId )
    {
    
         PIN_setOutputValue( ledBoardPinsHandle, pinId, true );
    
         return true;
    }
    
    uint32_t ledBoardOn( PIN_Id pinId )
    {
    
         PIN_setOutputValue( ledBoardPinsHandle, pinId, false );
    
         return true;
    }
    /*
     * board_led.h
     *
     *  Created on:  2018年7月3日
     *      Author: admin
     */
    
    #ifndef APPLICATION_BOARD_LED_H_
    #define APPLICATION_BOARD_LED_H_
    
    #include <ti/drivers/PIN.h>
    
    #define ledRedBoard      PIN_ID(6)
    #define ledBlueBoard     PIN_ID(7)
    
    void ledBoardInit( void );
    uint32_t ledBoardToggle( PIN_Id pinId );
    uint32_t ledBoardOff( PIN_Id pinId );
    uint32_t ledBoardOn( PIN_Id pinId );
    
    #endif /* APPLICATION_BOARD_LED_H_ */

     官方资料链接

    BLE5-Stack User’s Guide

    CC2640R2F / CC2640 / CC2650入门和常见问题解答

  • 相关阅读:
    axios 封装
    Git 常用命令行
    React Native 开发环境搭建
    React Native 组件分类
    日期插件rolldate.js的使用
    单图片上传
    使用css完成物流进度的样式
    搜索过滤 以及排序
    v-for的使用方法
    v-if 和v-show 用法
  • 原文地址:https://www.cnblogs.com/suozhang/p/9268485.html
Copyright © 2011-2022 走看看