hpm_camera_config.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. I2C_Type *ptr;
  16. void (*delay_ms)(uint32_t ms);
  17. void (*write_rst)(uint8_t state);
  18. void (*write_pwdn)(uint8_t state);
  19. uint16_t i2c_device_addr;
  20. } camera_context_t;
  21. typedef struct {
  22. bool hsync_active_low;
  23. bool vsync_active_low;
  24. } camera_param_dvp_t;
  25. typedef enum {
  26. camera_interface_dvp,
  27. camera_interface_mipi,
  28. } camera_interface_t;
  29. typedef struct {
  30. uint32_t width;
  31. uint32_t height;
  32. display_pixel_format_t pixel_format;
  33. camera_interface_t interface;
  34. void *interface_param;
  35. } camera_config_t;
  36. /* Video Resolution definition. */
  37. typedef enum {
  38. video_resolution_5mp = HPM_CAMERA_RESOLUTION(2592, 1944), /* 5MP, 2592 * 1944 */
  39. video_resolution_sxga = HPM_CAMERA_RESOLUTION(1280, 800), /* SXGA, 1280 * 800 */
  40. video_resolution_1080p = HPM_CAMERA_RESOLUTION(1920, 1080), /* 1080P, 1920 * 1280*/
  41. video_resolution_720p = HPM_CAMERA_RESOLUTION(1280, 720), /* 720P, 1280 * 720 */
  42. video_resolution_800_480 = HPM_CAMERA_RESOLUTION(800, 480), /* 640 * 480 */
  43. video_resolution_vga = HPM_CAMERA_RESOLUTION(640, 480), /* VGA, 640 * 480 */
  44. video_resolution_480_272 = HPM_CAMERA_RESOLUTION(480, 272), /* 480 * 272 */
  45. video_resolution_qvga = HPM_CAMERA_RESOLUTION(320, 240), /* QVGA, 320 * 240 */
  46. } camera_resolution_t;
  47. /* Camera light mode type. */
  48. typedef enum {
  49. camera_light_mode_auto = 0,
  50. camera_light_mode_sunny,
  51. camera_light_mode_cloudy,
  52. camera_light_mode_office,
  53. camera_light_mode_home,
  54. camera_light_mode_night,
  55. } camera_light_mode_t;
  56. /* Camera special effect type. */
  57. typedef enum {
  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. hpm_stat_t camera_device_get_dvp_param(camera_context_t *camera_context, camera_config_t *camera_config);
  76. #ifdef __cplusplus
  77. }
  78. #endif
  79. #endif /* HPM_CAMERA_CONFIG_H */