Skip to content

Commit ec2eb39

Browse files
committed
Move implementation from SpiBusDevice.h to SpiBusDevice.cpp
1 parent d492b23 commit ec2eb39

File tree

4 files changed

+49
-15
lines changed

4 files changed

+49
-15
lines changed

src/spi/SpiBusDevice.cpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* This file is part of the Arduino_ThreadsafeIO library.
3+
* Copyright (c) 2021 Arduino SA.
4+
*
5+
* This library is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Lesser General Public
7+
* License as published by the Free Software Foundation; either
8+
* version 2.1 of the License, or (at your option) any later version.
9+
* This library is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
* Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public
15+
* License along with this library; if not, write to the Free Software
16+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
/**************************************************************************************
20+
* INCLUDE
21+
**************************************************************************************/
22+
23+
#include "SpiBusDevice.h"
24+
25+
#include "SpiDispatcher.h"
26+
27+
/**************************************************************************************
28+
* CTOR/DTOR
29+
**************************************************************************************/
30+
31+
SpiBusDevice::SpiBusDevice(SpiBusDeviceConfig const & config)
32+
: _config{config}
33+
{
34+
35+
}
36+
37+
/**************************************************************************************
38+
* PUBLIC MEMBER FUNCTIONS
39+
**************************************************************************************/
40+
41+
IoResponse SpiBusDevice::transfer(IoRequest & req)
42+
{
43+
return SpiDispatcher::instance().dispatch(&req, &_config);
44+
}

src/spi/SpiBusDevice.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,8 @@
2323
* INCLUDE
2424
**************************************************************************************/
2525

26-
#include <Arduino.h>
27-
#include <mbed.h>
28-
2926
#include "../BusDevice.h"
3027

31-
#include "SpiDispatcher.h"
3228
#include "SpiBusDeviceConfig.h"
3329

3430
/**************************************************************************************
@@ -39,15 +35,11 @@ class SpiBusDevice : public BusDeviceBase
3935
{
4036
public:
4137

42-
SpiBusDevice(SpiBusDeviceConfig const & config)
43-
: _config{config}
44-
{ }
38+
SpiBusDevice(SpiBusDeviceConfig const & config);
39+
virtual ~SpiBusDevice() { }
4540

4641

47-
virtual IoResponse transfer(IoRequest & req) override
48-
{
49-
return SpiDispatcher::instance().dispatch(&req, &_config);
50-
}
42+
virtual IoResponse transfer(IoRequest & req) override;
5143

5244

5345
private:

src/wire/WireBusDevice.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
#include "WireBusDevice.h"
2424

25+
#include "WireDispatcher.h"
26+
2527
/**************************************************************************************
2628
* CTOR/DTOR
2729
**************************************************************************************/

src/wire/WireBusDevice.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,8 @@
2323
* INCLUDE
2424
**************************************************************************************/
2525

26-
#include <Arduino.h>
27-
#include <mbed.h>
28-
2926
#include "../BusDevice.h"
3027

31-
#include "WireDispatcher.h"
3228
#include "WireBusDeviceConfig.h"
3329

3430
/**************************************************************************************

0 commit comments

Comments
 (0)