APM:Libraries
CameraSensor_Mt9v117.h
Go to the documentation of this file.
1 /*
2  This program is free software: you can redistribute it and/or modify
3  it under the terms of the GNU General Public License as published by
4  the Free Software Foundation, either version 3 of the License, or
5  (at your option) any later version.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program. If not, see <http://www.gnu.org/licenses/>.
14  */
15 #pragma once
16 
17 #include <AP_HAL/I2CDevice.h>
18 
19 #include "AP_HAL_Linux.h"
20 #include "CameraSensor.h"
21 
22 namespace Linux {
23 
26 };
27 
28 struct mt9v117_patch {
29  uint8_t *data;
30  uint8_t size;
31 };
32 
33 #define MT9V117_PATCH_LINE_NUM 13
34 
36 public:
37  CameraSensor_Mt9v117(const char *device_path,
39  enum mt9v117_res res,
40  uint16_t nrst_gpio, uint32_t clock_freq);
41 
42 private:
43  static const struct mt9v117_patch _patch_lines[MT9V117_PATCH_LINE_NUM];
44 
45  uint8_t _read_reg8(uint16_t reg);
46  void _write_reg8(uint16_t reg, uint8_t val);
47  uint16_t _read_reg16(uint16_t reg);
48  void _write_reg16(uint16_t reg, uint16_t val);
49  void _write_reg32(uint16_t reg, uint32_t val);
50  inline uint16_t _var2reg(uint16_t var, uint16_t offset);
51  uint16_t _read_var16(uint16_t var, uint16_t offset);
52  void _write_var16(uint16_t var, uint16_t offset, uint16_t value);
53  uint8_t _read_var8(uint16_t var, uint16_t offset);
54  void _write_var8(uint16_t var, uint16_t offset, uint8_t value);
55  void _write_var32(uint16_t var, uint16_t offset, uint32_t value);
56  void _config_change();
57  void _itu656_enable();
58  void _soft_reset();
59  void _apply_patch();
60  void _set_basic_settings();
61  void _configure_sensor_qvga();
62  void _init_sensor();
63 
65  uint32_t _clock_freq;
66  uint16_t _nrst_gpio = 0xFFFF;
67  uint8_t _addr;
68 };
69 
70 }
static AP_HAL::OwnPtr< AP_HAL::Device > dev
Definition: ICM20789.cpp:16
AP_HAL::OwnPtr< AP_HAL::I2CDevice > _dev
#define MT9V117_PATCH_LINE_NUM
float value