Mistake on this page?
Report an issue in GitHub or email us
spi_com_test.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2018 ARM Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /** \addtogroup hal_spi_tests
18  * @{
19  */
20 
21 #ifndef MBED_SPI_COM_TEST_H
22 #define MBED_SPI_COM_TEST_H
23 
24 #if DEVICE_SPI
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #if defined(TARGET_NUCLEO_F429ZI)
31 
32 #define SPI_TEST_MASTER_CS PA_4
33 #define SPI_TEST_MASTER_SCK PA_5
34 #define SPI_TEST_MASTER_MISO PA_6
35 #define SPI_TEST_MASTER_MOSI PB_5
36 #define SPI_TEST_SLAVE_CS PE_4
37 #define SPI_TEST_SLAVE_SCK PE_2
38 #define SPI_TEST_SLAVE_MISO PE_5
39 #define SPI_TEST_SLAVE_MOSI PE_6
40 
41 #elif defined(TARGET_K66F)
42 
43 #define SPI_TEST_MASTER_CS PTB20 // pin 3 on j6 header
44 #define SPI_TEST_MASTER_SCK PTD12
45 #define SPI_TEST_MASTER_MISO PTB23
46 #define SPI_TEST_MASTER_MOSI PTD13
47 #define SPI_TEST_SLAVE_CS PTD0
48 #define SPI_TEST_SLAVE_SCK PTD1
49 #define SPI_TEST_SLAVE_MISO PTD2
50 #define SPI_TEST_SLAVE_MOSI PTD3
51 
52 #else
53 #error [NOT_SUPPORTED] Provide SPI pins for the communication test in spi_com.h.
54 #endif
55 
56 
57 
58 /** Test that the SPI transfer can be performed in various configurations.
59  *
60  * Given board provides at least 2 SPI peripherals, SPI slave and master mode.
61  * When SPI transmission is performed using specified configuration.
62  * Then data is successfully transfered.
63  *
64  */
65 void test_spi_transfer();
66 
67 /**@}*/
68 
69 #ifdef __cplusplus
70 }
71 #endif
72 
73 #endif
74 
75 #endif
76 
77 /** @}*/
void test_spi_transfer()
Test that the SPI transfer can be performed in various configurations.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.