Skip to content

Commit ded541d

Browse files
authored
Merge pull request #40 from stevenewald/echavemann/recursive-format
Fix Formatting, Remove Lint
2 parents 2b28efe + 236b06b commit ded541d

File tree

8 files changed

+21
-25
lines changed

8 files changed

+21
-25
lines changed

.clang-format-ignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
src/scheduler/scheduler.cpp
2+
include/scheduler/scheduler.hpp

Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,8 @@ CPP_FILES := $(wildcard src/*.cpp include/*.hpp)
4949

5050
.PHONY: format
5151
format:
52-
clang-format -style=file -i $(CPP_FILES)
53-
54-
.PHONY: tidy
55-
tidy:
56-
clang-tidy $(CPP_FILES) -- -std=c++20
52+
find src include -name '*.cpp' -o -name '*.hpp' | xargs clang-format --style=file -i
5753

5854
.PHONY: lint
59-
lint: format tidy
55+
lint: format
6056

include/hal/i2c_controller.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
#pragma once
22

3-
namespace edge::aidan
4-
{
3+
namespace edge::aidan {
54

6-
class I2CController
7-
{
5+
class I2CController {
86
public:
97
~I2CController() = default;
108
static I2CController& get();
9+
1110
private:
1211
I2CController();
1312
};

include/hal/i2c_wrapper.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#pragma once
22

3-
#include <stdint.h>
4-
#include "nrf_twi_mngr.h"
53
#include "nrf_delay.h"
4+
#include "nrf_twi_mngr.h"
5+
6+
#include <stdint.h>
67

78
namespace edge::aidan {
89

include/scheduler/mpu.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace edge {
66
class MpuController {
7-
MpuController() { }
7+
MpuController() {}
88

99
~MpuController() { disable_mpu(); };
1010

src/hal/i2c_controller.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#include "hal/i2c_controller.hpp"
2+
23
#include "hal/i2c_wrapper.hpp"
3-
#include "nrf_drv_twi.h"
44
#include "microbit_v2.h"
5+
#include "nrf_drv_twi.h"
56
#include "nrf_twi.h"
67
#include "nrf_twi_mngr.h"
78

8-
namespace edge::aidan
9-
{
9+
namespace edge::aidan {
1010
static constexpr int QUEUE_SIZE = 1;
1111

1212
NRF_TWI_MNGR_DEF(twi_mngr, QUEUE_SIZE, 0);

src/hal/i2c_wrapper.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#include "hal/i2c_wrapper.hpp"
2+
23
#include "nrf_error.h"
34
#include "nrf_twi_mngr.h"
45
#include "sdk_errors.h"
56

67
namespace edge::aidan {
78

8-
99
NRF_TWI_MNGR_DEF(twi_mngr, 1, 0);
1010
static const nrf_twi_mngr_t* i2c_manager = &twi_mngr;
1111

@@ -17,8 +17,7 @@ uint8_t i2c_reg_read(uint8_t i2c_addr, uint8_t reg_addr)
1717
NRF_TWI_MNGR_READ(i2c_addr, &rx_buf, 1, NRF_TWI_MNGR_NO_STOP)
1818
};
1919
ret_code_t result = nrf_twi_mngr_perform(i2c_manager, NULL, read_transfer, 2, NULL);
20-
if (result != NRF_SUCCESS)
21-
{
20+
if (result != NRF_SUCCESS) {
2221
printf("I2C TRANSACTION FAILED!");
2322
}
2423
return rx_buf;
@@ -31,9 +30,9 @@ void i2c_reg_write(uint8_t i2c_addr, uint8_t reg_addr, uint8_t data)
3130
nrf_twi_mngr_transfer_t const write_transfer[] = {
3231
NRF_TWI_MNGR_WRITE(i2c_addr, &rx_buf, 2, NRF_TWI_MNGR_NO_STOP),
3332
};
34-
ret_code_t result = nrf_twi_mngr_perform(i2c_manager, NULL, write_transfer, 1, NULL);
35-
if (result != NRF_SUCCESS)
36-
{
33+
ret_code_t result =
34+
nrf_twi_mngr_perform(i2c_manager, NULL, write_transfer, 1, NULL);
35+
if (result != NRF_SUCCESS) {
3736
printf("I2C transaction failed! Error: %lX\n", result);
3837
}
3938
}
@@ -67,5 +66,4 @@ void lsm303agr_init()
6766
i2c_reg_write(LSM303AGR_ACC_ADDRESS, TEMP_CFG_REG_A, 0xC0);
6867
}
6968

70-
7169
} // namespace edge::aidan

src/user_programs/user_program_ipc_part_1.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
#include "userlib/syscalls.hpp"
21
#include "nrf52833.h"
32
#include "nrf_delay.h"
3+
#include "userlib/syscalls.hpp"
4+
45
#include <stdio.h>
56

67
void ipc_part1(void)
@@ -25,4 +26,3 @@ void ipc_part1(void)
2526
}
2627
}
2728
}
28-

0 commit comments

Comments
 (0)