imc_api.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * imc_api.h
  3. *
  4. * Created on: Jul 21, 2022
  5. * Author: yoojin.lim d(yoojin.lim@etri.re.kr)
  6. */
  7. #ifndef INC_IMC_IMC_API_H_
  8. #define INC_IMC_IMC_API_H_
  9. #include "stm32l5xx_hal.h"
  10. #include "sc03mpd/sc03mpd.h"
  11. #define NUM_OF_LED 4
  12. #define LED0_GPIO GPIOB
  13. #define LED1_GPIO GPIOB
  14. #define LED2_GPIO GPIOC
  15. #define LED3_GPIO GPIOC
  16. #define LED0_GPIO_PIN GPIO_PIN_1
  17. #define LED1_GPIO_PIN GPIO_PIN_2
  18. #define LED2_GPIO_PIN GPIO_PIN_6
  19. #define LED3_GPIO_PIN GPIO_PIN_7
  20. #define SBC_POWER_GPIO GPIOG
  21. #define CAM_POWER_GPIO GPIOC
  22. #define SBC_POWER_GPIO_PIN GPIO_PIN_11
  23. #define CAM_POWER_GPIO_PIN GPIO_PIN_7
  24. #define POWER_ON GPIO_PIN_RESET // LOW
  25. #define POWER_OFF GPIO_PIN_SET // HIGH
  26. #define ENERGY_LV0_GPIO GPIOF
  27. #define ENERGY_LV1_GPIO GPIOF
  28. #define ENERGY_LV2_GPIO GPIOF
  29. #define ENERGY_LV0_GPIO_PIN GPIO_PIN_8
  30. #define ENERGY_LV1_GPIO_PIN GPIO_PIN_9
  31. #define ENERGY_LV2_GPIO_PIN GPIO_PIN_10
  32. #define CAM_SHOT_PIN GPIO_PIN_6
  33. #define DELAY_IGNORE_REQ (500) // 500ticks
  34. #define DELAY_AFTER_POWERUP (650) // 650 ms; 2500 ms in manual
  35. #define DELAY_AFTER_CAPTURE (200) // 200 ms
  36. #define DELAY_AFTER_LENGTH (0) // 0
  37. #define DELAY_BEFORE_ERR_HANDLING (10) // 10 ms
  38. #define DELAY_GET_ENERGY_LEVEL (3) // 3 ms
  39. #define IMG_RAM_ADDR (0x68200000)
  40. #define IMG_BLK_SIZE (256)
  41. #define CAM_STS_ENON ( 0) // Executing right
  42. #define CAM_STS_EINI (-1) // Error during init.
  43. #define CAM_STS_ECAP (-2) // Error during image capturing
  44. #define CAM_STS_EDWN (-3) // Error during image downloading
  45. #define CAM_CHANGE_BAUDRATE 0 // set 1 and execute once when change CAM default baudrate
  46. #define CAM_BAUDRATE_OPERATING 115200
  47. #define CAM_BAUDRATE_CURRENT 38400
  48. #define CAM_IMAGE_FIRST_TWO_BYTES 0
  49. #define CAM_FAST_READY 0
  50. #define CAM_BLACK_WHITE 0
  51. #define CAM_COMP_ZERO 1
  52. #define IMAGE_RESOLUTION SC03MPD_RES_160_120 // _640_480, _320_240 (default), _160_120
  53. #if CAM_COMP_ZERO
  54. #define IMAGE_COMPRESSIBILTY 0x00 // SKKU needs raw pixel format to feed an image to AI
  55. #else
  56. #define IMAGE_COMPRESSIBILTY 0x36 // 0x00~FF, 0x36 (default)
  57. #endif
  58. void imc_led_on (uint8_t ledSet[], uint8_t count, uint32_t msec);
  59. void imc_led_blink (uint8_t ledSet[], uint8_t count, uint32_t msec);
  60. int32_t imc_sc03mpd_init(sc03mpd_ifx_t* ifx);
  61. int32_t imc_sc03mpd_capture (sc03mpd_ifx_t* ifx);
  62. int32_t imc_sc03mpd_reset (sc03mpd_ifx_t* ifx);
  63. void imc_sbc_power_off (uint32_t msec);
  64. void imc_sbc_power_on (uint32_t msec);
  65. void imc_cam_power_off (uint32_t msec);
  66. void imc_cam_power_on (uint32_t msec);
  67. uint8_t imc_get_energy_level ();
  68. extern uint16_t ilen;
  69. #endif /* INC_IMC_IMC_API_H_ */