Skip to content

Commit

Permalink
old change
Browse files Browse the repository at this point in the history
  • Loading branch information
Luftalian committed Sep 18, 2023
1 parent 0403bd1 commit 23b9c8a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 49 deletions.
75 changes: 35 additions & 40 deletions src/infrastructure/spicreatehandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,60 @@

#include "../interfaces/database/spicreate_handler.h"

std::shared_ptr<SPICREATEHandlerDATABASE> NewSPICreate()
{
std::shared_ptr<SPICREATE::SPICreate> targetSPI = std::make_shared<SPICREATE::SPICreate>();
std::shared_ptr<SPICREATEHandlerDATABASE> targetSPICREATEHandlerDATABASE = std::make_shared<SPICREATEHandlerDATABASE>();
targetSPICREATEHandlerDATABASE->SPI = targetSPI;
return targetSPICREATEHandlerDATABASE;
std::shared_ptr<SPICREATEHandlerDATABASE> NewSPICreate() {
std::shared_ptr<SPICREATE::SPICreate> targetSPI =
std::make_shared<SPICREATE::SPICreate>();
std::shared_ptr<SPICREATEHandlerDATABASE> targetSPICREATEHandlerDATABASE =
std::make_shared<SPICREATEHandlerDATABASE>();
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);
}
19 changes: 10 additions & 9 deletions src/usecase/icm20948_interactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
#ifndef ICM20948_INTERACTOR_H
#define ICM20948_INTERACTOR_H

#include <memory>

#include "../domain/data.h"
#include "../usecase/icm20948_repository_usecase.h"
#include <memory>

class ICM20948Interactor
{
private:
std::shared_ptr<ICM20948Repository> icm20948Repository;
class ICM20948Interactor {
private:
std::shared_ptr<ICM20948Repository> icm20948Repository;

public:
ICM20948Interactor(std::shared_ptr<ICM20948Repository> icm20948Repository) : icm20948Repository(icm20948Repository) {}
public:
ICM20948Interactor(std::shared_ptr<ICM20948Repository> 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)
Expand Down

0 comments on commit 23b9c8a

Please sign in to comment.