Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: NNN50_CE_Test_UDP NNN50_linux_firmware NNN50_SoftAP_HelloWorld NNN50_BLEWIFISensor ... more
nrf51_spi_master_config.h
00001 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 00002 * 00003 * The information contained herein is property of Nordic Semiconductor ASA. 00004 * Terms and conditions of usage are described in detail in NORDIC 00005 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 00006 * 00007 * Licensees are granted free, non-transferable use of the information. NO 00008 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 00009 * the file. 00010 * 00011 */ 00012 #ifndef SPI_MASTER_CONFIG_H 00013 #define SPI_MASTER_CONFIG_H 00014 00015 #define SPI_OPERATING_FREQUENCY_8M ( 0x02000000UL << (uint32_t)Freq_8Mbps ) /*!< Slave clock frequency. */ 00016 #define SPI_OPERATING_FREQUENCY_4M ( 0x02000000UL << (uint32_t)Freq_4Mbps ) /*!< Slave clock frequency. */ 00017 #define SPI_OPERATING_FREQUENCY_1M ( 0x02000000UL << (uint32_t)Freq_1Mbps ) /*!< Slave clock frequency. */ 00018 00019 /* SPI0 */ 00020 //modified by Tsungta, SCK/MOSI/MISO are shared 00021 #define SPI_PSELSCK0 11//25//31 /*!< GPIO pin number for SPI clock (note that setting this to 31 will only work for loopback purposes as it not connected to a pin) */ 00022 #define SPI_PSELMOSI0 15//24//20 /*!< GPIO pin number for Master Out Slave In */ 00023 #define SPI_PSELMISO0 9//29//22 /*!< GPIO pin number for Master In Slave Out */ 00024 #define SPI_PSELSS0 12//30 /*!< GPIO pin number for Slave Select */ 00025 00026 /* SPI1 */ 00027 #define SPI_PSELSCK1 11//29 /*!< GPIO pin number for SPI clock */ 00028 #define SPI_PSELMOSI1 15//21 /*!< GPIO pin number for Master Out Slave In */ 00029 #define SPI_PSELMISO1 9//23 /*!< GPIO pin number for Master In Slave Out */ 00030 #define SPI_PSELSS1 12//28 /*!< GPIO pin number for Slave Select */ 00031 00032 //#define DEBUG 00033 #ifdef DEBUG 00034 #define DEBUG_EVENT_READY_PIN0 10 /*!< when DEBUG is enabled, this GPIO pin is toggled everytime READY_EVENT is set for SPI0, no toggling means something has gone wrong */ 00035 #define DEBUG_EVENT_READY_PIN1 11 /*!< when DEBUG is enabled, this GPIO pin is toggled everytime READY_EVENT is set for SPI1, no toggling means something has gone wrong */ 00036 #endif 00037 00038 #define NUMBER_OF_TEST_BYTES 2 /*!< number of bytes to send to slave to test if Initialization was successful */ 00039 #define TEST_BYTE 0xBB /*!< Randomly chosen test byte to transmit to spi slave */ 00040 #define TIMEOUT_COUNTER 0x3000UL /*!< timeout for getting rx bytes from slave */ 00041 00042 /** @def TX_RX_MSG_LENGTH 00043 * number of bytes to transmit and receive. This amount of bytes will also be tested to see that 00044 * the received bytes from slave are the same as the transmitted bytes from the master */ 00045 #define TX_RX_MSG_LENGTH 100 00046 00047 /** @def ERROR_PIN_SPI0 00048 * This pin is set active high when there is an error either in TX/RX for SPI0 or if the received bytes does not totally match the transmitted bytes. 00049 * This functionality can be tested by temporarily disconnecting the MISO pin while running this example. 00050 */ 00051 #define ERROR_PIN_SPI0 8UL 00052 00053 /** @def ERROR_PIN_SPI1 00054 * This pin is set active high when there is an error either in TX/RX for SPI1 or if the received bytes does not totally match the transmitted bytes. 00055 * This functionality can be tested by temporarily disconnecting the MISO pin while running this example. 00056 */ 00057 #define ERROR_PIN_SPI1 9UL 00058 00059 #endif /* SPI_MASTER_CONFIG_H */ 00060 00061
Generated on Wed Jul 13 2022 16:32:37 by
1.7.2