Skip to content

Commit

Permalink
Merge pull request alibaba#368 from msbtx/rebase
Browse files Browse the repository at this point in the history
add camera code and create cameraappgui
  • Loading branch information
junjiec authored and Jianlong0430 committed Jul 16, 2018
1 parent 8cb9804 commit d2e6e18
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 15 deletions.
4 changes: 4 additions & 0 deletions board/developerkit/Src/stm32l4xx_hal_msp.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,11 @@ void HAL_DCMI_MspInit(DCMI_HandleTypeDef* hdcmi)
hdma_dcmi.Init.MemInc = DMA_MINC_ENABLE;
hdma_dcmi.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
hdma_dcmi.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
#ifndef DK_CAMERA_SNAPSHOP
hdma_dcmi.Init.Mode = DMA_CIRCULAR;
#else
hdma_dcmi.Init.Mode = DMA_NORMAL;
#endif
hdma_dcmi.Init.Priority = DMA_PRIORITY_LOW;
if (HAL_DMA_Init(&hdma_dcmi) != HAL_OK)
{
Expand Down
25 changes: 12 additions & 13 deletions board/developerkit/camera_hal/camera_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,12 @@
CAMERA_DrvTypeDef *camera_drv;
DCMI_HandleTypeDef *phdcmi;

#ifndef DK_CAMERA_SNAPSHOP
uint8_t camera_dis_on = 0;
uint16_t pBuffer[ST7789_LCD_PIXEL_WIDTH * ST7789_LCD_PIXEL_HEIGHT];
#endif

extern void camera_dispaly(uint16_t *data, uint32_t pixel_num);
extern void BSP_LCD_Clear(uint16_t Color);
uint16_t *camera_buff = NULL;
uint8_t camera_dis_on = 0;

static void (*pCapFunc)() = 0;


/**
* @brief This function handles DMA2 channel6 global interrupt.
*/
Expand All @@ -39,8 +34,11 @@ void DCMI_IRQHandler(void)
krhino_intrpt_exit();
}

void enable_camera_display(uint8_t on)
{
camera_dis_on = on;
}

#ifndef DK_CAMERA_SNAPSHOP
void CAMERA_Init(uint32_t Resolution)
{
camera_drv = &gc0329_drv;
Expand Down Expand Up @@ -98,18 +96,19 @@ void CameraDEMO_Init(uint16_t *buff, uint32_t size)
// OnError_Handler(hal_status != HAL_OK);
}
}
#endif

void GC0329_CAMERA_FrameEventCallback(void)
{
if(pCapFunc){
pCapFunc();
return;
}
#ifndef DK_CAMERA_SNAPSHOP
if(camera_dis_on)
camera_dispaly(pBuffer, (ST7789_LCD_PIXEL_WIDTH* ST7789_LCD_PIXEL_HEIGHT));
#endif

if(camera_dis_on){
HAL_DCMI_Suspend(phdcmi);
camera_dispaly(camera_buff, (ST7789_WIDTH* ST7789_HEIGHT));
HAL_DCMI_Resume(phdcmi);
}
}

/**
Expand Down
Empty file modified board/developerkit/camera_hal/include/camera_demo.h
100644 → 100755
Empty file.
18 changes: 18 additions & 0 deletions board/developerkit/camera_hal/ucube.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
src =Split('''
gc0329.c
camera_demo.c
''')

component = aos_component('camera_hal', src)

global_includes =Split('''
include
''')
for i in global_includes:
component.add_global_includes(i)

global_macros =Split('''
DEVELOPERKIT_CAMERA
''')
for i in global_macros:
component.add_global_macros(i)
5 changes: 3 additions & 2 deletions example/cameraapp/ucube.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
cameraapp.c
''')

component = aos_component('helloworld', src)
component.add_comp_deps('kernel/yloop', 'tools/cli')

component = aos_component('cameraapp', src)
component.add_comp_deps('kernel/yloop', 'tools/cli', 'kernel.modules.fs.fatfs', 'board.developerkit.camera_hal')
component.add_global_macros('AOS_NO_WIFI')

0 comments on commit d2e6e18

Please sign in to comment.