テスト用のあれこれ共用フォルダ
修訂 | 1a03ab6b9245bd7cbe4a601c352ad2d76b0bcab5 (tree) |
---|---|
時間 | 2018-04-21 02:52:00 |
作者 | takemasa <suikan@user...> |
Commiter | takemasa |
Added GetHandle() method, to help the abnormal condition.
@@ -12,8 +12,8 @@ | ||
12 | 12 | <targetDefinitions> |
13 | 13 | <board id="nucleo-f746zg"> |
14 | 14 | <name>NUCLEO-F746ZG</name> |
15 | - <dbgIF>JTAG</dbgIF> | |
16 | 15 | <dbgIF>SWD</dbgIF> |
16 | + <dbgIF>JTAG</dbgIF> | |
17 | 17 | <dbgDEV>ST-Link</dbgDEV> |
18 | 18 | <mcuId>stm32f746zgtx</mcuId> |
19 | 19 | </board> |
@@ -121,6 +121,15 @@ class AbstractI2CMaster | ||
121 | 121 | * The error handling is depend on the implementation. |
122 | 122 | */ |
123 | 123 | virtual bool HandleError(void * ptr)= 0; |
124 | + /** | |
125 | + * @brief Return the Platform dependent device control handle. | |
126 | + * @return Handle of device. | |
127 | + * @details | |
128 | + * The handle is the pointer ( or some ID ) which specify the control data of | |
129 | + * specific device. | |
130 | + */ | |
131 | + virtual void * GetDeviceHandle() = 0; | |
132 | + | |
124 | 133 | }; |
125 | 134 | |
126 | 135 | } /* namespace murasaki */ |
@@ -59,6 +59,15 @@ class AbstractSpiMaster | ||
59 | 59 | * The error handling is depend on the implementation. |
60 | 60 | */ |
61 | 61 | virtual bool HandleError(void * ptr)= 0; |
62 | + /** | |
63 | + * @brief Return the Platform dependent device control handle. | |
64 | + * @return Handle of device. | |
65 | + * @details | |
66 | + * The handle is the pointer ( or some ID ) which specify the control data of | |
67 | + * specific device. | |
68 | + */ | |
69 | + virtual void * GetDeviceHandle() = 0; | |
70 | + | |
62 | 71 | }; |
63 | 72 | |
64 | 73 | } /* namespace murasaki */ |
@@ -114,6 +114,14 @@ public: | ||
114 | 114 | * The error handling is depend on the implementation. |
115 | 115 | */ |
116 | 116 | virtual bool HandleError(void * ptr)= 0; |
117 | + /** | |
118 | + * @brief Return the Platform dependent device control handle. | |
119 | + * @return Handle of device. | |
120 | + * @details | |
121 | + * The handle is the pointer ( or some ID ) which specify the control data of | |
122 | + * specific device. | |
123 | + */ | |
124 | + virtual void * GetDeviceHandle() = 0; | |
117 | 125 | }; |
118 | 126 | /** |
119 | 127 | * \} |
@@ -174,6 +174,11 @@ bool I2cMaster::HandleError(void* ptr) | ||
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
177 | +void* I2cMaster::GetDeviceHandle() { | |
178 | + return peripheral_; | |
179 | +} | |
180 | + | |
177 | 181 | } /* namespace murasaki */ |
178 | 182 | |
183 | + | |
179 | 184 | #endif //HAL_I2C_MODULE_ENABLED |
@@ -160,6 +160,15 @@ class I2cMaster : public AbstractI2CMaster | ||
160 | 160 | * Checks whether handle has error and if there is, print appropriate error. Then return. |
161 | 161 | */ |
162 | 162 | virtual bool HandleError(void * ptr); |
163 | + /** | |
164 | + * @brief Return the Platform dependent device control handle. | |
165 | + * @return Handle of device. | |
166 | + * @details | |
167 | + * The handle is the pointer ( or some ID ) which specify the control data of | |
168 | + * specific device. | |
169 | + */ | |
170 | + virtual void * GetDeviceHandle(); | |
171 | + | |
163 | 172 | protected: |
164 | 173 | I2C_HandleTypeDef * const peripheral_; // SPI peripheral handle |
165 | 174 | Synchronizer * const sync_; // sync between task and interrupt |
@@ -124,6 +124,10 @@ bool SpiMaster::HandleError(void* ptr) | ||
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | +void* SpiMaster::GetDeviceHandle() { | |
128 | + return peripheral_; | |
129 | +} | |
130 | + | |
127 | 131 | |
128 | 132 | } /* namespace murasaki */ |
129 | 133 |
@@ -104,6 +104,14 @@ class SpiMaster : public AbstractSpiMaster | ||
104 | 104 | * Checks whether handle has error and if there is, print appropriate error. Then return. |
105 | 105 | */ |
106 | 106 | virtual bool HandleError(void * ptr); |
107 | + /** | |
108 | + * @brief Return the Platform dependent device control handle. | |
109 | + * @return Handle of device. | |
110 | + * @details | |
111 | + * The handle is the pointer ( or some ID ) which specify the control data of | |
112 | + * specific device. | |
113 | + */ | |
114 | + virtual void * GetDeviceHandle(); | |
107 | 115 | protected: |
108 | 116 | SPI_HandleTypeDef * peripheral_; // SPI peripheral handler. |
109 | 117 | Synchronizer * sync_; // sync between task and interrupt |
@@ -186,6 +186,10 @@ bool Uart::HandleError(void* const ptr) | ||
186 | 186 | } |
187 | 187 | } |
188 | 188 | |
189 | +void* Uart::GetDeviceHandle() { | |
190 | + return peripheral_; | |
191 | +} | |
192 | + | |
189 | 193 | } /* namespace platform */ |
190 | 194 | |
191 | 195 | #endif // HAL_UART_MODULE_ENABLED |
@@ -179,7 +179,15 @@ class Uart : public AbstractUart | ||
179 | 179 | * Checks whether handle has error and if there is, print appropriate error. Then return. |
180 | 180 | */ |
181 | 181 | virtual bool HandleError(void * const ptr); |
182 | - protected: | |
182 | + /** | |
183 | + * @brief Return the Platform dependent device control handle. | |
184 | + * @return Handle of device. | |
185 | + * @details | |
186 | + * The handle is the pointer ( or some ID ) which specify the control data of | |
187 | + * specific device. | |
188 | + */ | |
189 | + virtual void * GetDeviceHandle(); | |
190 | +protected: | |
183 | 191 | UART_HandleTypeDef* const peripheral_; |
184 | 192 | |
185 | 193 | Synchronizer * tx_sync_; |