资源简介
STM32 OV2640 ESP8266图像传输
int main()
{
u16 temp;
u8 *p;
u32 i,k;
u32 count,spi_send_len;
delay_init(168);
uart_init(115200);
printf("usart init.\r\n");
OV2640_Init();
DCMI_Config();
user_SPI_Config();
SPI1_SetSpeed(21);
printf("ov2640 init\r\n");
OV2640_JPEG_Mode();
OV2640_OutSize_Set(1600,1200);
DCMI_DMA_Init((u32)&frame;_data,JPEG_BUFF_LEN,DMA_MemoryDataSize_Word,DMA_MemoryInc_Enable);
DMA_Cmd(DMA2_Stream1,ENABLE);
DCMI_CaptureCmd(ENABLE);
printf("init success.\r\n");
delay_ms(1000);
GPIO_SetBits(GPIOB,GPIO_Pin_12);
while(1)
{
if(jpeg_ok==1)
{
printf("send...\r\n");
count=0;
wr_rdy=1;
p = (u8*)frame_data;
spi_send_len = jpeg_len/8; //byte-->word
spi_send_len+=1;
FRAME_START();//开始传输信号
for(k=0;k<spi_send_len;) //发送
{
if(wr_rdy == 1) //禁止传输
{
wr_rdy=0; //注意:必须及时清0,放在其后清0会导致EXTI中断置位后再次被复位
SPI_NSS_ENABLE();
UserEspSPISendbyte(0x02); //写指令
UserEspSPISendbyte(0x00); //写地址
for(i=0;iSR&0X40;)==0);
//USART2->DR = (u8)p[count];
count++;
}
k++;
SPI_NSS_DISABLE();
}
else //*可以添加传输失败的超时处理
{
}
}
delay_ms(1); //这里必须有延时,否则ESP8266 GPIO中断比SPI中断先到,导致接收不到最后几个字节
FRAME_END();
printf("count:%d.\r\n",count);
count= 0;
delay_ms(2); //稍作延时,更加稳定的传输
jpeg_ok = 2;
}
}
}
代码片段和文件信息
/*
* ESPRESSIF MIT License
*
* Copyright (c) 2016
*
* Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only in which case
* it is free of charge to any person obtaining a copy of this software and associated
* documentation files (the “Software“) to deal in the Software without restriction including
* without limitation the rights to use copy modify merge publish distribute sublicense
* and/or sell copies of the Software and to permit persons to whom the Software is furnished
* to do so subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND EXPRESS OR
* IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER LIABILITY WHETHER
* IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#include “ets_sys.h“
#include “osapi.h“
#include “driver/gpio16.h“
void ICACHE_FLASH_ATTR
gpio16_output_conf(void)
{
WRITE_PERI_REG(PAD_XPD_DCDC_CONF
(READ_PERI_REG(PAD_XPD_DCDC_CONF) & 0xffffffbc) | (uint32)0x1); // mux configuration for XPD_DCDC to output rtc_gpio0
WRITE_PERI_REG(RTC_GPIO_CONF
(READ_PERI_REG(RTC_GPIO_CONF) & (uint32)0xfffffffe) | (uint32)0x0); //mux configuration for out enable
WRITE_PERI_REG(RTC_GPIO_ENABLE
(READ_PERI_REG(RTC_GPIO_ENABLE) & (uint32)0xfffffffe) | (uint32)0x1); //out enable
}
void ICACHE_FLASH_ATTR
gpio16_output_set(uint8 value)
{
WRITE_PERI_REG(RTC_GPIO_OUT
(READ_PERI_REG(RTC_GPIO_OUT) & (uint32)0xfffffffe) | (uint32)(value & 1));
}
void ICACHE_FLASH_ATTR
gpio16_input_conf(void)
{
WRITE_PERI_REG(PAD_XPD_DCDC_CONF
(READ_PERI_REG(PAD_XPD_DCDC_CONF) & 0xffffffbc) | (uint32)0x1); // mux configuration for XPD_DCDC and rtc_gpio0 connection
WRITE_PERI_REG(RTC_GPIO_CONF
(READ_PERI_REG(RTC_GPIO_CONF) & (uint32)0xfffffffe) | (uint32)0x0); //mux configuration for out enable
WRITE_PERI_REG(RTC_GPIO_ENABLE
READ_PERI_REG(RTC_GPIO_ENABLE) & (uint32)0xfffffffe); //out disable
}
uint8 ICACHE_FLASH_ATTR
gpio16_input_get(void)
{
return (uint8)(READ_PERI_REG(RTC_GPIO_IN_DATA) & 1);
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-04-16 10:03 ESP8266\
文件 3696 2019-01-13 15:46 ESP8266\.cproject
文件 837 2019-01-13 15:46 ESP8266\.project
目录 0 2019-04-16 10:30 ESP8266\.settings\
文件 1824 2018-06-08 16:20 ESP8266\License
文件 10160 2018-05-29 14:02 ESP8266\Makefile
文件 123 2018-06-08 16:20 ESP8266\README.md
文件 496 2018-06-08 16:20 ESP8266\VERSION
目录 0 2019-04-16 10:03 ESP8266\app\
目录 0 2019-04-16 10:03 ESP8266\app\.output\
目录 0 2019-04-16 10:03 ESP8266\app\.output\eagle\
目录 0 2019-04-16 10:03 ESP8266\app\.output\eagle\debug\
目录 0 2019-04-16 10:30 ESP8266\app\.output\eagle\debug\bin\
目录 0 2019-04-16 10:03 ESP8266\app\.output\eagle\debug\image\
文件 528756 2019-01-16 19:23 ESP8266\app\.output\eagle\debug\image\eagle.app.v6.out
文件 2913 2019-01-13 17:30 ESP8266\app\Makefile
目录 0 2019-04-16 10:03 ESP8266\app\driver\
目录 0 2019-04-16 10:03 ESP8266\app\driver\.output\
目录 0 2019-04-16 10:03 ESP8266\app\driver\.output\eagle\
目录 0 2019-04-16 10:03 ESP8266\app\driver\.output\eagle\debug\
目录 0 2019-04-16 10:03 ESP8266\app\driver\.output\eagle\debug\lib\
文件 200320 2019-01-16 19:23 ESP8266\app\driver\.output\eagle\debug\lib\libdriver.a
目录 0 2019-04-16 10:03 ESP8266\app\driver\.output\eagle\debug\obj\
文件 1660 2019-01-16 19:23 ESP8266\app\driver\.output\eagle\debug\obj\gpio16.d
文件 5152 2019-01-16 19:23 ESP8266\app\driver\.output\eagle\debug\obj\gpio16.o
文件 1660 2019-01-16 19:23 ESP8266\app\driver\.output\eagle\debug\obj\hw_timer.d
文件 9348 2019-01-16 19:23 ESP8266\app\driver\.output\eagle\debug\obj\hw_timer.o
文件 1697 2019-01-16 19:23 ESP8266\app\driver\.output\eagle\debug\obj\i2c_master.d
文件 19976 2019-01-16 19:23 ESP8266\app\driver\.output\eagle\debug\obj\i2c_master.o
文件 1843 2019-01-16 19:23 ESP8266\app\driver\.output\eagle\debug\obj\key.d
文件 14756 2019-01-16 19:23 ESP8266\app\driver\.output\eagle\debug\obj\key.o
............此处省略472个文件信息
相关资源
- 基于STM32F4x9的LCD显示
- VS1053B编解码器的VDR分布式声音采集卡
- stm32的DAC播放音乐文件
- STM32+TMC5160代码电路图.rar
- 基于STM32的深海钻机甲板控制系统
- stm32f103.SchDoc
- STM32F103 USART+DMA
- DMA+stm32 407.zip
- 4_USART串口通信(空闲中断+DMA.zip
- stm32f105-usart-DMA收发demo
- STM32F042F6P6 Uart12DMA;发送中断接收
- 基于STM32的嵌入式双目图像采集系统设
- 基于STM32F103C8单片机的晶联讯电子JL
- 基于STM32的温湿度检测系统实现
- stm32F4+w5300
- 14284969_《STM32单片机应用与全案例实践
-
ST-li
nk-V2的SWD仿真使用方法.docx - 安富莱STM32开发板资料
- STM32F103实现OV7670摄像头显示
- STM32F207学习板例程
- STM32F103VCT6TR - High-density performance lin
- STM32 SRAM启动的 KeiL 配置
- STM32的IAP-Bootloader程序
- STM32例程之Bootloader
- stm32f103 虚拟U盘,调试成功的
- 基于stm32F103vct6的SD卡FATFS文件系统移植
- STM32F030从机中断接收的iic代码,附带
- FreeModbus_Slave+STM32F407+USART2代码亲测可
- STM32+1602液晶proteus仿真.zip
- STM32循迹小车
评论
共有 条评论