Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera #7

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
703 changes: 703 additions & 0 deletions .metadata/.ide.log

Large diffs are not rendered by default.

982 changes: 982 additions & 0 deletions .metadata/.log

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .metadata/.plugins/org.eclipse.cdt.core/.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
*** SESSION Feb 06, 2023 13:14:07.923 ------------------------------------------
*** SESSION Feb 06, 2023 14:02:52.561 ------------------------------------------
*** SESSION Feb 20, 2023 12:44:17.23 -------------------------------------------
*** SESSION Feb 27, 2023 12:39:01.678 ------------------------------------------
*** SESSION Mar 06, 2023 15:18:51.931 ------------------------------------------
*** SESSION Mar 22, 2023 12:25:49.547 ------------------------------------------
Binary file not shown.
3,032 changes: 3,025 additions & 7 deletions .metadata/.plugins/org.eclipse.cdt.ui/EuropaOS.build.log

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .metadata/.plugins/org.eclipse.cdt.ui/dialog_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@
</section>
<section name="org.eclipse.cdt.ui.text.hover.CMacroExpansionExploration">
</section>
<section name="CResourceRenameRefactoringInputPage">
<item key="updateReferences" value="true"/>
</section>
</section>
30,711 changes: 30,711 additions & 0 deletions .metadata/.plugins/org.eclipse.cdt.ui/global-build.log

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* i2c.c
*
* Created on: Mar 27, 2023
* Author: liams
*/
#include "i2c.h"

int i2c_wr_8(I2C_HandleTypeDef *i2c, uint8_t reg, uint8_t val) {
if ( HAL_I2C_Master_Transmit(i2c, reg, &(val), 8, TIMEOUT) != HAL_OK ) {
return 1;
} else {
return HAL_OK;
}
}

int i2c_wr_8_reg(I2C_HandleTypeDef *i2c, sensor_reg sensor_reg) {
if ( HAL_I2C_Master_Transmit(i2c, sensor_reg.reg, &(sensor_reg.val), 8, TIMEOUT) != HAL_OK ) {
return 1;
} else {
return HAL_OK;
}
}

int i2c_wr_8_regs(I2C_HandleTypeDef *i2c, sensor_reg sensor_regs[]) {
int err = 0;
uint16_t reg_addr = 0;
uint16_t reg_val = 0;
const struct sensor_reg *next = sensor_regs;
while((reg_addr != 0xff) | (reg_val != 0xff)) {
reg_addr = next->reg;
reg_val = next->val;
err = i2c_wr_8(i2c, (uint8_t)reg_addr, (uint8_t)reg_val);
if (err != HAL_OK) {
return 1;
}
}
return HAL_OK;
}

int i2c_wr_16(I2C_HandleTypeDef *i2c, uint16_t reg, uint16_t val) {
if ( HAL_I2C_Master_Transmit(i2c, reg, &(val), 16, TIMEOUT) != HAL_OK ) {
return 1;
} else {
return HAL_OK;
}
}

int i2c_wr_16_reg(I2C_HandleTypeDef *i2c, sensor_reg sensor_reg) {
if ( HAL_I2C_Master_Transmit(i2c, sensor_reg.reg, &(sensor_reg.val), 16, TIMEOUT) != HAL_OK ) {
return 1;
} else {
return HAL_OK;
}
}

int i2c_wr_16_regs(I2C_HandleTypeDef *i2c, sensor_reg sensor_regs[]) {
int err = 0;
uint16_t reg_addr = 0;
uint16_t reg_val = 0;
const struct sensor_reg *next = sensor_regs;
while((reg_addr != 0xffff) | (reg_val != 0xffff)) {
reg_addr = next->reg;
reg_val = next->val;
err = i2c_wr_16(i2c, reg_addr, reg_val);
if (err != HAL_OK) {
return 1;
}
}
return HAL_OK;
}
Loading