PICO-Cam-A 是一款Waveshare设计的高性能的微控制器开发板,其在较小的板型情况下,板载了1.14inch LCD、Cam摄像头、
按键等外设,并且引出了部分GPIO与Debug接口,方便用户开发,并嵌入应用到产品中。
LCD参数 | |||
控制芯片 | ST7789V | 分辨率 | 135(H)RGB x 240(V) |
通信接口 | SPI | 显示尺寸 | 14.864(H)x 24.912(V)mm |
显示面板 | IPS | 像素大小 | 0.1101(H)x 0.1035(V)mm |
示例说明
该示例主要是通过摄像头捕获图像,并显示在 1.14inch LCD 上。程序使用了多核心处理,其中 Core 1 负责获取图像数据以及图像处理,Core 0 负责图像显示
Core 1 代码解析
multicore_fifo_push_blocking(FLAG_VALUE);
uint32_t ack = multicore_fifo_pop_blocking();
DEV_Module_Init(); LCD_1IN14_V2_Init(HORIZONTAL); LCD_1IN14_V2_Clear(BLACK); UDOUBLE Imagesize = LCD_1IN14_V2_HEIGHT * LCD_1IN14_V2_WIDTH * 2; UWORD *BlackImage; if ((BlackImage = (UWORD *)malloc(Imagesize)) == NULL) { printf("Failed to apply for black memory...\r\n"); exit(0); }
Paint_NewImage((UBYTE *)BlackImage, LCD_1IN14_V2.WIDTH, LCD_1IN14_V2.HEIGHT, 0, WHITE); Paint_SetScale(65); Paint_SetRotate(ROTATE_0); Paint_DrawImage(gImage_waveshare, 0, 0, 240, 135); LCD_1IN14_V2_Display(BlackImage); DEV_Delay_ms(500);
struct cam_config config; cam_config_struct(&config); cam_init(&config);
while (true) { cam_capture_frame(&config); uint16_t index = 0; for (int y = 134; y > 0; y--) { for (int x = 0; x < 240; x++) { uint16_t c = image_buf[(y)*324+(x)]; uint16_t imageRGB = (((c & 0xF8) << 8) | ((c & 0xFC) << 3) | ((c & 0xF8) >> 3)); displayBuf[index++] = (uint16_t)(imageRGB >> 8) & 0xFF; displayBuf[index++] = (uint16_t)(imageRGB) & 0xFF; } } imageReady = 1; }
Core 0 代码解析
multicore_launch_core1(core1_entry);
uint32_t ack = multicore_fifo_pop_blocking(); if (ack != FLAG_VALUE) printf("Error: Core 0 failed to receive acknowledgment from core 1!\n"); else { multicore_fifo_push_blocking(FLAG_VALUE); printf("Success: Core 0 Received acknowledgment from core 1!\n"); }
while (1) { if (imageReady == 1) { LCD_1IN14_V2_Display((uint16_t*)displayBuf); // Reset the imageReady flag after displaying the image imageReady = 0; } DEV_Delay_ms(1); }