|
Revision 341, 1.3 KB
(checked in by goodea, 4 years ago)
|
|
virtual cam
|
| Line | |
|---|
| 1 | #include <math.h> |
|---|
| 2 | #include <stdbool.h> |
|---|
| 3 | #include <stdio.h> |
|---|
| 4 | #include <time.h> |
|---|
| 5 | #include <stdlib.h> |
|---|
| 6 | #include <ctype.h> |
|---|
| 7 | #include <cc3.h> |
|---|
| 8 | #include <cc3_ilp.h> |
|---|
| 9 | #include "polly.h" |
|---|
| 10 | |
|---|
| 11 | #define MMC_DEBUG |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | /* simple hello world, showing features and compiling*/ |
|---|
| 17 | int main (void) |
|---|
| 18 | { |
|---|
| 19 | uint32_t last_time, val; |
|---|
| 20 | char c; |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | // setup system |
|---|
| 24 | cc3_system_setup (); |
|---|
| 25 | |
|---|
| 26 | cc3_filesystem_init(); |
|---|
| 27 | |
|---|
| 28 | // configure uarts |
|---|
| 29 | cc3_uart_init (0, CC3_UART_RATE_115200, CC3_UART_MODE_8N1, |
|---|
| 30 | CC3_UART_BINMODE_BINARY); |
|---|
| 31 | // Make it so that stdout and stdin are not buffered |
|---|
| 32 | val = setvbuf (stdout, NULL, _IONBF, 0); |
|---|
| 33 | val = setvbuf (stdin, NULL, _IONBF, 0); |
|---|
| 34 | |
|---|
| 35 | cc3_camera_init (); |
|---|
| 36 | |
|---|
| 37 | cc3_set_colorspace (CC3_RGB); |
|---|
| 38 | cc3_set_resolution (CC3_LOW_RES); |
|---|
| 39 | cc3_set_auto_white_balance (true); |
|---|
| 40 | cc3_set_auto_exposure (true); |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | cc3_pixbuf_set_subsample (CC3_NEAREST, 2, 2); |
|---|
| 44 | cc3_pixbuf_set_coi (CC3_GREEN); |
|---|
| 45 | |
|---|
| 46 | cc3_clr_led (0); |
|---|
| 47 | cc3_clr_led (1); |
|---|
| 48 | cc3_clr_led (2); |
|---|
| 49 | |
|---|
| 50 | // sample wait command in ms |
|---|
| 51 | cc3_wait_ms (1000); |
|---|
| 52 | |
|---|
| 53 | while (1) { |
|---|
| 54 | polly_config_t p_config; |
|---|
| 55 | p_config.color_thresh=20; |
|---|
| 56 | p_config.min_blob_size=20; |
|---|
| 57 | p_config.connectivity=0; |
|---|
| 58 | p_config.horizontal_edges=0; |
|---|
| 59 | p_config.vertical_edges=1; |
|---|
| 60 | p_config.blur=1; |
|---|
| 61 | polly(p_config); |
|---|
| 62 | |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | return 0; |
|---|
| 66 | } |
|---|
| 67 | |
|---|