OpenMPTL - STM32F10X
C++ Microprocessor Template Library
spi.hpp
Go to the documentation of this file.
1 /*
2  * OpenMPTL - C++ Microprocessor Template Library
3  *
4  * Copyright (C) 2012-2017 Axel Burri <axel@tty0.ch>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 /*
22  * This program contains derivative representations of CMSIS System
23  * View Description (SVD) files, and is subject to the "End User
24  * License Agreement for STMicroelectronics" (see "STM_License.html"
25  * in the containing directory).
26  */
27 
28 #ifndef ARCH_REG_SPI_HPP_INCLUDED
29 #define ARCH_REG_SPI_HPP_INCLUDED
30 
31 #include "../../../../common/reg/spi.hpp"
32 
33 namespace mptl {
34 
35 template<unsigned spi_no>
36 class SPI
37 {
38  /* See available template specialisations below if the compiler asserts here! */
39  static_assert(spi_no == !spi_no, "unsupported SPI number"); // assertion needs to be dependent of template parameter
40 };
41 
42 template<> class SPI<1> : public SPI_Common< 0x40013000 > { };
43 #if !defined (STM32F10X_LD) && !defined (STM32F10X_LD_VL)
44 template<> class SPI<2> : public SPI_Common< 0x40003800 > { };
45 #endif
46 #if defined (STM32F10X_HD) || defined (STM32F10X_CL)
47 template<> class SPI<3> : public SPI_Common< 0x40003C00 > { };
48 #endif
49 
50 } // namespace mptl
51 
52 #endif // ARCH_REG_SPI_HPP_INCLUDED
Definition: spi.hpp:36