summaryrefslogtreecommitdiffstats
path: root/src/cameras/uca_pco.c
blob: daba6f60ad8d71dc7864060e3eeb7d723e52e456 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

#include <clser.h>
#include <libpco/libpco.h>
#include "uca.h"
#include "uca_pco.h"

struct pco_edge_t *pco;

static void uca_pco_destroy(struct uca_t *uca)
{
    pco_destroy(pco);
}

uint8_t uca_pco_init(struct uca_t *uca)
{
    pco = pco_init();
    if (!pco_active(pco)) {
        pco_destroy(pco);
        return 0;
    }

    pco_scan_and_set_baud_rate(pco);

    /* Camera found, set function pointers... */
    uca->cam_destroy = &uca_pco_destroy;

    /* ... and some properties */
    pco_get_actual_size(pco, &uca->image_width, &uca->image_height);
    return 1;
}