• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

shared_fooの不要ディレクトリ削除前のもの


Commit MetaInfo

修訂bc6671aad6d8bb8dfe1941cbd426f97d43f9faa2 (tree)
時間2018-02-15 23:04:45
作者takemasa <suikan@user...>
Commitertakemasa

Log Message

Change the name of the SPI slave specifier from
AbstractSpiMasterDecolator to AbstractSpiSlaveSpecifier

Change Summary

差異

--- a/stm32_development/murasaki/murasaki/abstractspimaster.hpp
+++ b/stm32_development/murasaki/murasaki/abstractspimaster.hpp
@@ -9,7 +9,7 @@
99 #ifndef ABSTRACTSPIMASTER_HPP_
1010 #define ABSTRACTSPIMASTER_HPP_
1111
12-#include "abstractspimasterdecorator.hpp"
12+#include <abstractspislavespecifier.hpp>
1313
1414 namespace murasaki {
1515
@@ -42,7 +42,7 @@ class AbstractSpiMaster
4242 virtual bool Transfer(uint8_t * tx_data,
4343 uint8_t * rx_data,
4444 uint16_t count,
45- murasaki::AbstractSpiMasterDecorator * decorator,
45+ murasaki::AbstractSpiSlaveSpecifier * decorator,
4646 murasaki::WaitMilliSeconds timeout_ms = murasaki::kwmsIndefinitely)=0;
4747 /**
4848 * @brief Callback to notifiy the end of transfer
--- a/stm32_development/murasaki/murasaki/abstractspimasterdecorator.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
1-/*
2- * abstractspimasterdecorator.cpp
3- *
4- * Created on: 2018/02/11
5- * Author: takemasa
6- */
7-
8-#include <abstractspimasterdecorator.hpp>
9-#include "murasaki_assert.hpp"
10-
11-namespace murasaki {
12-
13-
14-
15-AbstractSpiMasterDecorator::~AbstractSpiMasterDecorator()
16-{
17- // Do nothing.
18-}
19-
20-void AbstractSpiMasterDecorator::AssertCs()
21-{
22- // Do nothing here
23- // Must be overriden
24-}
25-
26-void AbstractSpiMasterDecorator::DeassertCs()
27-{
28- // Do nothing here
29- // Must be overriden
30-}
31-
32-murasaki::SpiClockPhase AbstractSpiMasterDecorator::GetCpha()
33-{
34- return cpha_;
35-}
36-
37-murasaki::SpiClockPolarity AbstractSpiMasterDecorator::GetCpol()
38-{
39- return cpol_;
40-}
41-
42-
43-AbstractSpiMasterDecorator::AbstractSpiMasterDecorator(murasaki::SpiClockPolarity pol, murasaki::SpiClockPhase pha)
44-{
45- cpol_ = pol;
46- cpha_ = pha;
47-}
48-
49-AbstractSpiMasterDecorator::AbstractSpiMasterDecorator(unsigned int pol, unsigned int pha)
50-{
51- cpol_ = static_cast<murasaki::SpiClockPolarity>(pol);
52- cpha_ = static_cast<murasaki::SpiClockPhase>(pha);
53-}
54-
55-
56-} /* namespace murasaki */
--- /dev/null
+++ b/stm32_development/murasaki/murasaki/abstractspislavespecifier.cpp
@@ -0,0 +1,56 @@
1+/*
2+ * abstractspimasterdecorator.cpp
3+ *
4+ * Created on: 2018/02/11
5+ * Author: takemasa
6+ */
7+
8+#include <abstractspislavespecifier.hpp>
9+#include "murasaki_assert.hpp"
10+
11+namespace murasaki {
12+
13+
14+
15+AbstractSpiSlaveSpecifier::~AbstractSpiSlaveSpecifier()
16+{
17+ // Do nothing.
18+}
19+
20+void AbstractSpiSlaveSpecifier::AssertCs()
21+{
22+ // Do nothing here
23+ // Must be overriden
24+}
25+
26+void AbstractSpiSlaveSpecifier::DeassertCs()
27+{
28+ // Do nothing here
29+ // Must be overriden
30+}
31+
32+murasaki::SpiClockPhase AbstractSpiSlaveSpecifier::GetCpha()
33+{
34+ return cpha_;
35+}
36+
37+murasaki::SpiClockPolarity AbstractSpiSlaveSpecifier::GetCpol()
38+{
39+ return cpol_;
40+}
41+
42+
43+AbstractSpiSlaveSpecifier::AbstractSpiSlaveSpecifier(murasaki::SpiClockPolarity pol, murasaki::SpiClockPhase pha)
44+{
45+ cpol_ = pol;
46+ cpha_ = pha;
47+}
48+
49+AbstractSpiSlaveSpecifier::AbstractSpiSlaveSpecifier(unsigned int pol, unsigned int pha)
50+{
51+ cpol_ = static_cast<murasaki::SpiClockPolarity>(pol);
52+ cpha_ = static_cast<murasaki::SpiClockPhase>(pha);
53+}
54+
55+
56+} /* namespace murasaki */
--- a/stm32_development/murasaki/murasaki/abstractspimasterdecorator.hpp
+++ b/stm32_development/murasaki/murasaki/abstractspislavespecifier.hpp
@@ -1,34 +1,34 @@
11 /*
2- * @file abstractspimasterdecorator.hpp
2+ * @file abstractspislavespecifier.hpp
33 *
44 * @date 2018/02/11
55 * @author: takemasa
66 */
77
8-#ifndef ABSTRACTSPIMASTERDECORATOR_HPP_
9-#define ABSTRACTSPIMASTERDECORATOR_HPP_
8+#ifndef ABSTRACTSPISLAVESPECIFIER_HPP_
9+#define ABSTRACTSPISLAVESPECIFIER_HPP_
1010
1111 #include "murasaki_defs.hpp"
1212
1313 namespace murasaki {
1414 /**
15- * \brief Definition of the root class of SPI master decorator.
15+ * \brief Definition of the root class of SPI slave specifier.
1616 * \details
17- * A prototype of the SPI master peripheral decorator.
17+ * A prototype of the SPI slave device specifier.
1818 *
19- * The decorator adds the following SPI attributes :
19+ * The specifier adds the following SPI attributes :
2020 * @li CPOL
2121 * @li CPHA
2222 * @li Chip select control for slave.
2323 *
24- * Because SPI slave has different setting device by device, this decorator should be
24+ * Because SPI slave has different setting device by device, this specifier should be
2525 * passed to the each transactions.
2626 *
2727 * AssetCs() and DeassertCs() have to be overriden to control the chip select output.
2828 * These member functions will be called from the AbstractSpiMaster.
2929 * @ingroup MURASAKI_ABSTRACT_GROUP
3030 */
31-class AbstractSpiMasterDecorator
31+class AbstractSpiSlaveSpecifier
3232 {
3333 public:
3434 /**
@@ -36,17 +36,17 @@ class AbstractSpiMasterDecorator
3636 * @param pol Polarity setting
3737 * @param pha Phase setting
3838 */
39- AbstractSpiMasterDecorator(murasaki::SpiClockPolarity pol, murasaki::SpiClockPhase pha);
39+ AbstractSpiSlaveSpecifier(murasaki::SpiClockPolarity pol, murasaki::SpiClockPhase pha);
4040 /**
4141 * @brief Constructor
4242 * @param pol Polarity setting
4343 * @param pha Phase setting
4444 */
45- AbstractSpiMasterDecorator(unsigned int pol, unsigned int pha);
45+ AbstractSpiSlaveSpecifier(unsigned int pol, unsigned int pha);
4646 /**
4747 * @brief Destructor
4848 */
49- virtual ~AbstractSpiMasterDecorator();
49+ virtual ~AbstractSpiSlaveSpecifier();
5050 /**
5151 * @brief Chip select assertion
5252 * @details
@@ -87,4 +87,4 @@ class AbstractSpiMasterDecorator
8787
8888 } /* namespace murasaki */
8989
90-#endif /* ABSTRACTSPIMASTERDECORATOR_HPP_ */
90+#endif /* ABSTRACTSPISLAVESPECIFIER_HPP_ */
--- a/stm32_development/murasaki/murasaki/spimaster.cpp
+++ b/stm32_development/murasaki/murasaki/spimaster.cpp
@@ -39,14 +39,14 @@ SpiMaster::~SpiMaster()
3939 bool SpiMaster::Transfer(uint8_t* tx_data,
4040 uint8_t* rx_data,
4141 uint16_t count,
42- murasaki::AbstractSpiMasterDecorator* decorator,
42+ murasaki::AbstractSpiSlaveSpecifier* spi_spec,
4343 murasaki::WaitMilliSeconds timeout_ms)
4444 {
4545 bool result;
4646
4747 MURASAKI_ASSERT(NULL!= tx_data);
4848 MURASAKI_ASSERT(NULL!= rx_data);
49- MURASAKI_ASSERT(NULL != decorator);
49+ MURASAKI_ASSERT(NULL != spi_spec);
5050
5151 // exclusive operation
5252 critical_section_->Enter();
@@ -55,12 +55,12 @@ bool SpiMaster::Transfer(uint8_t* tx_data,
5555 // todo is following right?
5656 MURASAKI_ASSERT(HAL_SPI_DeInit(peripheral_) == HAL_OK);
5757 peripheral_->Init.CLKPolarity =
58- (decorator->GetCpol() == kscpRiseThenFall) ? SPI_POLARITY_LOW : SPI_POLARITY_HIGH;
59- peripheral_->Init.CLKPhase = (decorator->GetCpha() == kscpLatchThenShift) ? SPI_PHASE_1EDGE : SPI_PHASE_2EDGE;
58+ (spi_spec->GetCpol() == kscpRiseThenFall) ? SPI_POLARITY_LOW : SPI_POLARITY_HIGH;
59+ peripheral_->Init.CLKPhase = (spi_spec->GetCpha() == kscpLatchThenShift) ? SPI_PHASE_1EDGE : SPI_PHASE_2EDGE;
6060 MURASAKI_ASSERT(HAL_SPI_Init(peripheral_) == HAL_OK);
6161
6262 // Assert the chip select for slave
63- decorator->AssertCs();
63+ spi_spec->AssertCs();
6464 {
6565
6666 // Transmit over SPI
@@ -72,7 +72,7 @@ bool SpiMaster::Transfer(uint8_t* tx_data,
7272 MURASAKI_ASSERT(result);
7373 }
7474 // Dessert the chip select for slave
75- decorator->DeassertCs();
75+ spi_spec->DeassertCs();
7676 }
7777 critical_section_->Leave();
7878
--- a/stm32_development/murasaki/murasaki/spimaster.hpp
+++ b/stm32_development/murasaki/murasaki/spimaster.hpp
@@ -66,14 +66,14 @@ class SpiMaster : public AbstractSpiMaster
6666 * @param tx_data Data to be transmitted
6767 * @param rx_data Data buffer to receive data
6868 * @param count Transfer data size [byte] for each way.
69- * @param decorator
69+ * @param spi_spec A pointer to the AbstractSpiSpecification to specify the slave device.
7070 * @param timeout_ms Timeout limit [mS]
7171 * @return true if transfer complete, false if timeout
7272 */
7373 virtual bool Transfer(uint8_t * tx_data,
7474 uint8_t * rx_data,
7575 uint16_t count,
76- murasaki::AbstractSpiMasterDecorator * decorator,
76+ murasaki::AbstractSpiSlaveSpecifier * spi_spec,
7777 murasaki::WaitMilliSeconds timeout_ms = murasaki::kwmsIndefinitely);
7878 /**
7979 * @brief Callback to notifiy the end of transfer