Browse Source

封装相机部分

master
zwsd 3 years ago
parent
commit
74be47ece5
  1. 3
      .vscode/settings.json
  2. 1
      main/CMakeLists.txt
  3. 21
      main/app_main.cpp
  4. 2
      main/ble_spp_server_demo.c
  5. 2
      main/ble_spp_server_demo.h
  6. 17
      main/camera.cpp
  7. 2
      main/camera.h

3
.vscode/settings.json

@ -8,6 +8,7 @@
"bitset": "c", "bitset": "c",
"ble_spp_server_demo.h": "c", "ble_spp_server_demo.h": "c",
"esp_bt_main.h": "c", "esp_bt_main.h": "c",
"esp_bt_defs.h": "c"
"esp_bt_defs.h": "c",
"camera.h": "c"
} }
} }

1
main/CMakeLists.txt

@ -1,5 +1,6 @@
set(srcs "app_main.cpp" # set(srcs "app_main.cpp" #
"ble_spp_server_demo.c" "ble_spp_server_demo.c"
"camera.cpp"
) )
idf_component_register(SRCS "${srcs}"# idf_component_register(SRCS "${srcs}"#

21
main/app_main.cpp

@ -1,22 +1,17 @@
#include "who_camera.h"
#include "who_motion_detection.hpp"
#include "who_lcd.h"
#include "camera.h"
// //
extern "C" extern "C"
{ {
#include "ble_spp_server_demo.h" #include "ble_spp_server_demo.h"
} }
static QueueHandle_t xQueueAIFrame = NULL;
static QueueHandle_t xQueueLCDFrame = NULL;
extern "C" void app_main()
extern "C" void app_main(void)
{ {
ble_spp_server_demo_app_main();
xQueueAIFrame = xQueueCreate(2, sizeof(camera_fb_t *));
xQueueLCDFrame = xQueueCreate(2, sizeof(camera_fb_t *));
ble_spp_server_init();
camera_init();
register_camera(PIXFORMAT_RGB565, FRAMESIZE_240X240, 2, xQueueAIFrame);
register_motion_detection(xQueueAIFrame, NULL, NULL, xQueueLCDFrame);
register_lcd(xQueueLCDFrame, NULL, true);
while (true)
{
/* code */
}
} }

2
main/ble_spp_server_demo.c

@ -652,7 +652,7 @@ static void gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_
} while (0); } while (0);
} }
void ble_spp_server_demo_app_main()
void ble_spp_server_init()
{ {
esp_err_t ret; esp_err_t ret;
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT(); esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();

2
main/ble_spp_server_demo.h

@ -50,4 +50,4 @@ enum
SPP_IDX_NB, SPP_IDX_NB,
}; };
void ble_spp_server_demo_app_main();
void ble_spp_server_init();

17
main/camera.cpp

@ -0,0 +1,17 @@
#include "camera.h"
#include "who_camera.h"
#include "who_motion_detection.hpp"
#include "who_lcd.h"
static QueueHandle_t xQueueAIFrame = NULL;
static QueueHandle_t xQueueLCDFrame = NULL;
void camera_init(void)
{
xQueueAIFrame = xQueueCreate(2, sizeof(camera_fb_t *));
xQueueLCDFrame = xQueueCreate(2, sizeof(camera_fb_t *));
register_camera(PIXFORMAT_RGB565, FRAMESIZE_240X240, 2, xQueueAIFrame);
register_motion_detection(xQueueAIFrame, NULL, NULL, xQueueLCDFrame);
register_lcd(xQueueLCDFrame, NULL, true);
}

2
main/camera.h

@ -0,0 +1,2 @@
#pragma once
void camera_init(void);
Loading…
Cancel
Save