MLX90640_API.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /**
  2. * @copyright (C) 2017 Melexis N.V.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17. #ifndef _MLX640_API_H_
  18. #define _MLX640_API_H_
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. #include "main.h"
  23. #define SCALEALPHA 0.000001f
  24. #define FPS0_5HZ 0x00
  25. #define FPS1HZ 0x01
  26. #define FPS2HZ 0x02
  27. #define FPS4HZ 0x03
  28. #define FPS8HZ 0x04
  29. #define FPS16HZ 0x05
  30. #define FPS32HZ 0x06
  31. #define MLX90640_ADDR 0x33
  32. #define RefreshRate0HZ FPS0_5HZ
  33. #define RefreshRate8HZ FPS8HZ
  34. #define RefreshRate1HZ FPS1HZ
  35. #define TA_SHIFT 8 // Default shift for MLX90640 in open air
  36. typedef struct
  37. {
  38. int16_t kVdd;
  39. int16_t vdd25;
  40. float KvPTAT;
  41. float KtPTAT;
  42. uint16_t vPTAT25;
  43. float alphaPTAT;
  44. int16_t gainEE;
  45. float tgc;
  46. float cpKv;
  47. float cpKta;
  48. uint8_t resolutionEE;
  49. uint8_t calibrationModeEE;
  50. float KsTa;
  51. float ksTo[5];
  52. int16_t ct[5];
  53. float alpha[768];
  54. uint8_t alphaScale;
  55. int16_t offset[768];
  56. float kta[768];
  57. uint8_t ktaScale;
  58. float kv[768];
  59. uint8_t kvScale;
  60. float cpAlpha[2];
  61. int16_t cpOffset[2];
  62. float ilChessC[3];
  63. uint16_t brokenPixels[5];
  64. uint16_t outlierPixels[5];
  65. } paramsMLX90640;
  66. int MLX90640_DumpEE(uint8_t slaveAddr, uint16_t *eeData);
  67. int MLX90640_GetFrameData(uint8_t slaveAddr, uint16_t *frameData);
  68. int MLX90640_ExtractParameters(uint16_t *eeData, paramsMLX90640 *mlx90640);
  69. float MLX90640_GetVdd(uint16_t *frameData, const paramsMLX90640 *params);
  70. float MLX90640_GetTa(uint16_t *frameData, const paramsMLX90640 *params);
  71. void MLX90640_GetImage(uint16_t *frameData, const paramsMLX90640 *params, float *result);
  72. void MLX90640_CalculateTo(uint16_t *frameData, const paramsMLX90640 *params, float emissivity, float tr, float *result);
  73. int MLX90640_SetResolution(uint8_t slaveAddr, uint8_t resolution);
  74. int MLX90640_GetCurResolution(uint8_t slaveAddr);
  75. int MLX90640_SetRefreshRate(uint8_t slaveAddr, uint8_t refreshRate);
  76. int MLX90640_GetRefreshRate(uint8_t slaveAddr);
  77. int MLX90640_GetSubPageNumber(uint16_t *frameData);
  78. int MLX90640_GetCurMode(uint8_t slaveAddr);
  79. int MLX90640_SetInterleavedMode(uint8_t slaveAddr);
  80. int MLX90640_SetChessMode(uint8_t slaveAddr);
  81. void MLX90640_BadPixelsCorrection(uint16_t *pixels, float *to, int mode, paramsMLX90640 *params);
  82. #ifdef __cplusplus
  83. }
  84. #endif
  85. #endif