Apply clang-format to all C++ files

This commit is contained in:
Finlay Davidson
2022-05-09 17:16:08 +02:00
committed by Riku Isokoski
parent 718fbdab98
commit 7f45538eb5
68 changed files with 477 additions and 381 deletions

View File

@@ -42,10 +42,16 @@ void Bma421::Init() {
if (ret != BMA4_OK)
return;
switch(bma.chip_id) {
case BMA423_CHIP_ID: deviceType = DeviceTypes::BMA421; break;
case BMA425_CHIP_ID: deviceType = DeviceTypes::BMA425; break;
default: deviceType = DeviceTypes::Unknown; break;
switch (bma.chip_id) {
case BMA423_CHIP_ID:
deviceType = DeviceTypes::BMA421;
break;
case BMA425_CHIP_ID:
deviceType = DeviceTypes::BMA425;
break;
default:
deviceType = DeviceTypes::Unknown;
break;
}
ret = bma423_write_config_file(&bma);

View File

@@ -6,11 +6,7 @@ namespace Pinetime {
class TwiMaster;
class Bma421 {
public:
enum class DeviceTypes : uint8_t {
Unknown,
BMA421,
BMA425
};
enum class DeviceTypes : uint8_t { Unknown, BMA421, BMA425 };
struct Values {
uint32_t steps;
int16_t x;

View File

@@ -80,14 +80,9 @@ Cst816S::TouchInfos Cst816S::GetTouchInfo() {
Gestures gesture = static_cast<Gestures>(touchData[gestureIndex]);
// Validity check
if(x >= maxX || y >= maxY ||
(gesture != Gestures::None &&
gesture != Gestures::SlideDown &&
gesture != Gestures::SlideUp &&
gesture != Gestures::SlideLeft &&
gesture != Gestures::SlideRight &&
gesture != Gestures::SingleTap &&
gesture != Gestures::DoubleTap &&
if (x >= maxX || y >= maxY ||
(gesture != Gestures::None && gesture != Gestures::SlideDown && gesture != Gestures::SlideUp && gesture != Gestures::SlideLeft &&
gesture != Gestures::SlideRight && gesture != Gestures::SingleTap && gesture != Gestures::DoubleTap &&
gesture != Gestures::LongPress)) {
info.isValid = false;
return info;

View File

@@ -44,21 +44,22 @@ namespace Pinetime {
uint8_t GetFwVersion() const {
return fwVersion;
}
private:
bool CheckDeviceIds();
// Unused/Unavailable commented out
static constexpr uint8_t gestureIndex = 1;
static constexpr uint8_t touchPointNumIndex = 2;
//static constexpr uint8_t touchEventIndex = 3;
// static constexpr uint8_t touchEventIndex = 3;
static constexpr uint8_t touchXHighIndex = 3;
static constexpr uint8_t touchXLowIndex = 4;
//static constexpr uint8_t touchIdIndex = 5;
// static constexpr uint8_t touchIdIndex = 5;
static constexpr uint8_t touchYHighIndex = 5;
static constexpr uint8_t touchYLowIndex = 6;
//static constexpr uint8_t touchStep = 6;
//static constexpr uint8_t touchXYIndex = 7;
//static constexpr uint8_t touchMiscIndex = 8;
// static constexpr uint8_t touchStep = 6;
// static constexpr uint8_t touchXYIndex = 7;
// static constexpr uint8_t touchMiscIndex = 8;
static constexpr uint8_t maxX = 240;
static constexpr uint8_t maxY = 240;

View File

@@ -3,18 +3,18 @@
namespace Pinetime {
namespace PinMap {
#ifdef WATCH_P8
// COLMI P8
static constexpr uint8_t Charging = 19;
static constexpr uint8_t Cst816sReset = 13;
static constexpr uint8_t Button = 17;
#else
// Pinetime
static constexpr uint8_t Charging = 12;
static constexpr uint8_t Cst816sReset = 10;
static constexpr uint8_t Button = 13;
#endif
#ifdef WATCH_P8
// COLMI P8
static constexpr uint8_t Charging = 19;
static constexpr uint8_t Cst816sReset = 13;
static constexpr uint8_t Button = 17;
#else
// Pinetime
static constexpr uint8_t Charging = 12;
static constexpr uint8_t Cst816sReset = 10;
static constexpr uint8_t Button = 13;
#endif
static constexpr uint8_t Cst816sIrq = 28;
static constexpr uint8_t PowerPresent = 19;

View File

@@ -10,7 +10,7 @@ SpiMaster::SpiMaster(const SpiMaster::SpiModule spi, const SpiMaster::Parameters
}
bool SpiMaster::Init() {
if(mutex == nullptr) {
if (mutex == nullptr) {
mutex = xSemaphoreCreateBinary();
ASSERT(mutex != nullptr);
}

View File

@@ -13,19 +13,13 @@ TwiMaster::TwiMaster(NRF_TWIM_Type* module, uint32_t frequency, uint8_t pinSda,
}
void TwiMaster::ConfigurePins() const {
NRF_GPIO->PIN_CNF[pinScl] =
(GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) |
(GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) |
(GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) |
(GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) |
(GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos);
NRF_GPIO->PIN_CNF[pinScl] = (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) |
(GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) | (GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) |
(GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos);
NRF_GPIO->PIN_CNF[pinSda] =
(GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) |
(GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) |
(GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) |
(GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) |
(GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos);
NRF_GPIO->PIN_CNF[pinSda] = (GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) |
(GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) | (GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) |
(GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos);
}
void TwiMaster::Init() {