Skip to content

Commit

Permalink
Fix Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
echavemann committed Dec 4, 2024
1 parent 2b28efe commit 236b06b
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 25 deletions.
2 changes: 2 additions & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/scheduler/scheduler.cpp
include/scheduler/scheduler.hpp
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,8 @@ CPP_FILES := $(wildcard src/*.cpp include/*.hpp)

.PHONY: format
format:
clang-format -style=file -i $(CPP_FILES)

.PHONY: tidy
tidy:
clang-tidy $(CPP_FILES) -- -std=c++20
find src include -name '*.cpp' -o -name '*.hpp' | xargs clang-format --style=file -i

.PHONY: lint
lint: format tidy
lint: format

7 changes: 3 additions & 4 deletions include/hal/i2c_controller.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#pragma once

namespace edge::aidan
{
namespace edge::aidan {

class I2CController
{
class I2CController {
public:
~I2CController() = default;
static I2CController& get();

private:
I2CController();
};
Expand Down
5 changes: 3 additions & 2 deletions include/hal/i2c_wrapper.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#pragma once

#include <stdint.h>
#include "nrf_twi_mngr.h"
#include "nrf_delay.h"
#include "nrf_twi_mngr.h"

#include <stdint.h>

namespace edge::aidan {

Expand Down
2 changes: 1 addition & 1 deletion include/scheduler/mpu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace edge {
class MpuController {
MpuController() { }
MpuController() {}

~MpuController() { disable_mpu(); };

Expand Down
6 changes: 3 additions & 3 deletions src/hal/i2c_controller.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include "hal/i2c_controller.hpp"

#include "hal/i2c_wrapper.hpp"
#include "nrf_drv_twi.h"
#include "microbit_v2.h"
#include "nrf_drv_twi.h"
#include "nrf_twi.h"
#include "nrf_twi_mngr.h"

namespace edge::aidan
{
namespace edge::aidan {
static constexpr int QUEUE_SIZE = 1;

NRF_TWI_MNGR_DEF(twi_mngr, QUEUE_SIZE, 0);
Expand Down
12 changes: 5 additions & 7 deletions src/hal/i2c_wrapper.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "hal/i2c_wrapper.hpp"

#include "nrf_error.h"
#include "nrf_twi_mngr.h"
#include "sdk_errors.h"

namespace edge::aidan {


NRF_TWI_MNGR_DEF(twi_mngr, 1, 0);
static const nrf_twi_mngr_t* i2c_manager = &twi_mngr;

Expand All @@ -17,8 +17,7 @@ uint8_t i2c_reg_read(uint8_t i2c_addr, uint8_t reg_addr)
NRF_TWI_MNGR_READ(i2c_addr, &rx_buf, 1, NRF_TWI_MNGR_NO_STOP)
};
ret_code_t result = nrf_twi_mngr_perform(i2c_manager, NULL, read_transfer, 2, NULL);
if (result != NRF_SUCCESS)
{
if (result != NRF_SUCCESS) {
printf("I2C TRANSACTION FAILED!");
}
return rx_buf;
Expand All @@ -31,9 +30,9 @@ void i2c_reg_write(uint8_t i2c_addr, uint8_t reg_addr, uint8_t data)
nrf_twi_mngr_transfer_t const write_transfer[] = {
NRF_TWI_MNGR_WRITE(i2c_addr, &rx_buf, 2, NRF_TWI_MNGR_NO_STOP),
};
ret_code_t result = nrf_twi_mngr_perform(i2c_manager, NULL, write_transfer, 1, NULL);
if (result != NRF_SUCCESS)
{
ret_code_t result =
nrf_twi_mngr_perform(i2c_manager, NULL, write_transfer, 1, NULL);
if (result != NRF_SUCCESS) {
printf("I2C transaction failed! Error: %lX\n", result);
}
}
Expand Down Expand Up @@ -67,5 +66,4 @@ void lsm303agr_init()
i2c_reg_write(LSM303AGR_ACC_ADDRESS, TEMP_CFG_REG_A, 0xC0);
}


} // namespace edge::aidan
4 changes: 2 additions & 2 deletions src/user_programs/user_program_ipc_part_1.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "userlib/syscalls.hpp"
#include "nrf52833.h"
#include "nrf_delay.h"
#include "userlib/syscalls.hpp"

#include <stdio.h>

void ipc_part1(void)
Expand All @@ -25,4 +26,3 @@ void ipc_part1(void)
}
}
}

0 comments on commit 236b06b

Please sign in to comment.