From 23b9c8a09a1b93191ace7d2a7ee3cd9f3cc26b91 Mon Sep 17 00:00:00 2001 From: Luftalian Date: Mon, 18 Sep 2023 22:48:50 +0900 Subject: [PATCH] old change --- src/infrastructure/spicreatehandler.cpp | 75 ++++++++++++------------- src/usecase/icm20948_interactor.h | 19 ++++--- 2 files changed, 45 insertions(+), 49 deletions(-) diff --git a/src/infrastructure/spicreatehandler.cpp b/src/infrastructure/spicreatehandler.cpp index 3579455..39479d4 100644 --- a/src/infrastructure/spicreatehandler.cpp +++ b/src/infrastructure/spicreatehandler.cpp @@ -2,65 +2,60 @@ #include "../interfaces/database/spicreate_handler.h" -std::shared_ptr NewSPICreate() -{ - std::shared_ptr targetSPI = std::make_shared(); - std::shared_ptr targetSPICREATEHandlerDATABASE = std::make_shared(); - targetSPICREATEHandlerDATABASE->SPI = targetSPI; - return targetSPICREATEHandlerDATABASE; +std::shared_ptr NewSPICreate() { + std::shared_ptr targetSPI = + std::make_shared(); + std::shared_ptr targetSPICREATEHandlerDATABASE = + std::make_shared(); + targetSPICREATEHandlerDATABASE->SPI = targetSPI; + return targetSPICREATEHandlerDATABASE; } -bool SPICREATEHandlerDATABASE::begin(uint8_t spi_bus, int8_t sck, int8_t miso, int8_t mosi, uint32_t f) -{ - return SPI->begin(spi_bus, sck, miso, mosi, f); +bool SPICREATEHandlerDATABASE::begin(uint8_t spi_bus, int8_t sck, int8_t miso, + int8_t mosi, uint32_t f) { + return SPI->begin(spi_bus, sck, miso, mosi, f); } -bool SPICREATEHandlerDATABASE::end() -{ - return SPI->end(); -} +bool SPICREATEHandlerDATABASE::end() { return SPI->end(); } -int SPICREATEHandlerDATABASE::addDevice(spi_device_interface_config_t *if_cfg, int cs) -{ - return SPI->addDevice(if_cfg, cs); +int SPICREATEHandlerDATABASE::addDevice(spi_device_interface_config_t *if_cfg, + int cs) { + return SPI->addDevice(if_cfg, cs); } -bool SPICREATEHandlerDATABASE::rmDevice(int deviceHandle) -{ - return SPI->rmDevice(deviceHandle); +bool SPICREATEHandlerDATABASE::rmDevice(int deviceHandle) { + return SPI->rmDevice(deviceHandle); } -uint8_t SPICREATEHandlerDATABASE::readByte(uint8_t addr, int deviceHandle) -{ - return SPI->readByte(addr, deviceHandle); +uint8_t SPICREATEHandlerDATABASE::readByte(uint8_t addr, int deviceHandle) { + return SPI->readByte(addr, deviceHandle); } -void SPICREATEHandlerDATABASE::sendCmd(uint8_t cmd, int deviceHandle) -{ - SPI->sendCmd(cmd, deviceHandle); +void SPICREATEHandlerDATABASE::sendCmd(uint8_t cmd, int deviceHandle) { + SPI->sendCmd(cmd, deviceHandle); } -void SPICREATEHandlerDATABASE::setReg(uint8_t addr, uint8_t data, int deviceHandle) -{ - SPI->setReg(addr, data, deviceHandle); +void SPICREATEHandlerDATABASE::setReg(uint8_t addr, uint8_t data, + int deviceHandle) { + SPI->setReg(addr, data, deviceHandle); } -void SPICREATEHandlerDATABASE::transmit(uint8_t *tx, int size, int deviceHandle) -{ - SPI->transmit(tx, size, deviceHandle); +void SPICREATEHandlerDATABASE::transmit(uint8_t *tx, int size, + int deviceHandle) { + SPI->transmit(tx, size, deviceHandle); } -void SPICREATEHandlerDATABASE::transmit(uint8_t *tx, uint8_t *rx, int size, int deviceHandle) -{ - SPI->transmit(tx, rx, size, deviceHandle); +void SPICREATEHandlerDATABASE::transmit(uint8_t *tx, uint8_t *rx, int size, + int deviceHandle) { + SPI->transmit(tx, rx, size, deviceHandle); } -void SPICREATEHandlerDATABASE::transmit(spi_transaction_t *transaction, int deviceHandle) -{ - SPI->transmit(transaction, deviceHandle); +void SPICREATEHandlerDATABASE::transmit(spi_transaction_t *transaction, + int deviceHandle) { + SPI->transmit(transaction, deviceHandle); } -void SPICREATEHandlerDATABASE::pollTransmit(spi_transaction_t *transaction, int deviceHandle) -{ - SPI->pollTransmit(transaction, deviceHandle); +void SPICREATEHandlerDATABASE::pollTransmit(spi_transaction_t *transaction, + int deviceHandle) { + SPI->pollTransmit(transaction, deviceHandle); } \ No newline at end of file diff --git a/src/usecase/icm20948_interactor.h b/src/usecase/icm20948_interactor.h index dd2c537..ed062a9 100644 --- a/src/usecase/icm20948_interactor.h +++ b/src/usecase/icm20948_interactor.h @@ -3,20 +3,21 @@ #ifndef ICM20948_INTERACTOR_H #define ICM20948_INTERACTOR_H +#include + #include "../domain/data.h" #include "../usecase/icm20948_repository_usecase.h" -#include -class ICM20948Interactor -{ -private: - std::shared_ptr icm20948Repository; +class ICM20948Interactor { + private: + std::shared_ptr icm20948Repository; -public: - ICM20948Interactor(std::shared_ptr icm20948Repository) : icm20948Repository(icm20948Repository) {} + public: + ICM20948Interactor(std::shared_ptr icm20948Repository) + : icm20948Repository(icm20948Repository) {} - bool AddData(uint8_t addr); - void GetData(int16_t *rx, uint8_t *rx_buf); + bool AddData(uint8_t addr); + void GetData(int16_t *rx, uint8_t *rx_buf); }; // bool ICM20948Interactor::AddData(uint8_t addr)