Skip to content

Commit be2bf0e

Browse files
committed
style: fix lint issues
1 parent ef37462 commit be2bf0e

4 files changed

Lines changed: 12 additions & 11 deletions

File tree

app/firmware/src/io/i2c/peripherals/sensor_apds9960/instance/impl/common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#pragma once
77

88
#include <array>
9+
#include <cstddef>
910
#include <cstdint>
1011

1112
namespace opendeck::firmware::io::i2c::sensor_apds9960
@@ -73,6 +74,9 @@ namespace opendeck::firmware::io::i2c::sensor_apds9960
7374
constexpr inline uint8_t APDS9960_CONTROL_LED_DRIVE_SHIFT = 6;
7475
constexpr inline uint8_t APDS9960_CONTROL_PROXIMITY_GAIN_SHIFT = 2;
7576

77+
constexpr inline int64_t APDS9960_UPDATE_INTERVAL_MS = 30;
78+
constexpr inline size_t APDS9960_LIGHT_DATA_SIZE = 8;
79+
7680
constexpr inline uint8_t APDS9960_DEFAULT_ATIME = 246;
7781
constexpr inline uint8_t APDS9960_DEFAULT_WTIME = 246;
7882
constexpr inline uint8_t APDS9960_DEFAULT_PPULSE = 0x87;

app/firmware/src/io/i2c/peripherals/sensor_apds9960/instance/impl/mapper.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ Mapper::Result Mapper::proximity_result(uint8_t value) const
2626

2727
Mapper::Result Mapper::ambient_light_result(uint16_t value) const
2828
{
29-
const auto info = read_database_info();
30-
3129
return {
3230
.osc = {
3331
.payload = opendeck::firmware::signaling::OscSensorAmbientLightSignal{
@@ -40,8 +38,6 @@ Mapper::Result Mapper::ambient_light_result(uint16_t value) const
4038

4139
Mapper::Result Mapper::rgb_result(uint16_t red, uint16_t green, uint16_t blue) const
4240
{
43-
const auto info = read_database_info();
44-
4541
return {
4642
.osc = {
4743
.payload = opendeck::firmware::signaling::OscSensorRgbSignal{

app/firmware/src/io/i2c/peripherals/sensor_apds9960/instance/impl/sensor_apds9960.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ constexpr std::string_view SensorApds9960::name() const
174174

175175
int64_t SensorApds9960::update_interval_ms()
176176
{
177-
return 30;
177+
return APDS9960_UPDATE_INTERVAL_MS;
178178
}
179179

180180
std::span<const uint8_t> SensorApds9960::i2c_addresses() const
@@ -258,17 +258,17 @@ bool SensorApds9960::read_ambient_light_and_rgb(uint8_t status)
258258
return true;
259259
}
260260

261-
std::array<uint8_t, 8> light = {};
261+
std::array<uint8_t, APDS9960_LIGHT_DATA_SIZE> light = {};
262262

263263
if (!read_register_block(APDS9960_REGISTER_CDATAL, std::span<uint8_t>(light)))
264264
{
265265
return recoverable_i2c_read_failure();
266266
}
267267

268-
const auto ambient_light = sys_get_le16(&light[0]);
269-
const auto red = sys_get_le16(&light[2]);
270-
const auto green = sys_get_le16(&light[4]);
271-
const auto blue = sys_get_le16(&light[6]);
268+
const auto ambient_light = sys_get_le16(light.data());
269+
const auto red = sys_get_le16(light.data() + 2);
270+
const auto green = sys_get_le16(light.data() + 4);
271+
const auto blue = sys_get_le16(light.data() + 6);
272272

273273
if (ambient_light_enabled &&
274274
_ambient_light_filter.update({ ambient_light },

app/firmware/src/io/i2c/peripherals/sensor_vl53l4cx/instance/impl/sensor_vl53l4cx.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ namespace
2525
constexpr uint32_t RESPONSE_FAST_TIMING_BUDGET_US = 33333;
2626
constexpr uint32_t RESPONSE_BALANCED_TIMING_BUDGET_US = 66000;
2727
constexpr uint32_t RESPONSE_STABLE_TIMING_BUDGET_US = 100000;
28+
constexpr uint32_t MICROSECONDS_PER_MILLISECOND = 1000;
2829
constexpr int32_t SOFT_RESET_DELAY_MS = 100;
2930
constexpr uint8_t SOFT_RESET_ASSERTED = 0x00;
3031
constexpr uint8_t SOFT_RESET_RELEASED = 0x01;
@@ -59,7 +60,7 @@ namespace
5960

6061
const auto timing_budget_us = response_timing_budget_us(response);
6162

62-
return static_cast<int64_t>((timing_budget_us + SCAN_MARGIN) / 1000);
63+
return static_cast<int64_t>((timing_budget_us + SCAN_MARGIN) / MICROSECONDS_PER_MILLISECOND);
6364
}
6465

6566
constexpr VL53L4CX_DistanceModes driver_distance_mode(DistanceMode mode)

0 commit comments

Comments
 (0)