• 大小: 4.43MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-17
  • 语言: 其他
  • 标签: APDS9960  

资源简介

刚刚移植sparkfun的APDS9960驱动程序,包含了手势操作,接近开关,颜色感应等操作。

资源截图

代码片段和文件信息

#include “main.h“

#define APDS9960_i2c_TIMING           0xff410507
#define APDS9960_FLAG_TIMEOUT         ((uint32_t)0x1000)
#define APDS9960_LONG_TIMEOUT         ((uint32_t)(10 * APDS9960_FLAG_TIMEOUT))
__IO uint32_t  APDS9960_Timeout = APDS9960_LONG_TIMEOUT;

void i2c_LowLevel_DeInit(void)
{
  GPIO_InitTypeDef  GPIO_InitStructure; 
   
  /* sEE_I2C Peripheral Disable */
  I2C_Cmd(I2C2 DISABLE);
 
  /* sEE_I2C DeInit */
  I2C_DeInit(I2C2);

  /* sEE_I2C Periph clock disable */
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C2 DISABLE);
    
  /* GPIO configuration */  
  /* Configure sEE_I2C pins: SCL */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  GPIO_Init(GPIOB &GPIO_InitStructure);

  /* Configure sEE_I2C pins: SDA */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
  GPIO_Init(GPIOB &GPIO_InitStructure);
}

void i2c_LowLevel_Init(void)
{
  GPIO_InitTypeDef  GPIO_InitStructure;
  
  /* Configure the I2C clock source. The clock is derived from the HSI */
  RCC_I2CCLKConfig(RCC_I2C1CLK_HSI);//?
    
  /* sEE_I2C_SCL_GPIO_CLK and sEE_I2C_SDA_GPIO_CLK Periph clock enable */
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB| RCC_AHBPeriph_GPIOB ENABLE);
  
  /* sEE_I2C Periph clock enable */
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C2 ENABLE);
  
  /* Connect PXx to I2C_SCL*/
  GPIO_PinAFConfig(GPIOB GPIO_PinSource10 GPIO_AF_1);
  
  /* Connect PXx to I2C_SDA*/
  GPIO_PinAFConfig(GPIOB GPIO_PinSource11 GPIO_AF_1);
  
  /* GPIO configuration */  
  /* Configure sEE_I2C pins: SCL */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
  GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  GPIO_Init(GPIOB &GPIO_InitStructure);
  
  /* Configure sEE_I2C pins: SDA */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
  GPIO_Init(GPIOB &GPIO_InitStructure);
}

void i2c_DeInit(void)
{
  i2c_LowLevel_DeInit(); 
}

void APDS9960_i2c_Init(void)

  I2C_InitTypeDef  I2C_InitStructure;
  
  i2c_LowLevel_Init();
  
  /* I2C configuration */
  /* sEE_I2C configuration */
  I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
  I2C_InitStructure.I2C_AnalogFilter = I2C_AnalogFilter_Enable;
  I2C_InitStructure.I2C_DigitalFilter = 0x00;
  I2C_InitStructure.I2C_OwnAddress1 = 0x00;
  I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
  I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
  I2C_InitStructure.I2C_Timing = APDS9960_i2c_TIMING;
  
  /* Apply sEE_I2C configuration after enabling it */
  I2C_Init(I2C2 &I2C_InitStructure);
   
  /* sEE_I2C Peripheral Enable */
  I2C_Cmd(I2C2 ENABLE); 
}


uint32_t I2C_TIMEOUT_UserCallback(void)
{
#ifdef debug
Uart_Puts(“err\n“);
#endif
return(0);
}

bool wireWriteByte(uint8_t val)
{
  

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       7929  2016-02-05 15:55  2016 2.5 ADSP9960驱动程序(stm32f0c8)\ADSP9960\ADSP9960_platform.c

     文件        451  2016-02-05 15:50  2016 2.5 ADSP9960驱动程序(stm32f0c8)\ADSP9960\ADSP9960_platform.h

     文件      52565  2016-02-05 15:59  2016 2.5 ADSP9960驱动程序(stm32f0c8)\ADSP9960\SparkFun_ADSP9960.c

     文件      10796  2016-02-05 14:59  2016 2.5 ADSP9960驱动程序(stm32f0c8)\ADSP9960\SparkFun_ADSP9960.h

     文件      24914  2013-11-19 10:38  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\CMSIS END USER LICENCE AGREEMENT.pdf

     文件     245489  2013-11-26 10:15  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Include\stm32f0xx.h

     文件       2223  2013-11-22 18:14  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Include\system_stm32f0xx.h

     文件      29871  2013-11-19 10:38  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Release_Notes.html

     文件      10069  2013-11-22 18:14  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\arm\startup_stm32f030.s

     文件      10718  2013-11-22 18:14  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\arm\startup_stm32f0xx.s

     文件       9882  2013-11-22 18:14  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\arm\startup_stm32f0xx_ld.s

     文件       8213  2013-11-22 18:14  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\gcc_ride7\startup_stm32f030.s

     文件       8686  2013-11-22 18:14  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\gcc_ride7\startup_stm32f0xx.s

     文件       8041  2013-11-22 18:14  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\gcc_ride7\startup_stm32f0xx_ld.s

     文件      10333  2013-11-22 18:14  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\iar\startup_stm32f030.s

     文件      11355  2013-11-22 18:14  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\iar\startup_stm32f0xx.s

     文件      10086  2013-11-22 18:14  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\iar\startup_stm32f0xx_ld.s

     文件      12612  2013-11-22 18:14  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\system_stm32f0xx.c

     文件      11038  2013-11-22 18:22  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\TASKING\STM32F0XX_LD(STM32F0x0xx)\.cproject

     文件       5888  2013-11-22 18:22  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\TASKING\STM32F0XX_LD(STM32F0x0xx)\.project

     文件       2779  2013-11-22 18:22  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\TASKING\STM32F0XX_LD(STM32F0x0xx)\readme.txt

     文件       3896  2013-11-22 18:22  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\TASKING\STM32F0XX_LD(STM32F0x0xx)\STM32F0XX_LD(STM32F0x0xx).launch

     文件       7384  2013-11-22 18:22  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\TASKING\STM32F0XX_LD(STM32F0x0xx)\TASKING\stm32f0xx_ld.lsl

     文件      10717  2013-11-22 18:22  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\TASKING\STM32F0XX_MD(STM32F0x1xx)\.cproject

     文件       5882  2013-11-22 18:22  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\TASKING\STM32F0XX_MD(STM32F0x1xx)\.project

     文件       2802  2013-11-22 18:22  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\TASKING\STM32F0XX_MD(STM32F0x1xx)\readme.txt

     文件       3896  2013-11-22 18:22  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\TASKING\STM32F0XX_MD(STM32F0x1xx)\STM32F0XX_MD(STM32F0x1xx).launch

     文件       8086  2013-11-22 18:22  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\TASKING\STM32F0XX_MD(STM32F0x1xx)\TASKING\stm32f0xx.lsl

     文件       8266  2013-11-22 18:14  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\TrueSTUDIO\startup_stm32f030.s

     文件       8739  2013-11-22 18:14  2016 2.5 ADSP9960驱动程序(stm32f0c8)\Library\CMSIS\Device\ST\STM32F0xx\Source\Templates\TrueSTUDIO\startup_stm32f0xx.s

............此处省略829个文件信息

评论

共有 条评论