テスト用のあれこれ共用フォルダ
Revision | a543dc1d56217db28041f849aa514310462e56de (tree) |
---|---|
Time | 2018-04-27 19:20:13 |
Author | takemasa <suikan@user...> |
Commiter | takemasa |
Refactored SpiMastered.
Changed internal variable to consntant to avoid problems.
@@ -13,17 +13,15 @@ | ||
13 | 13 | |
14 | 14 | namespace murasaki { |
15 | 15 | |
16 | -SpiMaster::SpiMaster(SPI_HandleTypeDef * spi_handle) | |
16 | +SpiMaster::SpiMaster(SPI_HandleTypeDef * spi_handle): | |
17 | + peripheral_(spi_handle), | |
18 | + sync_(new murasaki::Synchronizer), | |
19 | + critical_section_(new murasaki::CriticalSection) | |
17 | 20 | { |
18 | 21 | // Setup internal variable with given uart structure. |
19 | 22 | |
20 | - MURASAKI_ASSERT(nullptr != spi_handle) | |
21 | - peripheral_ = spi_handle; | |
22 | - | |
23 | - sync_ = new Synchronizer; | |
23 | + MURASAKI_ASSERT(nullptr != peripheral_) | |
24 | 24 | MURASAKI_ASSERT(nullptr != sync_) |
25 | - | |
26 | - critical_section_ = new CriticalSection; | |
27 | 25 | MURASAKI_ASSERT(nullptr != critical_section_) |
28 | 26 | |
29 | 27 | } |
@@ -114,9 +114,9 @@ class SpiMaster : public AbstractSpiMaster | ||
114 | 114 | */ |
115 | 115 | virtual void * GetPeripheralHandle(); |
116 | 116 | protected: |
117 | - SPI_HandleTypeDef * peripheral_; // SPI peripheral handler. | |
118 | - Synchronizer * sync_; // sync between task and interrupt | |
119 | - CriticalSection * critical_section_; // protect memberfunction | |
117 | + SPI_HandleTypeDef * const peripheral_; // SPI peripheral handler. | |
118 | + Synchronizer * const sync_; // sync between task and interrupt | |
119 | + CriticalSection * const critical_section_; // protect memberfunction | |
120 | 120 | }; |
121 | 121 | |
122 | 122 | } /* namespace murasaki */ |