Skip to content

Commit 0834fb4

Browse files
iabdalkadergiulcioffi
authored andcommitted
License update and misc bug fixes and refactoring.
1 parent 1059edb commit 0834fb4

File tree

6 files changed

+220
-204
lines changed

6 files changed

+220
-204
lines changed

Diff for: libraries/GC2145/gc2145.cpp

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
/*
2-
* TODO: Add license.
3-
* Copyright (c) 2021
2+
* Copyright 2021 Arduino SA
43
*
5-
* This work is licensed under <>, see the file LICENSE for details.
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
616
*
717
* GC2145 driver.
818
*/

Diff for: libraries/GC2145/gc2145.h

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
/*
2-
* TODO: Add license.
3-
* Copyright (c) 2021
2+
* Copyright 2021 Arduino SA
43
*
5-
* This work is licensed under <>, see the file LICENSE for details.
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
616
*
717
* GC2145 driver.
818
*/

Diff for: libraries/Himax_HM01B0/himax.cpp

+32-16
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
/*
2-
* TODO: Add license.
3-
* Copyright (c) 2021
2+
* Copyright 2021 Arduino SA
43
*
5-
* This work is licensed under <>, see the file LICENSE for details.
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
616
*
717
* HM01B0 driver.
818
*/
@@ -161,6 +171,7 @@ static uint16_t himax_default_regs[][2] = {
161171
{0x3059, 0x1E},
162172
{0x3064, 0x00},
163173
{0x3065, 0x04}, // pad pull 0
174+
{ANA_Register_17, 0x00}, // Disable internal oscillator
164175

165176
{BLC_CFG, 0x43}, // BLC_on, IIR
166177

@@ -191,13 +202,13 @@ static uint16_t himax_default_regs[][2] = {
191202
{0x2018, 0x9B},
192203

193204
{AE_CTRL, 0x01}, //Automatic Exposure
194-
{AE_TARGET_MEAN, 0x3C}, //AE target mean [Def: 0x3C]
205+
{AE_TARGET_MEAN, 0x64}, //AE target mean [Def: 0x3C]
195206
{AE_MIN_MEAN, 0x0A}, //AE min target mean [Def: 0x0A]
196207
{CONVERGE_IN_TH, 0x03}, //Converge in threshold [Def: 0x03]
197208
{CONVERGE_OUT_TH, 0x05}, //Converge out threshold [Def: 0x05]
198209
{MAX_INTG_H, (HIMAX_FRAME_LENGTH_QVGA-2)>>8}, //Maximum INTG High Byte [Def: 0x01]
199210
{MAX_INTG_L, (HIMAX_FRAME_LENGTH_QVGA-2)&0xFF}, //Maximum INTG Low Byte [Def: 0x54]
200-
{MAX_AGAIN_FULL, 0x03}, //Maximum Analog gain in full frame mode [Def: 0x03]
211+
{MAX_AGAIN_FULL, 0x04}, //Maximum Analog gain in full frame mode [Def: 0x03]
201212
{MAX_AGAIN_BIN2, 0x04}, //Maximum Analog gain in bin2 mode [Def: 0x04]
202213
{MAX_DGAIN, 0xC0},
203214

@@ -229,20 +240,20 @@ static uint16_t himax_default_regs[][2] = {
229240
{OSC_CLK_DIV, 0x0B},
230241
{IMG_ORIENTATION, 0x00}, // change the orientation
231242
{0x0104, 0x01},
232-
{0x0000, 0x00},
243+
{0x0000, 0x00}, // EOF
233244
};
234245

235-
static uint16_t himax_full_regs[][2] = { // 'full' resolution is 320x320
246+
static const uint16_t himax_full_regs[][2] = {
236247
{0x0383, 0x01},
237248
{0x0387, 0x01},
238249
{0x0390, 0x00},
239-
{QVGA_WIN_EN, 0x00}, // Disable QVGA window readout
250+
{QVGA_WIN_EN, 0x00},// Disable QVGA window readout
240251
{MAX_INTG_H, (HIMAX_FRAME_LENGTH_FULL-2)>>8},
241252
{MAX_INTG_L, (HIMAX_FRAME_LENGTH_FULL-2)&0xFF},
242253
{FRAME_LEN_LINES_H, (HIMAX_FRAME_LENGTH_FULL>>8)},
243254
{FRAME_LEN_LINES_L, (HIMAX_FRAME_LENGTH_FULL&0xFF)},
244-
{LINE_LEN_PCK_H, (HIMAX_FRAME_LENGTH_FULL>>8)},
245-
{LINE_LEN_PCK_L, (HIMAX_FRAME_LENGTH_FULL&0xFF)},
255+
{LINE_LEN_PCK_H, (HIMAX_LINE_LEN_PCK_FULL>>8)},
256+
{LINE_LEN_PCK_L, (HIMAX_LINE_LEN_PCK_FULL&0xFF)},
246257
{GRP_PARAM_HOLD, 0x01},
247258
};
248259

@@ -261,30 +272,35 @@ static regval_list_t himax_full_regs[] = { // 'full' resolution is 320x320
261272
{0x0000, 0x00}, // EOF
262273
};
263274

264-
static uint16_t himax_qvga_regs[][2] = {
275+
static const uint16_t himax_qvga_regs[][2] = {
265276
{0x0383, 0x01},
266277
{0x0387, 0x01},
267278
{0x0390, 0x00},
279+
{QVGA_WIN_EN, 0x01},// Enable QVGA window readout
268280
{MAX_INTG_H, (HIMAX_FRAME_LENGTH_QVGA-2)>>8},
269281
{MAX_INTG_L, (HIMAX_FRAME_LENGTH_QVGA-2)&0xFF},
270282
{FRAME_LEN_LINES_H, (HIMAX_FRAME_LENGTH_QVGA>>8)},
271283
{FRAME_LEN_LINES_L, (HIMAX_FRAME_LENGTH_QVGA&0xFF)},
272284
{LINE_LEN_PCK_H, (HIMAX_LINE_LEN_PCK_QVGA>>8)},
273285
{LINE_LEN_PCK_L, (HIMAX_LINE_LEN_PCK_QVGA&0xFF)},
274-
{0x0000, 0x00}, // EOF
286+
{GRP_PARAM_HOLD, 0x01},
287+
{0x0000, 0x00}, // EOF
288+
275289
};
276290

277-
static uint16_t himax_qqvga_regs[][2] = {
291+
static const uint16_t himax_qqvga_regs[][2] = {
278292
{0x0383, 0x03},
279293
{0x0387, 0x03},
280294
{0x0390, 0x03},
295+
{QVGA_WIN_EN, 0x01},// Enable QVGA window readout
281296
{MAX_INTG_H, (HIMAX_FRAME_LENGTH_QQVGA-2)>>8},
282297
{MAX_INTG_L, (HIMAX_FRAME_LENGTH_QQVGA-2)&0xFF},
283298
{FRAME_LEN_LINES_H, (HIMAX_FRAME_LENGTH_QQVGA>>8)},
284299
{FRAME_LEN_LINES_L, (HIMAX_FRAME_LENGTH_QQVGA&0xFF)},
285300
{LINE_LEN_PCK_H, (HIMAX_LINE_LEN_PCK_QQVGA>>8)},
286301
{LINE_LEN_PCK_L, (HIMAX_LINE_LEN_PCK_QQVGA&0xFF)},
287-
{0x0000, 0x00}, // EOF
302+
{GRP_PARAM_HOLD, 0x01},
303+
{0x0000, 0x00}, // EOF
288304
};
289305

290306
int HM01B0::Init()
@@ -314,7 +330,7 @@ int HM01B0::Reset()
314330
delay(1);
315331
} while (reg_read(HM01B0_I2C_ADDR, MODE_SELECT, true) != HIMAX_Standby && ((--max_timeout)>0) );
316332

317-
return max_timeout>0 ? 0: -1 ;
333+
return (max_timeout > 0) ? 0 : -1;
318334
}
319335

320336
int HM01B0::SetResolution(int32_t resolution)
@@ -447,7 +463,7 @@ uint8_t HM01B0::PrintRegs()
447463
for (uint32_t i=0; himax_default_regs[i][0]; i++) {
448464
printf("0x%04X: 0x%02X 0x%02X \n",
449465
himax_default_regs[i][0],
450-
himax_default_regs[i][0],
466+
himax_default_regs[i][1],
451467
reg_read(HM01B0_I2C_ADDR, himax_default_regs[i][0], true));
452468
}
453469
return 0;

Diff for: libraries/Himax_HM01B0/himax.h

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
/*
2-
* TODO: Add license.
3-
* Copyright (c) 2021
2+
* Copyright 2021 Arduino SA
43
*
5-
* This work is licensed under <>, see the file LICENSE for details.
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
616
*
717
* HM01B0 driver.
818
*/

0 commit comments

Comments
 (0)