• 大小: 14KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-18
  • 语言: 其他
  • 标签: ADPS9960  

资源简介

修改了ADPS9960库函数,实现任意IO口的软IIC,调用方法 #include #include "Adafruit_APDS9960.h" SoftWire sw(8,9); Adafruit_APDS9960 apds=Adafruit_APDS9960(sw); 详情参考实例代码。 解压移动至库文件。

资源截图

代码片段和文件信息

/**************************************************************************/
/*! 
    @file     Adafruit_APDS9960.cpp
    @author   Ladyada Dean Miller (Adafruit Industries)

    @section LICENSE

    Software License Agreement (BSD License)

    Copyright (c) 2017 Adafruit Industries
    All rights reserved.

    Redistribution and use in source and binary forms with or without
    modification are permitted provided that the following conditions are met:
    1. Redistributions of source code must retain the above copyright
    notice this list of conditions and the following disclaimer.
    2. Redistributions in binary form must reproduce the above copyright
    notice this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.
    3. Neither the name of the copyright holders nor the
    names of its contributors may be used to endorse or promote products
    derived from this software without specific prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ‘‘AS IS‘‘ AND ANY
    EXPRESS OR IMPLIED WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED
    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
    DIRECT INDIRECT INCIDENTAL SPECIAL EXEMPLARY OR CONSEQUENTIAL DAMAGES
    (INCLUDING BUT NOT LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    LOSS OF USE DATA OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    ON ANY THEORY OF LIABILITY WHETHER IN CONTRACT STRICT LIABILITY OR TORT
    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**************************************************************************/

#ifdef __AVR
  #include 
#elif defined(ESP8266)
  #include 
#endif
#include 
#include 

#include “Adafruit_APDS9960.h“

/*========================================================================*/
/*                          PRIVATE FUNCTIONS                             */
/*========================================================================*/

/**************************************************************************/
/*!
    @brief  Implements missing powf function
*/
/**************************************************************************/
float powf(const float x const float y)
{
  return (float)(pow((double)x (double)y));
}

/**************************************************************************/
/*!
    Enables the device
    Disables the device (putting it in lower power sleep mode)
*/
/**************************************************************************/
void Adafruit_APDS9960::enable(boolean en)
{
  _enable.PON = en;
  this->write8(APDS9960_ENABLE _enable.get());
}

/*======================================================================

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-04-26 09:22  Adafruit_APDS9960-master\
     文件       16292  2018-04-26 09:22  Adafruit_APDS9960-master\Adafruit_APDS9960.cpp
     文件       16223  2018-04-25 19:53  Adafruit_APDS9960-master\Adafruit_APDS9960.h
     目录           0  2018-04-26 09:27  Adafruit_APDS9960-master\examples\
     目录           0  2018-04-26 09:18  Adafruit_APDS9960-master\examples\color_sensor\
     文件        1672  2018-04-26 09:18  Adafruit_APDS9960-master\examples\color_sensor\color_sensor.ino
     目录           0  2018-04-26 09:26  Adafruit_APDS9960-master\examples\gesture_sensor\
     文件        1875  2018-04-26 09:26  Adafruit_APDS9960-master\examples\gesture_sensor\gesture_sensor.ino
     目录           0  2018-04-26 09:27  Adafruit_APDS9960-master\examples\proximity_sensor\
     文件        1746  2018-04-26 09:27  Adafruit_APDS9960-master\examples\proximity_sensor\proximity_sensor.ino
     文件         367  2018-04-23 11:31  Adafruit_APDS9960-master\library.properties

评论

共有 条评论

相关资源