Format Code Style Only

This commit is contained in:
Christophe De Wagter
2017-11-09 17:32:22 +01:00
parent 6fafcaaae9
commit a797fcbf33
3 changed files with 139 additions and 140 deletions
+7 -8
View File
@@ -201,18 +201,15 @@ static void write_reg(struct mt9v117_t *mt, uint16_t addr, uint32_t val, uint16_
// Fix sigdness based on length // Fix sigdness based on length
if (len == 1) { if (len == 1) {
mt->i2c_trans.buf[2] = val & 0xFF; mt->i2c_trans.buf[2] = val & 0xFF;
} } else if (len == 2) {
else if(len == 2) {
mt->i2c_trans.buf[2] = (val >> 8) & 0xFF; mt->i2c_trans.buf[2] = (val >> 8) & 0xFF;
mt->i2c_trans.buf[3] = val & 0xFF; mt->i2c_trans.buf[3] = val & 0xFF;
} } else if (len == 4) {
else if(len == 4) {
mt->i2c_trans.buf[2] = (val >> 24) & 0xFF; mt->i2c_trans.buf[2] = (val >> 24) & 0xFF;
mt->i2c_trans.buf[3] = (val >> 16) & 0xFF; mt->i2c_trans.buf[3] = (val >> 16) & 0xFF;
mt->i2c_trans.buf[4] = (val >> 8) & 0xFF; mt->i2c_trans.buf[4] = (val >> 8) & 0xFF;
mt->i2c_trans.buf[5] = val & 0xFF; mt->i2c_trans.buf[5] = val & 0xFF;
} } else {
else {
printf("[MT9V117] write_reg with incorrect length %d\r\n", len); printf("[MT9V117] write_reg with incorrect length %d\r\n", len);
} }
@@ -316,7 +313,8 @@ static inline void mt9v117_write_patch(struct mt9v117_t *mt)
} }
/* Configure the sensor */ /* Configure the sensor */
static inline void mt9v117_config(struct mt9v117_t *mt) { static inline void mt9v117_config(struct mt9v117_t *mt)
{
write_var(mt, MT9V117_CAM_CTRL_VAR, MT9V117_CAM_SENSOR_CFG_X_ADDR_START_OFFSET, 16, 2); write_var(mt, MT9V117_CAM_CTRL_VAR, MT9V117_CAM_SENSOR_CFG_X_ADDR_START_OFFSET, 16, 2);
write_var(mt, MT9V117_CAM_CTRL_VAR, MT9V117_CAM_SENSOR_CFG_X_ADDR_END_OFFSET, 663, 2); write_var(mt, MT9V117_CAM_CTRL_VAR, MT9V117_CAM_SENSOR_CFG_X_ADDR_END_OFFSET, 663, 2);
write_var(mt, MT9V117_CAM_CTRL_VAR, MT9V117_CAM_SENSOR_CFG_Y_ADDR_START_OFFSET, 8, 2); write_var(mt, MT9V117_CAM_CTRL_VAR, MT9V117_CAM_SENSOR_CFG_Y_ADDR_START_OFFSET, 8, 2);
@@ -397,7 +395,8 @@ void mt9v117_init(struct mt9v117_t *mt)
/* See if the device is there and correct */ /* See if the device is there and correct */
uint16_t chip_id = read_reg(mt, MT9V117_CHIP_ID, 2); uint16_t chip_id = read_reg(mt, MT9V117_CHIP_ID, 2);
if (chip_id != MT9V117_CHIP_ID_RESP) { if (chip_id != MT9V117_CHIP_ID_RESP) {
printf("[MT9V117] Didn't get correct response from CHIP_ID (expected: 0x%04X, got: 0x%04X)\r\n", MT9V117_CHIP_ID_RESP, chip_id); printf("[MT9V117] Didn't get correct response from CHIP_ID (expected: 0x%04X, got: 0x%04X)\r\n", MT9V117_CHIP_ID_RESP,
chip_id);
return; return;
} }
@@ -607,7 +607,8 @@ void image_show_flow(struct image_t *img, struct flow_t *vectors, uint16_t point
* @param[in] dx The gradient in x-direction * @param[in] dx The gradient in x-direction
* @param[in] dy The gradient in y-direction * @param[in] dy The gradient in y-direction
*/ */
void image_gradient_pixel(struct image_t *img, struct point_t *loc, int method, int *dx, int* dy) { void image_gradient_pixel(struct image_t *img, struct point_t *loc, int method, int *dx, int *dy)
{
// create the simple and sobel filter only once: // create the simple and sobel filter only once:
int gradient_x, gradient_y, index; int gradient_x, gradient_y, index;
@@ -637,8 +638,7 @@ void image_gradient_pixel(struct image_t *img, struct point_t *loc, int method,
gradient_y -= (int) img_buf[index + add_ind]; gradient_y -= (int) img_buf[index + add_ind];
index = (loc->y + 1) * img->w * pixel_width + loc->x * pixel_width; index = (loc->y + 1) * img->w * pixel_width + loc->x * pixel_width;
gradient_y += (int) img_buf[index + add_ind]; gradient_y += (int) img_buf[index + add_ind];
} } else {
else {
// ***** // *****
// Sobel // Sobel