芯片解密STM32+ADNS3080光流传感器测距 时间:2026-08-24 来源: 芯片解密 浏览:2次 字号:大 中 小 芯片解密单片机源程序如下:/* Includes ------------------------------------------------------------------*/芯片解密#include "stm32f10x.h"芯片解密#include "usart.h"芯片解密#include "delay.h"芯片解密#include "spi.h"芯片解密#include"ADNS3080.h"void RCC_Configuration(void);void GPIO_Configuration(void);int main(void){ RCC_Configuration(); GPIO_Configuration(); //GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable,ENABLE); //使能JATG //PB口 USART_Configuration(115200); delay_init(72); // 精确延时初始化 delay_ms(10); ADNS3080_Init(); delay_ms(10);// printf("%d\n",read_zhenlv());//(3000帧/秒)24000000/3000帧每秒=8000 4800则5000帧// delay_ms(10);// printf("%d\n",read_register(Motion)&0x01);//等于1则为1600分辨率 // delay_ms(10);// printf("%f\n",read_average_pixel()); //平均像素//read_pixel(); //图像显示 镜头焦距为8毫米时离镜座3毫米时最清// read_pixel_burst(); //爆发方式显示图像 while (1) { Read_Data_burst(); //用爆发读 delay_ms(10); } }void RCC_Configuration(void){ SystemInit();// 启动时钟 PLL and Flash RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOC|RCC_APB2Periph_GPIOD|RCC_APB2Periph_AFIO,ENABLE);// 时钟全打开了 }void GPIO_Configuration(void) { GPIO_InitTypeDef GPIO_InitStructure; //定义一个结构体 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;//选择LED管脚 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //管脚频率为50MHZ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //模式为推挽输出 GPIO_Init(GPIOD, &GPIO_InitStructure); //初始化GPIOB寄存器 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4|GPIO_Pin_8; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode =GPIO_Mode_Out_PP; //推挽输出 GPIO_Init(GPIOA, &GPIO_InitStructure); } 上一篇:芯片解密STM32F4 HAL_PWM测频程序 下一篇:芯片解密STM32F103HAL库按键单击长按程序