core_dcmi.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (c) 2022 OpenLuat & AirM2M
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  5. * this software and associated documentation files (the "Software"), to deal in
  6. * the Software without restriction, including without limitation the rights to
  7. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  8. * the Software, and to permit persons to whom the Software is furnished to do so,
  9. * subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in all
  12. * copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  16. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  17. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  18. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  19. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  20. */
  21. #ifndef __CORE_DCMI_H__
  22. #define __CORE_DCMI_H__
  23. /**
  24. * @brief 对摄像头做基本的初始化工作
  25. *
  26. * @param VsyncLevel 垂直同步极性 0: VSYNC 低电平有效 1: VSYNC 高电平有效
  27. * @param HsyncLevel 水平同步极性 0: HSYNC 低电平有效 1: HSYNC 高电平有效
  28. * @param PclkPOL Pixel时钟极性 0:下降沿有效 1:上升沿有效
  29. * @param DataBits 数据位8~14
  30. * @param FrameRate 帧率控制,0不控制,1减少为50%,2减少为25%
  31. */
  32. void DCMI_Setup(uint8_t VsyncLevel, uint8_t HsyncLevel, uint8_t PclkPOL, uint8_t DataBit, uint32_t FrameRate);
  33. /**
  34. * @brief 摄像头捕获开关
  35. *
  36. * @param OnOff 0: 关 1: 开
  37. * @param BufLen 缓存大小,注意单位是4byte,如果为0,看下面的参数自动生成,如果不为0,必须是行数据量的倍数,且能被总行数整除,比如320*240,16bit数据,那么就是320*2/4的N倍,比如8倍的1280
  38. * @param ImageW 输出图像一行的像素点数
  39. * @param ImageW 输出图像行数
  40. * @param DataByte 1个像素点的数据量byte
  41. * @param OutH 自动计算出的单次回调行数
  42. */
  43. void DCMI_CaptureSwitch(uint8_t OnOff, uint32_t BufLen, uint32_t ImageW, uint32_t ImageH, uint8_t DataByte, uint32_t *OutH);
  44. void DCMI_SetCallback(CBFuncEx_t CB, void *pData);
  45. /**
  46. * @brief 摄像头裁剪功能
  47. *
  48. * @param OnOff 0: 关 1: 开
  49. * @param VStart 裁剪从第几行开始
  50. * @param HStart 裁剪每行从第几个像素数据开始,如果是16bit数据,则要*2,依次类推
  51. * @param VLen 裁剪保留的行数,最小1
  52. * @param HLen 裁剪每行保留的像素数据,如果是16bit数据,则要*2,依次类推
  53. */
  54. void DCMI_SetCROPConfig(uint8_t OnOff, uint32_t VStart, uint32_t HStart, uint32_t VLen, uint32_t HLen);
  55. #endif