Advertisement
Guest User

Lepton_I2C.c

a guest
May 17th, 2015
1,940
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.15 KB | None | 0 0
  1. #include <stdio.h>
  2. #include "Lepton_I2C.h"
  3. #include "leptonSDKEmb32PUB/LEPTON_SDK.h"
  4. #include "leptonSDKEmb32PUB/LEPTON_SYS.h"
  5. #include "leptonSDKEmb32PUB/LEPTON_Types.h"
  6.  
  7. bool _connected;
  8.  
  9. LEP_CAMERA_PORT_DESC_T _port;
  10. LEP_SYS_FPA_TEMPERATURE_KELVIN_T fpa_temp_kelvin;
  11. LEP_SYS_AUX_TEMPERATURE_KELVIN_T aux_temp_kelvin;
  12. LEP_RESULT result;
  13.  
  14. int lepton_connect() {
  15.         result = LEP_OpenPort(1, LEP_CCI_TWI, 400, &_port);
  16.         _connected = true;
  17.         printf("Connected, code: %i\n", result);
  18.         return 0;
  19. }
  20.  
  21. void lepton_temperature() {
  22.         if(!_connected) {
  23.                 lepton_connect();
  24.         }
  25.         result = LEP_GetSysFpaTemperatureKelvin(&_port, &fpa_temp_kelvin);
  26.         printf("FPA temp kelvin: %u , code %i\n", fpa_temp_kelvin, result);
  27.  
  28.         result = LEP_GetSysAuxTemperatureKelvin(&_port, &aux_temp_kelvin);
  29.         printf("Aux temp kelvin: %u , code %i\n", aux_temp_kelvin, result);
  30. }
  31.  
  32. void lepton_perform_ffc() {
  33.         if(!_connected) {
  34.                 lepton_connect();
  35.         }
  36.         LEP_RunSysFFCNormalization(&_port);
  37. }
  38.  
  39.  
  40. int main(int argc, char *argv[])
  41. {
  42. lepton_temperature();
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement