ConOpSys V2970  P004.07
ANVILEX control operating system
SPI5_STM32F429.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file SPI5_STM32F429.h
3 //! @brief STM32F429 on-chip SPI5 bus master module class header file.
4 //! @attention No special attention requered.
5 //! @copyright (C) 2015-2020 ANVILEX LLC
6 //! $HeadURL: https://192.168.3.4:8443/svn/P004_07/ConOpSys/Targets/STM32F429/SPI5_STM32F429.h $
7 //! $Revision: 2820 $
8 //! $Date: 2021-07-26 18:14:38 +0500 (Mo, 26 Jul 2021) $
9 //! $Author: ggavrituhin $
10 //------------------------------------------------------------------------------
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions are met:
14 //
15 // 1. Redistributions of source code must retain the above copyright notice,
16 // this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright notice,
19 // this list of conditions and the following disclaimer in the documentation
20 // and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of ANVILEX nor the names of its contributors may be
23 // used to endorse or promote products derived from this software without
24 // specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
30 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 // POSSIBILITY OF SUCH DAMAGE.
37 //
38 //------------------------------------------------------------------------------
39 
40 #pragma once
41 
42 //------------------------------------------------------------------------------
43 // Include project files
44 //------------------------------------------------------------------------------
45 
46 #include "SPI_Master_Base.h"
47 
48 //------------------------------------------------------------------------------
49 // Class definitions
50 //------------------------------------------------------------------------------
51 
52 //! @brief STM32F429 on-chip SPI5 bus master module class
54 {
55 
56  //----------------------------------------------------------------------------
57  // Public defines, methods and variables
58  //----------------------------------------------------------------------------
59 
60  public:
61 /*
62  //!-------------------------------------------------------------------------
63  //! @brief Class constructor method
64  //! @note None
65  //! \par Override
66  //! Not allowed
67  //! @attention Don't call this method directly.
68  //--------------------------------------------------------------------------
69 
70  TSPI5_STM32F429();
71 
72  //!-------------------------------------------------------------------------
73  //! @brief Class destructor method
74  //! @note None
75  //! \par Override
76  //! Not allowed
77  //! @attention Don't call this method directly.
78  //--------------------------------------------------------------------------
79 
80  virtual ~TSPI5_STM32F429();
81 */
82  //!-------------------------------------------------------------------------
83  //! @brief SPI bus initialisation method
84  //! @note None
85  //! @return None
86  //! \par Override
87  //! Not allowed
88  //! @attention None
89  //--------------------------------------------------------------------------
90 
91  virtual VOID Init();
92 
93  //!-------------------------------------------------------------------------
94  //! @brief Start SPI bus operation method
95  //! @note Start SPI bus opearation.
96  //! @return None
97  //! \par Override
98  //! Not allowed
99  //! @attention None
100  //--------------------------------------------------------------------------
101 
102  virtual VOID Start();
103 
104  //!-------------------------------------------------------------------------
105  //! @brief Stop SPI bus operation method
106  //! @note Stops SPI bus operation.
107  //! @return None
108  //! \par Override
109  //! Not allowed
110  //! @attention None
111  //--------------------------------------------------------------------------
112 
113  virtual VOID Stop();
114 
115  //!-------------------------------------------------------------------------
116  //! @brief Send byte and receive byte over SPI bus at some time
117  //! @note None
118  //! @param [in] u8_Byte_To_Send - Byte to send
119  //! @param [in] *u8_Byte_To_Receive - Pointer to the byte to receive
120  //! @return None
121  //! \par Override
122  //! Not allowed
123  //! @attention None
124  //--------------------------------------------------------------------------
125 
126  virtual VOID Transfer_Byte( U8 u8_Byte_To_Send, U8 *u8_Byte_To_Receive );
127 
128  //!-------------------------------------------------------------------------
129  //! @brief Send byte over SPI bus
130  //! @note None
131  //! @param [in] u8_Byte_To_Send - Byte to send
132  //! @return None
133  //! \par Override
134  //! Not allowed
135  //! @attention None
136  //--------------------------------------------------------------------------
137 
138  virtual VOID Send_Byte( U8 u8_Byte_To_Send );
139 
140  //!-------------------------------------------------------------------------
141  //! @brief Receive byte over SPI bus
142  //! @note Function sent 0x00 over SPI bus during receiving.
143  //! @param [in] *u8_Byte_To_Receive - Pointer to the byte to receive
144  //! @return None
145  //! \par Override
146  //! Not allowed
147  //! @attention None
148  //--------------------------------------------------------------------------
149 
150  virtual VOID Receive_Byte( U8 *u8_Byte_To_Receive );
151 
152  //!-------------------------------------------------------------------------
153  //! @brief Verify byte over SPI bus
154  //! @note None
155  //! @param [in] u8_Byte_To_Verify - Byte to verify
156  //! @return BOOL - Operation status
157  //! @retval false - Verification error, bytes is different
158  //! @retval true - Verification cuccessed, bytes is equal
159  //! \par Override
160  //! Not allowed
161  //! @attention None
162  //--------------------------------------------------------------------------
163 
164  virtual BOOL Verify_Byte( U8 u8_Byte_To_Verify );
165 
166  //----------------------------------------------------------------------------
167  // Protected defines, methods and variables
168  //----------------------------------------------------------------------------
169 
170  protected:
171 
172  //----------------------------------------------------------------------------
173  // Private defines, methods and variables
174  //----------------------------------------------------------------------------
175 
176  private:
177 
178  //! @brief Timeout for byte sending 5 ms
180 
181 };
182 
183 //------------------------------------------------------------------------------
184 // End of file
185 //------------------------------------------------------------------------------
int BOOL
Boolean datatype definition.
Definition: Defines.h:124
unsigned char U8
Binary 8-Bit unsigned integer datatype defenition.
Definition: Defines.h:183
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
unsigned long U32
Binary 32-Bit unsigned integer datatype defenition.
Definition: Defines.h:203
SPI bus master base class header file.
STM32F429 on-chip SPI5 bus master module class.
Definition: SPI5_STM32F429.h:54
virtual VOID Stop()
Stop SPI bus operation method.
Definition: SPI5_STM32F429.cpp:235
virtual BOOL Verify_Byte(U8 u8_Byte_To_Verify)
Verify byte over SPI bus.
Definition: SPI5_STM32F429.cpp:440
const U32 u32_Send_Byte_Timeout
Timeout for byte sending 5 ms.
Definition: SPI5_STM32F429.h:179
virtual VOID Start()
Start SPI bus operation method.
Definition: SPI5_STM32F429.cpp:219
virtual VOID Transfer_Byte(U8 u8_Byte_To_Send, U8 *u8_Byte_To_Receive)
Send byte and receive byte over SPI bus at some time.
Definition: SPI5_STM32F429.cpp:251
virtual VOID Send_Byte(U8 u8_Byte_To_Send)
Send byte over SPI bus.
Definition: SPI5_STM32F429.cpp:314
virtual VOID Receive_Byte(U8 *u8_Byte_To_Receive)
Receive byte over SPI bus.
Definition: SPI5_STM32F429.cpp:377
virtual VOID Init()
SPI bus initialisation method.
Definition: SPI5_STM32F429.cpp:86
SPI master base class.
Definition: SPI_Master_Base.h:58