hpm_camera_config.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright (c) 2021 hpmicro
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #ifndef HPM_CAMERA_CONFIG_H
  8. #define HPM_CAMERA_CONFIG_H
  9. #include "hpm_common.h"
  10. #include "hpm_display_common.h"
  11. #include "hpm_i2c_drv.h"
  12. /* Macro to define video resolution. */
  13. #define HPM_CAMERA_RESOLUTION(width, height) ((uint32_t)(width) | ((uint32_t)(height) << 16U))
  14. typedef struct
  15. {
  16. I2C_Type *ptr;
  17. void (*delay_ms)(uint32_t ms);
  18. void (*write_rst)(uint8_t state);
  19. void (*write_pwdn)(uint8_t state);
  20. } camera_context_t;
  21. typedef enum
  22. {
  23. camera_interface_dvp,
  24. camera_interface_mipi,
  25. } camera_interface_t;
  26. typedef struct
  27. {
  28. uint32_t width;
  29. uint32_t height;
  30. display_pixel_format_t pixel_format;
  31. camera_interface_t interface;
  32. } camera_config_t;
  33. /* Video Resolution definition. */
  34. typedef enum
  35. {
  36. video_resolution_5mp = HPM_CAMERA_RESOLUTION(2592, 1944), /* 5MP, 2592 * 1944 */
  37. video_resolution_sxga = HPM_CAMERA_RESOLUTION(1280, 800), /* SXGA, 1280 * 800 */
  38. video_resolution_1080p = HPM_CAMERA_RESOLUTION(1920, 1080), /* 1080P, 1920 * 1280*/
  39. video_resolution_720p = HPM_CAMERA_RESOLUTION(1280, 720), /* 720P, 1280 * 720 */
  40. video_resolution_800_480 = HPM_CAMERA_RESOLUTION(800, 480), /* 640 * 480 */
  41. video_resolution_vga = HPM_CAMERA_RESOLUTION(640, 480), /* VGA, 640 * 480 */
  42. video_resolution_480_272 = HPM_CAMERA_RESOLUTION(480, 272), /* 480 * 272 */
  43. video_resolution_qvga = HPM_CAMERA_RESOLUTION(320, 240), /* QVGA, 320 * 240 */
  44. } camera_resolution_t;
  45. /* Camera light mode type. */
  46. typedef enum
  47. {
  48. camera_light_mode_auto = 0,
  49. camera_light_mode_sunny,
  50. camera_light_mode_cloudy,
  51. camera_light_mode_office,
  52. camera_light_mode_home,
  53. camera_light_mode_night,
  54. } camera_light_mode_t;
  55. /* Camera special effect type. */
  56. typedef enum
  57. {
  58. camera_special_effect_normal = 0, /* Normal. */
  59. camera_special_effect_bw, /* B & W */
  60. camera_special_effect_sepia, /* Sepia. */
  61. camera_special_effect_bluish, /* Bluish. */
  62. camera_special_effect_redish, /* Redish. */
  63. camera_special_effect_greenish, /* Greenish. */
  64. camera_special_effect_negtive, /* Negtive. */
  65. camera_special_effect_over_exposure, /* OverExposure. */
  66. camera_special_effect_solarize, /* Solarize. */
  67. } camera_special_effect_t;
  68. #ifdef __cplusplus
  69. extern "C" {
  70. #endif
  71. /*
  72. * camera device initialization
  73. */
  74. hpm_stat_t camera_device_init(camera_context_t *camera_context, camera_config_t *camera_config);
  75. #ifdef __cplusplus
  76. }
  77. #endif
  78. #endif /* HPM_CAMERA_CONFIG_H */