Skip to content

Commit b322bb8

Browse files
committed
Merge branch 'feat/icm42670-imu' of github.com:esp-cpp/espp into feat/icm42670-imu
2 parents 6443bef + 724c292 commit b322bb8

File tree

2 files changed

+7
-23
lines changed

2 files changed

+7
-23
lines changed

components/codec/es8311/es8311.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ static read_register_fn i2c_read_register_ = nullptr;
3232
void set_es8311_write(write_fn fn) { i2c_write_ = fn; }
3333
void set_es8311_read(read_register_fn fn) { i2c_read_register_ = fn; }
3434

35-
#if !defined(BIT)
36-
#define BIT(x) (1U << (x))
37-
#endif
35+
static inline int BIT(int n) { return 1 << n; }
3836

3937
/* ES8311 address
4038
* 0x32:CE=1;0x30:CE=0

components/display_drivers/include/sh8601.hpp

+6-20
Original file line numberDiff line numberDiff line change
@@ -114,20 +114,6 @@ class Sh8601 {
114114
// Initialize display pins
115115
display_drivers::init_pins(reset_pin_, dc_pin_, config.reset_value);
116116

117-
uint8_t madctl = 0;
118-
if (swap_color_order_) {
119-
madctl |= LCD_CMD_BGR_BIT;
120-
}
121-
if (mirror_x_) {
122-
madctl |= LCD_CMD_MX_BIT;
123-
}
124-
if (mirror_y_) {
125-
madctl |= LCD_CMD_MY_BIT;
126-
}
127-
if (swap_xy_) {
128-
madctl |= LCD_CMD_MV_BIT;
129-
}
130-
131117
auto init_cmds = std::to_array<display_drivers::DisplayInitCmd<Command>>({
132118
{Command::slpout, {}, 120}, // sleep out
133119
{Command::noron}, // normal mode
@@ -153,16 +139,16 @@ class Sh8601 {
153139
*/
154140
static void rotate(const DisplayRotation &rotation) {
155141
uint8_t data = 0;
156-
if (swap_color_order_) {
142+
if (swap_color_order_) { // cppcheck-suppress knownConditionTrueFalse
157143
data |= LCD_CMD_BGR_BIT;
158144
}
159-
if (mirror_x_) {
145+
if (mirror_x_) { // cppcheck-suppress knownConditionTrueFalse
160146
data |= LCD_CMD_MX_BIT;
161147
}
162-
if (mirror_y_) {
148+
if (mirror_y_) { // cppcheck-suppress knownConditionTrueFalse
163149
data |= LCD_CMD_MY_BIT;
164150
}
165-
if (swap_xy_) {
151+
if (swap_xy_) { // cppcheck-suppress knownConditionTrueFalse
166152
data |= LCD_CMD_MV_BIT;
167153
}
168154

@@ -171,7 +157,7 @@ class Sh8601 {
171157
break;
172158
case DisplayRotation::PORTRAIT:
173159
// flip the mx and mv bits (xor)
174-
if (mirror_portrait_) {
160+
if (mirror_portrait_) { // cppcheck-suppress knownConditionTrueFalse
175161
data ^= (LCD_CMD_MX_BIT | LCD_CMD_MV_BIT);
176162
} else {
177163
data ^= (LCD_CMD_MY_BIT | LCD_CMD_MV_BIT);
@@ -183,7 +169,7 @@ class Sh8601 {
183169
break;
184170
case DisplayRotation::PORTRAIT_INVERTED:
185171
// flip the my and mv bits (xor)
186-
if (mirror_portrait_) {
172+
if (mirror_portrait_) { // cppcheck-suppress knownConditionTrueFalse
187173
data ^= (LCD_CMD_MY_BIT | LCD_CMD_MV_BIT);
188174
} else {
189175
data ^= (LCD_CMD_MX_BIT | LCD_CMD_MV_BIT);

0 commit comments

Comments
 (0)