テスト用のあれこれ共用フォルダ
Revision | 08e08da601f41867921e53c5728818a0c56f01c5 (tree) |
---|---|
Time | 2019-02-04 18:42:39 |
Author | takemasa <suikan@user...> |
Commiter | takemasa |
Refactoring the name of the class
@@ -82,12 +82,12 @@ struct Platform | ||
82 | 82 | UartStrategy * uart_console; ///< UART wrapping class object for debugging |
83 | 83 | AbstractLogger * logger; ///< logging class object for debugger |
84 | 84 | |
85 | - AbstractBitOut * led; ///< GP out under test | |
85 | + BitOutStrategy * led; ///< GP out under test | |
86 | 86 | UartStrategy * uart; ///< UART under test |
87 | 87 | AbstractSpiMaster * spiMaster; ///< SPI Master under test |
88 | 88 | AbstractSpiSlave * spiSlave; ///< SPI Slave under test |
89 | - AbstractI2CMaster * i2cMaster; ///< I2C Master under test | |
90 | - AbstractI2cSlave * i2cSlave; ///< I2C Slave under test | |
89 | + I2CMasterStrategy * i2cMaster; ///< I2C Master under test | |
90 | + I2cSlaveStrategy * i2cSlave; ///< I2C Slave under test | |
91 | 91 | |
92 | 92 | TaskStrategy * task1; ///< Task under test |
93 | 93 |
@@ -13,9 +13,9 @@ | ||
13 | 13 | #ifdef HAL_I2C_MODULE_ENABLED |
14 | 14 | |
15 | 15 | namespace murasaki { |
16 | -Adau1361::Adau1361(unsigned int fs, murasaki::AbstractI2CMaster * controler, | |
16 | +Adau1361::Adau1361(unsigned int fs, murasaki::I2CMasterStrategy * controler, | |
17 | 17 | unsigned int i2c_device_addr) : |
18 | - AbstractAudioCodec(fs), i2c_(controler), device_addr_(i2c_device_addr) { | |
18 | + AudioCodecStrategy(fs), i2c_(controler), device_addr_(i2c_device_addr) { | |
19 | 19 | } |
20 | 20 | |
21 | 21 |
@@ -8,9 +8,9 @@ | ||
8 | 8 | #ifndef MURASAKI_TP_ADAU1361_HPP_ |
9 | 9 | #define MURASAKI_TP_ADAU1361_HPP_ |
10 | 10 | |
11 | +#include <audiocodecstrategy.hpp> | |
11 | 12 | #include "i2cmaster.hpp" |
12 | 13 | |
13 | -#include <abstractaudiocodec.hpp> | |
14 | 14 | |
15 | 15 | #ifdef HAL_I2C_MODULE_ENABLED |
16 | 16 |
@@ -25,7 +25,7 @@ namespace murasaki { | ||
25 | 25 | * \brief Audio Codec LSI class |
26 | 26 | */ |
27 | 27 | |
28 | -class Adau1361: public AbstractAudioCodec { | |
28 | +class Adau1361: public AudioCodecStrategy { | |
29 | 29 | public: |
30 | 30 | /** |
31 | 31 | * \brief constructor. |
@@ -35,7 +35,7 @@ public: | ||
35 | 35 | * \details |
36 | 36 | * initialize the internal variables. |
37 | 37 | */ |
38 | - Adau1361(unsigned int fs, murasaki::AbstractI2CMaster * controler, | |
38 | + Adau1361(unsigned int fs, murasaki::I2CMasterStrategy * controler, | |
39 | 39 | unsigned int i2c_device_addr); |
40 | 40 | |
41 | 41 | /** |
@@ -99,7 +99,7 @@ public: | ||
99 | 99 | bool mute = false); |
100 | 100 | |
101 | 101 | protected: |
102 | - murasaki::AbstractI2CMaster * const i2c_; | |
102 | + murasaki::I2CMasterStrategy * const i2c_; | |
103 | 103 | const unsigned int device_addr_; |
104 | 104 | |
105 | 105 | /** |
@@ -24,7 +24,7 @@ public: | ||
24 | 24 | * \details |
25 | 25 | * initialize the internal variables. |
26 | 26 | */ |
27 | - UmbAdau1361(unsigned int fs, murasaki::AbstractI2CMaster * controler, | |
27 | + UmbAdau1361(unsigned int fs, murasaki::I2CMasterStrategy * controler, | |
28 | 28 | unsigned int addr) : |
29 | 29 | Adau1361( fs, controler, addr ) {}; |
30 | 30 | protected: |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /** |
2 | - * @file abstractaudiocodec.hpp | |
2 | + * @file audiocodecstrategy.hpp | |
3 | 3 | * |
4 | 4 | * @date 2018/05/11 |
5 | 5 | * @author: takemasa |
@@ -16,7 +16,7 @@ namespace murasaki { | ||
16 | 16 | * \details |
17 | 17 | * This class is template for all codec classes |
18 | 18 | */ |
19 | -class AbstractAudioCodec | |
19 | +class AudioCodecStrategy | |
20 | 20 | { |
21 | 21 | public: |
22 | 22 | /** |
@@ -25,8 +25,8 @@ public: | ||
25 | 25 | * \details |
26 | 26 | * initialize the internal variables. |
27 | 27 | */ |
28 | - AbstractAudioCodec( unsigned int fs ):fs_(fs){}; | |
29 | - virtual ~AbstractAudioCodec(){}; | |
28 | + AudioCodecStrategy( unsigned int fs ):fs_(fs){}; | |
29 | + virtual ~AudioCodecStrategy(){}; | |
30 | 30 | |
31 | 31 | /** |
32 | 32 | * \brief Actual initializer. |
@@ -8,7 +8,7 @@ | ||
8 | 8 | #ifndef BITIN_HPP_ |
9 | 9 | #define BITIN_HPP_ |
10 | 10 | |
11 | -#include <abstractbitin.hpp> | |
11 | +#include <bitinstrategy.hpp> | |
12 | 12 | #include "bitout.hpp" |
13 | 13 | |
14 | 14 | #ifdef HAL_GPIO_MODULE_ENABLED |
@@ -27,7 +27,7 @@ namespace murasaki { | ||
27 | 27 | * the GPIO peripheral have to be configured to be right direction. |
28 | 28 | */ |
29 | 29 | |
30 | -class BitIn: public AbstractBitIn { | |
30 | +class BitIn: public BitInStrategy { | |
31 | 31 | public: |
32 | 32 | /** |
33 | 33 | * @brief Constructor |
@@ -1,12 +1,12 @@ | ||
1 | 1 | /** |
2 | - * @file abstractbitin.hpp | |
2 | + * @file bitinstrategy.hpp | |
3 | 3 | * |
4 | 4 | * @date 2018/05/07 |
5 | 5 | * @author takemasa |
6 | 6 | */ |
7 | 7 | |
8 | -#ifndef ABSTRACTBITIN_HPP_ | |
9 | -#define ABSTRACTBITIN_HPP_ | |
8 | +#ifndef BITINSTRATEGY_HPP_ | |
9 | +#define BITINSTRATEGY_HPP_ | |
10 | 10 | |
11 | 11 | #include <peripheralstrategy.hpp> |
12 | 12 |
@@ -18,7 +18,7 @@ namespace murasaki { | ||
18 | 18 | * A prototype of the general purpose bit input class |
19 | 19 | * |
20 | 20 | */ |
21 | -class AbstractBitIn: public PeripheralStrategy { | |
21 | +class BitInStrategy: public PeripheralStrategy { | |
22 | 22 | public: |
23 | 23 | /** |
24 | 24 | * @brief Get a status of the input pin |
@@ -33,4 +33,4 @@ class AbstractBitIn: public PeripheralStrategy { | ||
33 | 33 | |
34 | 34 | } /* namespace murasaki */ |
35 | 35 | |
36 | -#endif /* ABSTRACTBITIN_HPP_ */ | |
36 | +#endif /* BITINSTRATEGY_HPP_ */ |
@@ -8,7 +8,7 @@ | ||
8 | 8 | #ifndef BITOUT_HPP_ |
9 | 9 | #define BITOUT_HPP_ |
10 | 10 | |
11 | -#include <abstractbitout.hpp> | |
11 | +#include <bitoutstrategy.hpp> | |
12 | 12 | |
13 | 13 | #ifdef HAL_GPIO_MODULE_ENABLED |
14 | 14 |
@@ -42,7 +42,7 @@ struct GPIO_type { | ||
42 | 42 | * the GPIO peripheral have to be configured to be right direction. |
43 | 43 | */ |
44 | 44 | |
45 | -class BitOut: public AbstractBitOut { | |
45 | +class BitOut: public BitOutStrategy { | |
46 | 46 | public: |
47 | 47 | /** |
48 | 48 | * @brief Constructor |
@@ -1,12 +1,12 @@ | ||
1 | 1 | /** |
2 | - * @file abstractbitout.hpp | |
2 | + * @file bitoutstrategy.hpp | |
3 | 3 | * |
4 | 4 | * @date 2018/05/07 |
5 | 5 | * @author takemasa |
6 | 6 | */ |
7 | 7 | |
8 | -#ifndef ABSTRACTBITOUT_HPP_ | |
9 | -#define ABSTRACTBITOUT_HPP_ | |
8 | +#ifndef BITOUTSTRATEGY_HPP_ | |
9 | +#define BITOUTSTRATEGY_HPP_ | |
10 | 10 | |
11 | 11 | #include <peripheralstrategy.hpp> |
12 | 12 |
@@ -19,7 +19,7 @@ namespace murasaki { | ||
19 | 19 | * |
20 | 20 | */ |
21 | 21 | |
22 | -class AbstractBitOut: public PeripheralStrategy { | |
22 | +class BitOutStrategy: public PeripheralStrategy { | |
23 | 23 | public: |
24 | 24 | /** |
25 | 25 | * @brief Set a status of the output pin |
@@ -48,4 +48,4 @@ public: | ||
48 | 48 | |
49 | 49 | } /* namespace murasaki */ |
50 | 50 | |
51 | -#endif /* ABSTRACTBITOUT_HPP_ */ | |
51 | +#endif /* BITOUTSTRATEGY_HPP_ */ |
@@ -18,7 +18,7 @@ namespace murasaki { | ||
18 | 18 | |
19 | 19 | |
20 | 20 | DebuggerFifo::DebuggerFifo(unsigned int buffer_size) |
21 | - : AbstractFifo(buffer_size), | |
21 | + : FifoStrategy(buffer_size), | |
22 | 22 | sync_(new Synchronizer()) |
23 | 23 | { |
24 | 24 | MURASAKI_ASSERT(sync_ != nullptr); |
@@ -8,7 +8,7 @@ | ||
8 | 8 | #ifndef DEBUGGERFIFO_HPP_ |
9 | 9 | #define DEBUGGERFIFO_HPP_ |
10 | 10 | |
11 | -#include <abstractfifo.hpp> | |
11 | +#include <fifostrategy.hpp> | |
12 | 12 | #include "synchronizer.hpp" |
13 | 13 | #include "abstractlogger.hpp" |
14 | 14 |
@@ -34,7 +34,7 @@ namespace murasaki { | ||
34 | 34 | * |
35 | 35 | * @ingroup MURASAKI_HELPER_GROUP |
36 | 36 | */ |
37 | -class DebuggerFifo : public AbstractFifo | |
37 | +class DebuggerFifo : public FifoStrategy | |
38 | 38 | { |
39 | 39 | public: |
40 | 40 | /** |
@@ -74,7 +74,7 @@ class DebuggerFifo : public AbstractFifo | ||
74 | 74 | virtual void SetPostMortem(); |
75 | 75 | private: |
76 | 76 | // Alias to call the parent member function. |
77 | - typedef AbstractFifo inherited; | |
77 | + typedef FifoStrategy inherited; | |
78 | 78 | // For the communication between generator / consumer. |
79 | 79 | Synchronizer * const sync_; |
80 | 80 | bool post_mortem_; |
@@ -1,18 +1,18 @@ | ||
1 | 1 | /* |
2 | - * basefifo.cpp | |
2 | + * fifostrategy.cpp | |
3 | 3 | * |
4 | 4 | * Created on: 2018/02/26 |
5 | 5 | * Author: takemasa |
6 | 6 | */ |
7 | 7 | |
8 | -#include <abstractfifo.hpp> | |
8 | +#include <fifostrategy.hpp> | |
9 | 9 | #include <murasaki_assert.hpp> |
10 | 10 | #include <algorithm> |
11 | 11 | #include <string.h> |
12 | 12 | |
13 | 13 | namespace murasaki { |
14 | 14 | |
15 | -AbstractFifo::AbstractFifo(unsigned int buffer_size): | |
15 | +FifoStrategy::FifoStrategy(unsigned int buffer_size): | |
16 | 16 | size_of_buffer_(buffer_size), |
17 | 17 | buffer_(new uint8_t[size_of_buffer_]) |
18 | 18 | { |
@@ -24,13 +24,13 @@ AbstractFifo::AbstractFifo(unsigned int buffer_size): | ||
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | -AbstractFifo::~AbstractFifo() | |
27 | +FifoStrategy::~FifoStrategy() | |
28 | 28 | { |
29 | 29 | if (buffer_ != nullptr) |
30 | 30 | delete[] buffer_; |
31 | 31 | } |
32 | 32 | |
33 | -unsigned int AbstractFifo::Put(uint8_t const data[], unsigned int size) | |
33 | +unsigned int FifoStrategy::Put(uint8_t const data[], unsigned int size) | |
34 | 34 | { |
35 | 35 | unsigned int avairable; |
36 | 36 |
@@ -67,7 +67,7 @@ unsigned int AbstractFifo::Put(uint8_t const data[], unsigned int size) | ||
67 | 67 | |
68 | 68 | } |
69 | 69 | |
70 | -unsigned int AbstractFifo::Get(uint8_t data[], unsigned int size) | |
70 | +unsigned int FifoStrategy::Get(uint8_t data[], unsigned int size) | |
71 | 71 | { |
72 | 72 | unsigned int copy_size = 0; |
73 | 73 |
@@ -98,7 +98,7 @@ unsigned int AbstractFifo::Get(uint8_t data[], unsigned int size) | ||
98 | 98 | return copy_size; |
99 | 99 | } |
100 | 100 | |
101 | -void AbstractFifo::ReWind() | |
101 | +void FifoStrategy::ReWind() | |
102 | 102 | { |
103 | 103 | // by setting tail as head+1, the entire buffer is marked as "not sent" |
104 | 104 | tail_ = head_ + 1; |
@@ -1,12 +1,12 @@ | ||
1 | 1 | /** |
2 | - * @file abstractfifo.hpp | |
2 | + * @file fifostrategy.hpp | |
3 | 3 | * |
4 | 4 | * @date 2018/02/26 |
5 | 5 | * @author takemasa |
6 | 6 | */ |
7 | 7 | |
8 | -#ifndef ABSTRACTFIFO_HPP_ | |
9 | -#define ABSTRACTFIFO_HPP_ | |
8 | +#ifndef FIFOSTRATEGY_HPP_ | |
9 | +#define FIFOSTRATEGY_HPP_ | |
10 | 10 | |
11 | 11 | #include <ctype.h> |
12 | 12 | #include <cinttypes> |
@@ -25,10 +25,10 @@ namespace murasaki { | ||
25 | 25 | * If the internal buffer is empty, it returns without copy data. |
26 | 26 | * @ingroup MURASAKI_ABSTRACT_GROUP |
27 | 27 | */ |
28 | -class AbstractFifo | |
28 | +class FifoStrategy | |
29 | 29 | { |
30 | 30 | public: |
31 | - AbstractFifo() = delete; | |
31 | + FifoStrategy() = delete; | |
32 | 32 | /** |
33 | 33 | * @brief Create an internal buffer |
34 | 34 | * @param buffer_size Size of the internal buffer to be allocated [byte] |
@@ -36,11 +36,11 @@ class AbstractFifo | ||
36 | 36 | * Allocate the internal buffer with given buffer_size. |
37 | 37 | * The contents is not initialized. |
38 | 38 | */ |
39 | - AbstractFifo(unsigned int buffer_size); | |
39 | + FifoStrategy(unsigned int buffer_size); | |
40 | 40 | /** |
41 | 41 | * @brief Delete an internal buffer |
42 | 42 | */ |
43 | - virtual ~AbstractFifo(); | |
43 | + virtual ~FifoStrategy(); | |
44 | 44 | /** |
45 | 45 | * @brief Put the data into the internal buffer. |
46 | 46 | * @param data Data to be copied to the internal buffer |
@@ -85,4 +85,4 @@ class AbstractFifo | ||
85 | 85 | |
86 | 86 | } /* namespace murasaki */ |
87 | 87 | |
88 | -#endif /* ABSTRACTFIFO_HPP_ */ | |
88 | +#endif /* FIFOSTRATEGY_HPP_ */ |
@@ -9,7 +9,7 @@ | ||
9 | 9 | #ifndef I2CMASTER_HPP_ |
10 | 10 | #define I2CMASTER_HPP_ |
11 | 11 | |
12 | -#include <abstracti2cmaster.hpp> | |
12 | +#include <i2cmasterstrategy.hpp> | |
13 | 13 | #include <synchronizer.hpp> |
14 | 14 | #include "criticalsection.hpp" |
15 | 15 |
@@ -78,7 +78,7 @@ namespace murasaki { | ||
78 | 78 | * According to the source code of the HAL_I2C_MASTER_ABORT_IT(), no interrupt will be |
79 | 79 | * raised by this API call. |
80 | 80 | */ |
81 | -class I2cMaster : public AbstractI2CMaster | |
81 | +class I2cMaster : public I2CMasterStrategy | |
82 | 82 | { |
83 | 83 | public: |
84 | 84 | /** |
@@ -1,13 +1,13 @@ | ||
1 | 1 | /** |
2 | - * \file abstracti2cmaster.hpp | |
2 | + * \file i2cmasterstrategy.hpp | |
3 | 3 | * |
4 | 4 | * \date 2018/02/11 |
5 | 5 | * \author: takemasa |
6 | 6 | * \brief Root class definition of the I2C Master. |
7 | 7 | */ |
8 | 8 | |
9 | -#ifndef ABSTRACTI2CMASTER_HPP_ | |
10 | -#define ABSTRACTI2CMASTER_HPP_ | |
9 | +#ifndef I2CMASTERSTRATEGY_HPP_ | |
10 | +#define I2CMASTERSTRATEGY_HPP_ | |
11 | 11 | |
12 | 12 | #include <peripheralstrategy.hpp> |
13 | 13 |
@@ -27,7 +27,7 @@ namespace murasaki { | ||
27 | 27 | * Transmit/Receive. |
28 | 28 | */ |
29 | 29 | |
30 | -class AbstractI2CMaster : murasaki::PeripheralStrategy | |
30 | +class I2CMasterStrategy : murasaki::PeripheralStrategy | |
31 | 31 | { |
32 | 32 | public: |
33 | 33 |
@@ -134,4 +134,4 @@ class AbstractI2CMaster : murasaki::PeripheralStrategy | ||
134 | 134 | |
135 | 135 | } /* namespace murasaki */ |
136 | 136 | |
137 | -#endif /* ABSTRACTI2CMASTER_HPP_ */ | |
137 | +#endif /* I2CMASTERSTRATEGY_HPP_ */ |
@@ -10,7 +10,7 @@ | ||
10 | 10 | #ifndef I2CSLAVE_HPP_ |
11 | 11 | #define I2CSLAVE_HPP_ |
12 | 12 | |
13 | -#include <abstracti2cslave.hpp> | |
13 | +#include <i2cslavestrategy.hpp> | |
14 | 14 | #include <synchronizer.hpp> |
15 | 15 | #include "criticalsection.hpp" |
16 | 16 |
@@ -80,7 +80,7 @@ namespace murasaki { | ||
80 | 80 | * |
81 | 81 | |
82 | 82 | */ |
83 | -class I2cSlave : public AbstractI2cSlave { | |
83 | +class I2cSlave : public I2cSlaveStrategy { | |
84 | 84 | public: |
85 | 85 | I2cSlave(I2C_HandleTypeDef * i2c_handle); |
86 | 86 | virtual ~I2cSlave(); |
@@ -1,13 +1,13 @@ | ||
1 | 1 | /** |
2 | - * @file abstracti2cslave.hpp | |
2 | + * @file i2cslavestrategy.hpp | |
3 | 3 | * |
4 | 4 | * @date 2018/10/07 |
5 | 5 | * @author takemasa |
6 | 6 | * \brief Root class definition of the I2C Slave. |
7 | 7 | */ |
8 | 8 | |
9 | -#ifndef ABSTRACTI2CSLAVE_HPP_ | |
10 | -#define ABSTRACTI2CSLAVE_HPP_ | |
9 | +#ifndef I2CSLAVESTRATEGY_HPP_ | |
10 | +#define I2CSLAVESTRATEGY_HPP_ | |
11 | 11 | |
12 | 12 | #include <peripheralstrategy.hpp> |
13 | 13 |
@@ -25,7 +25,7 @@ namespace murasaki { | ||
25 | 25 | * Two call back member functions are prepared to sync with the interrupt which tells the end of |
26 | 26 | * Transmit/Receive. |
27 | 27 | */ |
28 | -class AbstractI2cSlave : public murasaki::PeripheralStrategy { | |
28 | +class I2cSlaveStrategy : public murasaki::PeripheralStrategy { | |
29 | 29 | public: |
30 | 30 | /** |
31 | 31 | * @brief Thread safe, blocking transmission over I2C. |
@@ -98,4 +98,4 @@ class AbstractI2cSlave : public murasaki::PeripheralStrategy { | ||
98 | 98 | |
99 | 99 | } // namespace |
100 | 100 | |
101 | -#endif /* ABSTRACTI2CSLAVE_HPP_ */ | |
101 | +#endif /* I2CSLAVESTRATEGY_HPP_ */ |
@@ -26,6 +26,7 @@ | ||
26 | 26 | |
27 | 27 | // Include HAL to refer from submodules of murasaki. |
28 | 28 | #include <debugger.hpp> |
29 | +#include <fifostrategy.hpp> | |
29 | 30 | #include <taskstrategy.hpp> |
30 | 31 | |
31 | 32 | // Configurations |
@@ -33,7 +34,6 @@ | ||
33 | 34 | #include "murasaki_defs.hpp" |
34 | 35 | |
35 | 36 | // Task and Stack |
36 | -#include "abstractfifo.hpp" | |
37 | 37 | #include "task.hpp" |
38 | 38 | |
39 | 39 | // Peripherals |