-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLepton_I2C.cpp
77 lines (57 loc) · 1.46 KB
/
Lepton_I2C.cpp
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include "Lepton_I2C.h"
#include "leptonSDKEmb32PUB/LEPTON_SDK.h"
#include "leptonSDKEmb32PUB/LEPTON_SYS.h"
#include "leptonSDKEmb32PUB/LEPTON_Types.h"
#include "leptonSDKEmb32PUB/LEPTON_AGC.h"
#include <iostream>
bool _connected;
LEP_CAMERA_PORT_DESC_T _port;
LEP_AGC_ENABLE_E _eneb;
LEP_SYS_FPA_TEMPERATURE_KELVIN_T fpa_temp_kelvin;
LEP_SYS_AUX_TEMPERATURE_KELVIN_T aux_temp_kelvin;
LEP_RESULT result;
int lepton_connect() {
LEP_OpenPort(1, LEP_CCI_TWI, 400, &_port);
_connected = true;
return 0;
}
double lepton_temperature_fpa()
{
if(!_connected) {
lepton_connect();
}
result =((LEP_GetSysFpaTemperatureKelvin(&_port,&fpa_temp_kelvin)));
return (fpa_temp_kelvin-27315);
}
double lepton_temperature_aux()
{
if(!_connected) {
lepton_connect();
}
result =((LEP_GetSysAuxTemperatureKelvin(&_port,&aux_temp_kelvin)));
return (aux_temp_kelvin-27315);
}
void lepton_perform_ffc() {
if(!_connected) {
lepton_connect();
}
LEP_RunSysFFCNormalization(&_port);
}
void lepton_enable_agc()
{
if(!_connected) {
lepton_connect();}
result = LEP_GetAgcEnableState(&_port,&_eneb);
if(result!=LEP_OK)std::cout<<"not ok"<<std::endl;
result=LEP_SetAgcEnableState(&_port,LEP_AGC_ENABLE);
}
void lepton_disable_agc()
{
if(!_connected) {
lepton_connect();
}
result = LEP_GetAgcEnableState(&_port,&_eneb);
if(result!=LEP_OK)std::cout<<"not ok"<<std::endl;
result=LEP_SetAgcEnableState(&_port,LEP_AGC_DISABLE);
}
//presumably more commands could go here if desired