Skip to content

Commit

Permalink
style: remove extra semicolons
Browse files Browse the repository at this point in the history
  • Loading branch information
leon0399 committed Jul 30, 2024
1 parent d4b786d commit 2715fed
Show file tree
Hide file tree
Showing 17 changed files with 67 additions and 39 deletions.
2 changes: 1 addition & 1 deletion include/senseshift.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Application final : public IEventDispatcher {
[[nodiscard]] auto getVibroBody() const -> Body::Haptics::FloatBody*
{
return this->vibro_body_;
};
}

void postEvent(const IEvent* event) override;
void addEventListener(const IEventListener* listener) override;
Expand Down
2 changes: 1 addition & 1 deletion lib/arduino/senseshift/arduino/input/sensor/analog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AnalogSimpleSensor : public ::SenseShift::Input::IFloatSimpleSensor {
void init() override
{
pinMode(this->pin_, INPUT);
};
}

[[nodiscard]] inline auto getValue() -> float override
{
Expand Down
6 changes: 4 additions & 2 deletions lib/arduino/senseshift/arduino/input/sensor/digital.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ class DigitalSimpleSensor : public ::SenseShift::Input::IBinarySimpleSensor {
explicit DigitalSimpleSensor(
const std::uint8_t pin, const std::uint8_t mode = INPUT_PULLUP, const std::uint8_t inverted = LOW
) :
pin_(pin), mode_(mode), inverted_(inverted){};
pin_(pin), mode_(mode), inverted_(inverted)
{
}

void init() override
{
pinMode(this->pin_, this->mode_);
};
}

[[nodiscard]] auto getValue() -> bool override
{
Expand Down
4 changes: 3 additions & 1 deletion lib/arduino/senseshift/arduino/output/servo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
namespace SenseShift::Arduino::Output {
class ServoOutput : public ::SenseShift::Output::IFloatOutput {
public:
ServoOutput(size_t pin) : pin_(pin){};
ServoOutput(size_t pin) : pin_(pin)
{
}

void init() override
{
Expand Down
2 changes: 1 addition & 1 deletion lib/arduino_esp32/senseshift/arduino/output/ledc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class LedcOutput : public ::SenseShift::Output::IFloatOutput {
const auto duty = static_cast<std::uint32_t>(value * this->getMaxValue());
LOG_V(TAG, "GPIO %d - Writing %d to Channel %d", this->pin_, duty, this->channel_);
ledcWrite(this->pin_, duty);
};
}

private:
std::uint8_t pin_;
Expand Down
4 changes: 3 additions & 1 deletion lib/battery/senseshift/battery/battery.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ struct BatteryState {
class BatteryLevelEvent : public IEvent {
public:
const BatteryState& state;
BatteryLevelEvent(const BatteryState& state) : IEvent(OH_EVENT_BATTERY_LEVEL), state(state){};
BatteryLevelEvent(const BatteryState& state) : IEvent(OH_EVENT_BATTERY_LEVEL), state(state)
{
}
};
} // namespace SenseShift::Battery
12 changes: 6 additions & 6 deletions lib/bhaptics_ble/senseshift/bh/ble/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class LogOutputCharCallbacks : public BLECharacteristicCallbacks {
pCharacteristic->getValue().c_str(),
pCharacteristic->getValue().length()
);
};
}

void onRead(BLECharacteristic* pCharacteristic) override
{
Expand All @@ -67,7 +67,7 @@ class LogOutputCharCallbacks : public BLECharacteristicCallbacks {
pCharacteristic->getValue().c_str(),
pCharacteristic->getValue().length()
);
};
}

void onNotify(BLECharacteristic* pCharacteristic) override
{
Expand All @@ -77,7 +77,7 @@ class LogOutputCharCallbacks : public BLECharacteristicCallbacks {
pCharacteristic->getValue().c_str(),
pCharacteristic->getValue().length()
);
};
}

#if defined(SS_USE_NIMBLE) && SS_USE_NIMBLE == true
void onStatus(BLECharacteristic* pCharacteristic, Status s, int code) override
Expand All @@ -93,7 +93,7 @@ class LogOutputCharCallbacks : public BLECharacteristicCallbacks {
pCharacteristic->getValue().c_str(),
pCharacteristic->getValue().length()
);
};
}
};

class MotorCharCallbacks : public BLECharacteristicCallbacks {
Expand All @@ -111,7 +111,7 @@ class MotorCharCallbacks : public BLECharacteristicCallbacks {
std::string valueStr(value.begin(), value.end());

this->motorTransformer(valueStr);
};
}
};

class ConfigCharCallbacks : public BLECharacteristicCallbacks {
Expand All @@ -126,7 +126,7 @@ class ConfigCharCallbacks : public BLECharacteristicCallbacks {
auto byte_0 = value[0], byte_1 = value[1], byte_2 = value[2];

log_d(">>\tonWrite (Config Char): %3hhu %2hhu %2hhu", byte_0, byte_1, byte_2);
};
}
};

void Connection::begin()
Expand Down
8 changes: 4 additions & 4 deletions lib/bhaptics_ble/senseshift/bh/ble/connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ConnectionCallbacks {
virtual void postInit()
{
log_v("Default postInit");
};
}
};
static ConnectionCallbacks defaultCallback;

Expand All @@ -46,7 +46,7 @@ class Connection final : public IEventListener {
config(config), motorHandler(motorHandler), eventDispatcher(eventDispatcher)
{
this->eventDispatcher->addEventListener(this);
};
}

void begin(void);
void handleEvent(const IEvent* event) const override
Expand All @@ -63,7 +63,7 @@ class Connection final : public IEventListener {

return;
}
};
}

void setCallbacks(ConnectionCallbacks* pCallbacks)
{
Expand All @@ -72,7 +72,7 @@ class Connection final : public IEventListener {
} else {
this->callbacks = &defaultCallback;
}
};
}

private:
const ConnectionConfig& config;
Expand Down
10 changes: 5 additions & 5 deletions lib/freertos/senseshift/freertos/task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,18 @@ class Task {
explicit Task(TaskConfig& config) : taskConfig(config)
{
log_i("creating ComponentUpdateTask: %s", taskConfig.name);
};
}
virtual ~Task()
{
if (taskHandle) {
vTaskDelete(taskHandle);
}
};
}

TaskHandle_t getHandle() const
{
return taskHandle;
};
}

virtual void begin()
{
Expand All @@ -77,7 +77,7 @@ class Task {
if (!taskHandle) {
log_e("Failed to create task %s", this->taskConfig.name);
}
};
}

protected:
inline void monitorTask()
Expand Down Expand Up @@ -130,7 +130,7 @@ class ComponentUpdateTask : public Task<ComponentUpdateTask<Tp>> {
Task<ComponentUpdateTask>(taskConfig), component_(component), updateDelay_(updateDelay)
{
log_i("creating ComponentUpdateTask: %s", taskConfig.name);
};
}

void begin() override
{
Expand Down
2 changes: 1 addition & 1 deletion lib/haptics/senseshift/body/haptics/interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class VibroEffectData {
[[nodiscard]] constexpr inline auto getIntensity() const -> Intensity
{
return intensity_;
};
}

private:
Intensity intensity_ = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ namespace SenseShift::Output {
template<typename T, std::uint16_t MAX_INTENSITY>
class I2CDevLibContribPWMOutput : public ::SenseShift::Output::IFloatOutput {
public:
I2CDevLibContribPWMOutput(T& driver, const std::uint8_t num) : driver_(driver), channel_(num){};
I2CDevLibContribPWMOutput(T& driver, const std::uint8_t num) : driver_(driver), channel_(num)
{
}

void init() override
{
Expand Down
8 changes: 6 additions & 2 deletions lib/io/senseshift/input/filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ class IFiltered {
template<typename Tp>
class AddFilter : public IFilter<Tp> {
public:
explicit AddFilter(Tp offset) : offset_(offset){};
explicit AddFilter(Tp offset) : offset_(offset)
{
}

auto filter(ISimpleSensor<Tp>* /*sensor*/, Tp value) -> Tp override
{
Expand All @@ -65,7 +67,9 @@ class AddFilter : public IFilter<Tp> {
template<typename Tp>
class SubtractFilter : public IFilter<Tp> {
public:
explicit SubtractFilter(Tp offset) : offset_(offset){};
explicit SubtractFilter(Tp offset) : offset_(offset)
{
}

auto filter(ISimpleSensor<Tp>* /*sensor*/, Tp value) -> Tp override
{
Expand Down
12 changes: 9 additions & 3 deletions lib/math/senseshift/math/point2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ struct Point2 {

Tp x, y;

constexpr Point2() : x(static_cast<Tp>(0)), y(static_cast<Tp>(0)){};
constexpr Point2(Tp x, Tp y) : x(x), y(y){};
constexpr Point2(const Point2<Tp>& v) : x((Tp) v.x), y((Tp) v.y){};
constexpr Point2() : x(static_cast<Tp>(0)), y(static_cast<Tp>(0))
{
}
constexpr Point2(Tp x, Tp y) : x(x), y(y)
{
}
constexpr Point2(const Point2<Tp>& v) : x((Tp) v.x), y((Tp) v.y)
{
}

constexpr inline auto operator==(const Point2<Tp>& rhs) const -> bool
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ class OpenGlovesForceFeedbackComponent : public SenseShift::Component {
OpenGlovesForceFeedbackComponent(
OutputWriters& output_writers, ::SenseShift::OpenGloves::ITransport* communication
) :
output_writers_(output_writers), communication_(communication){};
output_writers_(output_writers), communication_(communication)
{
}

void init() override
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
namespace SenseShift::OpenGloves {
class Plotter {
public:
Plotter(Print* output, char* prefix) : output_(output), prefix_(prefix){};
Plotter(Print* output, char* prefix) : output_(output), prefix_(prefix)
{
}

void plot(const og::InputPeripheralData data)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ class IStreamTransport : public ITransport {
std::array<char, 256> buffer_{};

public:
IStreamTransport(Stream* channel) : channel(channel){};
IStreamTransport(Stream* channel) : channel(channel)
{
}

auto send(const char* buffer, size_t length) -> size_t override
{
Expand Down Expand Up @@ -53,8 +55,12 @@ class IStreamTransport : public ITransport {

class StreamTransport : public IStreamTransport {
public:
explicit StreamTransport(Stream& channel) : IStreamTransport(&channel){};
explicit StreamTransport(Stream* channel) : IStreamTransport(channel){};
explicit StreamTransport(Stream& channel) : IStreamTransport(&channel)
{
}
explicit StreamTransport(Stream* channel) : IStreamTransport(channel)
{
}

void init() override
{
Expand Down
10 changes: 5 additions & 5 deletions test/test_io_sensor/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ class TestAnalogCountingSensor : public ISimpleSensor<int> {
void init() override
{
this->setupCounter++;
};
}

auto getValue() -> int override
{
return ++this->count;
};
}
};

class TestAnalogSensor : public ISimpleSensor<int> {
Expand Down Expand Up @@ -79,15 +79,15 @@ class DummyCalibrator : public ::SenseShift::Input::Calibration::ICalibrator<flo
{
this->resetCounter++;
this->calibrated = 0.0f;
};
}
void update(float input) override
{
this->calibrated = input;
};
}
float calibrate(float input) const override
{
return calibrated;
};
}
};

void test_calibrated_sensor(void)
Expand Down

0 comments on commit 2715fed

Please sign in to comment.