Skip to content

Commit

Permalink
refactor: fix violations of Sonar cpp:S3471 (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjaegers authored Jan 30, 2024
1 parent 2a952da commit 72cdaf9
Show file tree
Hide file tree
Showing 29 changed files with 122 additions and 122 deletions.
16 changes: 8 additions & 8 deletions hal_st/middlewares/ble_middleware/BondStorageSt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ namespace hal
explicit BondStorageSt(uint32_t maxNumberOfBonds);

// Implementation of BondStorage
virtual void BondStorageSynchronizerCreated(services::BondStorageSynchronizer& manager) override;
virtual void UpdateBondedDevice(hal::MacAddress address) override;
virtual void RemoveBond(hal::MacAddress address) override;
virtual void RemoveAllBonds() override;
virtual void RemoveBondIf(const infra::Function<bool(hal::MacAddress)>& onAddress) override;
virtual uint32_t GetMaxNumberOfBonds() const override;
virtual bool IsBondStored(hal::MacAddress address) const override;
virtual void IterateBondedDevices(const infra::Function<void(hal::MacAddress)>& onAddress) override;
void BondStorageSynchronizerCreated(services::BondStorageSynchronizer& manager) override;
void UpdateBondedDevice(hal::MacAddress address) override;
void RemoveBond(hal::MacAddress address) override;
void RemoveAllBonds() override;
void RemoveBondIf(const infra::Function<bool(hal::MacAddress)>& onAddress) override;
uint32_t GetMaxNumberOfBonds() const override;
bool IsBondStored(hal::MacAddress address) const override;
void IterateBondedDevices(const infra::Function<void(hal::MacAddress)>& onAddress) override;

private:
using BondStorageInternal = Bonded_Device_Entry_t[((BLE_EVT_MAX_PARAM_LEN - 3) - 2) / sizeof(Bonded_Device_Entry_t)];
Expand Down
2 changes: 1 addition & 1 deletion hal_st/stm32fxxx/BackupRamStm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace hal
: hal::BackupRam<volatile uint32_t>
{
public:
virtual infra::MemoryRange<volatile uint32_t> Get() const override;
infra::MemoryRange<volatile uint32_t> Get() const override;
};
}

Expand Down
4 changes: 2 additions & 2 deletions hal_st/stm32fxxx/CanStm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ namespace hal
~CanStm();

public:
virtual void SendData(Id id, const Message& data, const infra::Function<void(bool success)>& actionOnCompletion = infra::emptyFunction) override;
virtual void ReceiveData(const infra::Function<void(Id id, const Message& data)>& receivedAction) override;
void SendData(Id id, const Message& data, const infra::Function<void(bool success)>& actionOnCompletion = infra::emptyFunction) override;
void ReceiveData(const infra::Function<void(Id id, const Message& data)>& receivedAction) override;

private:
void HandleTxInterrupt();
Expand Down
4 changes: 2 additions & 2 deletions hal_st/stm32fxxx/DmaStm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ namespace hal
void StartReceiveDummy(uint16_t size);

protected:
virtual void OnInterrupt() override;
void OnInterrupt() override;

private:
DispatchedInterruptHandler interruptHandler;
Expand All @@ -100,7 +100,7 @@ namespace hal
void StartReceive(infra::ByteRange data);

protected:
virtual void OnInterrupt() override;
void OnInterrupt() override;

private:
ImmediateInterruptHandler interruptHandler;
Expand Down
8 changes: 4 additions & 4 deletions hal_st/stm32fxxx/EthernetMacStm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ namespace hal
EthernetMacStm(EthernetSmi& ethernetSmi, LinkSpeed linkSpeed, MacAddress macAddress);
~EthernetMacStm();

virtual void SendBuffer(infra::ConstByteRange data, bool last) override;
virtual void RetryAllocation() override;
virtual void AddMacAddressFilter(MacAddress address) override;
virtual void RemoveMacAddressFilter(MacAddress address) override;
void SendBuffer(infra::ConstByteRange data, bool last) override;
void RetryAllocation() override;
void AddMacAddressFilter(MacAddress address) override;
void RemoveMacAddressFilter(MacAddress address) override;

private:
void ResetDma();
Expand Down
2 changes: 1 addition & 1 deletion hal_st/stm32fxxx/EthernetSmiStm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace hal
~EthernetSmiStm();

public:
virtual uint16_t PhyAddress() const override;
uint16_t PhyAddress() const override;

private:
void RunPhy();
Expand Down
22 changes: 11 additions & 11 deletions hal_st/stm32fxxx/FlashInternalStm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ namespace hal
public:
FlashInternalStmBase(infra::ConstByteRange flashMemory);

virtual void WriteBuffer(infra::ConstByteRange buffer, uint32_t address, infra::Function<void()> onDone) override;
virtual void ReadBuffer(infra::ByteRange buffer, uint32_t address, infra::Function<void()> onDone) override;
virtual void EraseSectors(uint32_t beginIndex, uint32_t endIndex, infra::Function<void()> onDone) override;
void WriteBuffer(infra::ConstByteRange buffer, uint32_t address, infra::Function<void()> onDone) override;
void ReadBuffer(infra::ByteRange buffer, uint32_t address, infra::Function<void()> onDone) override;
void EraseSectors(uint32_t beginIndex, uint32_t endIndex, infra::Function<void()> onDone) override;

private:
template<typename alignment, uint32_t flashType>
Expand All @@ -32,10 +32,10 @@ namespace hal
public:
FlashInternalStm(infra::MemoryRange<uint32_t> sectorSizes, infra::ConstByteRange flashMemory);

virtual uint32_t NumberOfSectors() const override;
virtual uint32_t SizeOfSector(uint32_t sectorIndex) const override;
virtual uint32_t SectorOfAddress(uint32_t address) const override;
virtual uint32_t AddressOfSector(uint32_t sectorIndex) const override;
uint32_t NumberOfSectors() const override;
uint32_t SizeOfSector(uint32_t sectorIndex) const override;
uint32_t SectorOfAddress(uint32_t address) const override;
uint32_t AddressOfSector(uint32_t sectorIndex) const override;

private:
infra::MemoryRange<uint32_t> sectorSizes;
Expand All @@ -47,10 +47,10 @@ namespace hal
public:
FlashHomogeneousInternalStm(uint32_t numberOfSectors, uint32_t sizeOfEachSector, infra::ConstByteRange flashMemory);

virtual uint32_t NumberOfSectors() const override;
virtual uint32_t SizeOfSector(uint32_t sectorIndex) const override;
virtual uint32_t SectorOfAddress(uint32_t address) const override;
virtual uint32_t AddressOfSector(uint32_t sectorIndex) const override;
uint32_t NumberOfSectors() const override;
uint32_t SizeOfSector(uint32_t sectorIndex) const override;
uint32_t SectorOfAddress(uint32_t address) const override;
uint32_t AddressOfSector(uint32_t sectorIndex) const override;

private:
uint32_t numberOfSectors;
Expand Down
44 changes: 22 additions & 22 deletions hal_st/stm32fxxx/GpioStm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,16 @@ namespace hal
public:
GpioPinStm(Port port, uint8_t index, Drive drive = Drive::Default, Speed speed = Speed::Default, WeakPull weakPull = WeakPull::Default);

virtual bool Get() const override;
virtual void Set(bool value) override;
virtual bool GetOutputLatch() const override;
virtual void SetAsInput() override;
virtual bool IsInput() const override;
virtual void Config(PinConfigType config) override;
virtual void Config(PinConfigType config, bool startOutputState) override;
virtual void ResetConfig() override;
virtual void EnableInterrupt(const infra::Function<void()>& action, InterruptTrigger trigger) override;
virtual void DisableInterrupt() override;
bool Get() const override;
void Set(bool value) override;
bool GetOutputLatch() const override;
void SetAsInput() override;
bool IsInput() const override;
void Config(PinConfigType config) override;
void Config(PinConfigType config, bool startOutputState) override;
void ResetConfig() override;
void EnableInterrupt(const infra::Function<void()>& action, InterruptTrigger trigger) override;
void DisableInterrupt() override;

virtual void ConfigAnalog();
virtual void ConfigPeripheral(PinConfigTypeStm pinConfigType, uint8_t peripheral);
Expand All @@ -137,18 +137,18 @@ namespace hal
public:
DummyPinStm();

virtual bool Get() const override;
virtual void Set(bool value) override;
virtual bool GetOutputLatch() const override;
virtual void SetAsInput() override;
virtual bool IsInput() const override;
virtual void Config(PinConfigType config) override;
virtual void Config(PinConfigType config, bool startOutputState) override;
virtual void ResetConfig() override;
virtual void EnableInterrupt(const infra::Function<void()>& action, InterruptTrigger trigger) override;
virtual void DisableInterrupt() override;
virtual void ConfigAnalog() override;
virtual void ConfigPeripheral(PinConfigTypeStm pinConfigType, uint8_t peripheral) override;
bool Get() const override;
void Set(bool value) override;
bool GetOutputLatch() const override;
void SetAsInput() override;
bool IsInput() const override;
void Config(PinConfigType config) override;
void Config(PinConfigType config, bool startOutputState) override;
void ResetConfig() override;
void EnableInterrupt(const infra::Function<void()>& action, InterruptTrigger trigger) override;
void DisableInterrupt() override;
void ConfigAnalog() override;
void ConfigPeripheral(PinConfigTypeStm pinConfigType, uint8_t peripheral) override;
};

extern DummyPinStm dummyPinStm;
Expand Down
4 changes: 2 additions & 2 deletions hal_st/stm32fxxx/I2cStm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ namespace hal
I2cStm(uint8_t oneBasedI2cIndex, hal::GpioPinStm& scl, hal::GpioPinStm& sda, const Config& config = Config());
~I2cStm();

virtual void SendData(I2cAddress address, infra::ConstByteRange data, Action nextAction, infra::Function<void(Result, uint32_t numberOfBytesSent)> onSent) override;
virtual void ReceiveData(I2cAddress address, infra::ByteRange data, Action nextAction, infra::Function<void(Result)> onReceived) override;
void SendData(I2cAddress address, infra::ConstByteRange data, Action nextAction, infra::Function<void(Result, uint32_t numberOfBytesSent)> onSent) override;
void ReceiveData(I2cAddress address, infra::ByteRange data, Action nextAction, infra::Function<void(Result)> onReceived) override;

protected:
virtual void DeviceNotFound();
Expand Down
6 changes: 3 additions & 3 deletions hal_st/stm32fxxx/QuadSpiStm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ namespace hal
QuadSpiStm(GpioPinStm& clock, GpioPinStm& slaveSelect, GpioPinStm& data0, GpioPinStm& data1, GpioPinStm& data2, GpioPinStm& data3, const Config& config = Config());
~QuadSpiStm();

virtual void SendData(const Header& header, infra::ConstByteRange data, Lines lines, const infra::Function<void()>& actionOnCompletion) override;
virtual void ReceiveData(const Header& header, infra::ByteRange data, Lines lines, const infra::Function<void()>& actionOnCompletion) override;
virtual void PollStatus(const Header& header, uint8_t nofBytes, uint32_t match, uint32_t mask, Lines lines, const infra::Function<void()>& actionOnCompletion) override;
void SendData(const Header& header, infra::ConstByteRange data, Lines lines, const infra::Function<void()>& actionOnCompletion) override;
void ReceiveData(const Header& header, infra::ByteRange data, Lines lines, const infra::Function<void()>& actionOnCompletion) override;
void PollStatus(const Header& header, uint8_t nofBytes, uint32_t match, uint32_t mask, Lines lines, const infra::Function<void()>& actionOnCompletion) override;

private:
QSPI_CommandTypeDef CreateConfig(const Header& header, uint32_t dataSize, Lines lines);
Expand Down
6 changes: 3 additions & 3 deletions hal_st/stm32fxxx/QuadSpiStmDma.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ namespace hal
QuadSpiStmDma(hal::DmaStm& dma, GpioPinStm& clock, GpioPinStm& slaveSelect, GpioPinStm& data0, GpioPinStm& data1, GpioPinStm& data2, GpioPinStm& data3, const Config& config = Config());
~QuadSpiStmDma();

virtual void SendData(const Header& header, infra::ConstByteRange data, Lines lines, const infra::Function<void()>& actionOnCompletion) override;
virtual void ReceiveData(const Header& header, infra::ByteRange data, Lines lines, const infra::Function<void()>& actionOnCompletion) override;
virtual void PollStatus(const Header& header, uint8_t nofBytes, uint32_t match, uint32_t mask, Lines lines, const infra::Function<void()>& actionOnCompletion) override;
void SendData(const Header& header, infra::ConstByteRange data, Lines lines, const infra::Function<void()>& actionOnCompletion) override;
void ReceiveData(const Header& header, infra::ByteRange data, Lines lines, const infra::Function<void()>& actionOnCompletion) override;
void PollStatus(const Header& header, uint8_t nofBytes, uint32_t match, uint32_t mask, Lines lines, const infra::Function<void()>& actionOnCompletion) override;

private:
enum class FunctionalMode
Expand Down
4 changes: 2 additions & 2 deletions hal_st/stm32fxxx/RandomDataGeneratorStm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ namespace hal
RandomDataGeneratorStm();
~RandomDataGeneratorStm();

virtual void GenerateRandomData(infra::ByteRange result, const infra::Function<void()>& onDone) override;
void GenerateRandomData(infra::ByteRange result, const infra::Function<void()>& onDone) override;

private:
virtual void Invoke() override;
void Invoke() override;

private:
infra::ByteRange result;
Expand Down
2 changes: 1 addition & 1 deletion hal_st/stm32fxxx/ResetStm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace hal
: public Reset
{
public:
virtual void ResetModule(const char* resetReason) override;
void ResetModule(const char* resetReason) override;
};
}

Expand Down
8 changes: 4 additions & 4 deletions hal_st/stm32fxxx/SingleSpeedQuadSpiStmDma.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ namespace hal
public:
SingleSpeedQuadSpiStmDma(QuadSpiStmDma& quadSpi);

virtual void SendAndReceive(infra::ConstByteRange sendData, infra::ByteRange receiveData, SpiAction nextAction, const infra::Function<void()>& onDone) override;
virtual void SetChipSelectConfigurator(ChipSelectConfigurator& configurator) override;
virtual void SetCommunicationConfigurator(CommunicationConfigurator& configurator) override;
virtual void ResetCommunicationConfigurator() override;
void SendAndReceive(infra::ConstByteRange sendData, infra::ByteRange receiveData, SpiAction nextAction, const infra::Function<void()>& onDone) override;
void SetChipSelectConfigurator(ChipSelectConfigurator& configurator) override;
void SetCommunicationConfigurator(CommunicationConfigurator& configurator) override;
void ResetCommunicationConfigurator() override;

private:
void Done();
Expand Down
4 changes: 2 additions & 2 deletions hal_st/stm32fxxx/SpiDataSizeConfiguratorStm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace hal
public:
SpiDataSizeConfiguratorStm(SpiMasterStmDma& spi, uint32_t dataSize); // dataSize = SPI_DATASIZE_4BIT .. SPI_DATASIZE_16BIT

virtual void ActivateConfiguration() override;
virtual void DeactivateConfiguration() override;
void ActivateConfiguration() override;
void DeactivateConfiguration() override;

private:
SpiMasterStmDma& spi;
Expand Down
8 changes: 4 additions & 4 deletions hal_st/stm32fxxx/SpiMasterStm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ namespace hal

SpiMasterStm(uint8_t oneBasedSpiIndex, GpioPinStm& clock, GpioPinStm& miso, GpioPinStm& mosi, const Config& config = Config(), GpioPinStm& slaveSelect = dummyPinStm);

virtual void SendAndReceive(infra::ConstByteRange sendData, infra::ByteRange receiveData, SpiAction nextAction, const infra::Function<void()>& onDone) override;
virtual void SetChipSelectConfigurator(ChipSelectConfigurator& configurator) override;
virtual void SetCommunicationConfigurator(CommunicationConfigurator& configurator) override;
virtual void ResetCommunicationConfigurator() override;
void SendAndReceive(infra::ConstByteRange sendData, infra::ByteRange receiveData, SpiAction nextAction, const infra::Function<void()>& onDone) override;
void SetChipSelectConfigurator(ChipSelectConfigurator& configurator) override;
void SetCommunicationConfigurator(CommunicationConfigurator& configurator) override;
void ResetCommunicationConfigurator() override;

private:
void HandleInterrupt();
Expand Down
8 changes: 4 additions & 4 deletions hal_st/stm32fxxx/SpiMasterStmDma.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ namespace hal

SpiMasterStmDma(hal::DmaStm& dmaStm, uint8_t oneBasedSpiIndex, GpioPinStm& clock, GpioPinStm& miso, GpioPinStm& mosi, const Config& config = Config(), GpioPinStm& slaveSelect = dummyPinStm);

virtual void SendAndReceive(infra::ConstByteRange sendData, infra::ByteRange receiveData, SpiAction nextAction, const infra::Function<void()>& onDone) override;
virtual void SetChipSelectConfigurator(ChipSelectConfigurator& configurator) override;
virtual void SetCommunicationConfigurator(CommunicationConfigurator& configurator) override;
virtual void ResetCommunicationConfigurator() override;
void SendAndReceive(infra::ConstByteRange sendData, infra::ByteRange receiveData, SpiAction nextAction, const infra::Function<void()>& onDone) override;
void SetChipSelectConfigurator(ChipSelectConfigurator& configurator) override;
void SetCommunicationConfigurator(CommunicationConfigurator& configurator) override;
void ResetCommunicationConfigurator() override;

void SetDataSize(uint8_t dataSizeInBits);
uint8_t DataSize() const;
Expand Down
4 changes: 2 additions & 2 deletions hal_st/stm32fxxx/SpiSlaveStmDma.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ namespace hal

SpiSlaveStmDma(hal::DmaStm& dmaStm, uint8_t oneBasedSpiIndex, GpioPinStm& clock, GpioPinStm& miso, GpioPinStm& mosi, GpioPinStm& slaveSelect, const Config& config = Config());

virtual void SendAndReceive(infra::ConstByteRange sendData, infra::ByteRange receiveData, const infra::Function<void()>& onDone) override;
virtual bool CancelTransmission() override;
void SendAndReceive(infra::ConstByteRange sendData, infra::ByteRange receiveData, const infra::Function<void()>& onDone) override;
bool CancelTransmission() override;

private:
void SendAndReceive(infra::ConstByteRange sendData, infra::ByteRange receiveData);
Expand Down
2 changes: 1 addition & 1 deletion hal_st/stm32fxxx/SystemTickTimerService.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace hal
public:
SystemTickTimerService(infra::Duration tickDuration = std::chrono::milliseconds(1), uint32_t id = infra::systemTimerServiceId);

virtual infra::TimePoint Now() const override;
infra::TimePoint Now() const override;

private:
friend uint32_t ::HAL_GetTick();
Expand Down
6 changes: 3 additions & 3 deletions hal_st/stm32fxxx/UartStm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ namespace hal
#endif
~UartStm();

virtual void SendData(infra::MemoryRange<const uint8_t> data, infra::Function<void()> actionOnCompletion = infra::emptyFunction) override;
virtual void ReceiveData(infra::Function<void(infra::ConstByteRange data)> dataReceived) override;
void SendData(infra::MemoryRange<const uint8_t> data, infra::Function<void()> actionOnCompletion = infra::emptyFunction) override;
void ReceiveData(infra::Function<void(infra::ConstByteRange data)> dataReceived) override;

private:
void UartStmHalInit(const Config& config);
void RegisterInterrupt(const Config& config);
void TransferComplete();
virtual void Invoke() override;
void Invoke() override;

private:
uint8_t uartIndex;
Expand Down
6 changes: 3 additions & 3 deletions hal_st/stm32fxxx/UartStmDma.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ namespace hal
UartStmDma(hal::DmaStm& dmaStm, uint8_t uartIndex, GpioPinStm& uartTx, GpioPinStm& uartRx, GpioPinStm& uartRts, GpioPinStm& uartCts, const Config& config = Config());
~UartStmDma();

virtual void SendData(infra::MemoryRange<const uint8_t> data, infra::Function<void()> actionOnCompletion = infra::emptyFunction) override;
virtual void ReceiveData(infra::Function<void(infra::ConstByteRange data)> dataReceived) override;
void SendData(infra::MemoryRange<const uint8_t> data, infra::Function<void()> actionOnCompletion = infra::emptyFunction) override;
void ReceiveData(infra::Function<void(infra::ConstByteRange data)> dataReceived) override;

private:
void RegisterInterrupt(const Config& config);
void TransferComplete();
virtual void Invoke() override;
void Invoke() override;

private:
uint8_t uartIndex;
Expand Down
Loading

0 comments on commit 72cdaf9

Please sign in to comment.