Skip to content

Commit

Permalink
I2c device fix (#175)
Browse files Browse the repository at this point in the history
* i2c device fixes. Remove erroneously introduced call to `ROM_I2CSlaveDisable`
* Update log.c with an unrelated fix to clean up how the `log dump` command works
* Update format-commit.yml to try to make it more useful (manually triggered CI job)
  • Loading branch information
pwittich authored Feb 20, 2023
1 parent 5045342 commit 1c5ddde
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/format-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get changed files
- name: Get origin/master base ref
id: get-base-sha
run: |
echo "base_sha=$(git rev-parse "$(git merge-base origin/master "$(git rev-parse --abbrev-ref HEAD )")") >> $GITHUB_OUTPUT"
- name: Get changed files from origin/master
id: changed-files
uses: tj-actions/changed-files@v28.0.0
uses: tj-actions/changed-files@v35
with:
use_fork_point: true
base_sha: ${{ steps.get-base-sha.outputs.base_sha }}
files_ignore: |
**/*.yml
.clang*
Expand Down
1 change: 1 addition & 0 deletions common/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ void log_dump(void (*f)(const char *s))
{
f(b.data + b.last + 1);
f(b.data);
f("\033[0m\r\n"); // turn off color and add a newline to ensure that everything is cleaned up.
}

void ApolloLog(log_Event *ev)
Expand Down
4 changes: 2 additions & 2 deletions projects/cm_mcu/I2CSlaveTask.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ static uint8_t getSlaveData(uint8_t address)
case 0x0U: // reserved
value = testreg;
break;
case 0x10U: // MCU temperature
value = (uint8_t)getADCvalue(20) + 0.5f; // always valid
case 0x10U: // MCU temperature
value = (uint8_t)(getADCvalue(20) + 0.5f); // always valid
break;
case 0x12U: // FPGA F2 temp
value = (uint8_t)(local_fpga_f2 >= 0 ? fpga_args.pm_values[local_fpga_f2] : 0U);
Expand Down
2 changes: 0 additions & 2 deletions projects/cm_mcu/cm_mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ void SystemInitInterrupts(void)
#endif

// I2C slave
ROM_I2CSlaveDisable(I2C0_BASE); // I don't understand why this is neeeded

ROM_I2CSlaveAddressSet(I2C0_BASE, 0, I2C0_SLAVE_ADDRESS);

ROM_IntPrioritySet(INT_I2C0, configKERNEL_INTERRUPT_PRIORITY);
Expand Down

0 comments on commit 1c5ddde

Please sign in to comment.