资源简介
nrf51822 spi主控启动

代码片段和文件信息
/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
*
* The information contained herein is property of Nordic Semiconductor ASA.
* Terms and conditions of usage are described in detail in NORDIC
* SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free non-transferable use of the information. NO
* WARRANTY of ANY KIND is provided. This heading must NOT be removed from
* the file.
*
*/
/**@file
* @defgroup spi_master_example_with_slave_main main.c
* @{
* @ingroup spi_master_example
*
* @brief SPI master example application to be used with the SPI slave example application.
*/
#include
#include
#include “app_error.h“
#include “app_util_platform.h“
#include “nrf_delay.h“
#include “nrf_gpio.h“
#include “spi_master.h“
#include “boards.h“
/*
* This example uses only one instance of the SPI master.
* Please make sure that only one instance of the SPI master is enabled in config file.
*/
#if defined(SPI_MASTER_0_ENABLE)
#define SPI_MASTER_HW SPI_MASTER_0
#elif defined(SPI_MASTER_1_ENABLE)
#define SPI_MASTER_HW SPI_MASTER_1
#endif
#define TX_RX_BUF_LENGTH 16u /**< SPI transaction buffer length. */
#define DELAY_MS 100u /**< Timer delay in milliseconds. */
//Data buffers.
static uint8_t m_tx_data[TX_RX_BUF_LENGTH] = {0}; /**< A buffer with data to transfer. */
static uint8_t m_rx_data[TX_RX_BUF_LENGTH] = {0}; /**< A buffer for incoming data. */
static volatile bool m_transfer_completed = true; /**< A flag to inform about completed transfer. */
/**@brief Function for error handling which is called when an error has occurred.
*
* @param[in] error_code Error code supplied to the handler.
* @param[in] line_num Line number where the handler is called.
* @param[in] p_file_name Pointer to the file name.
*/
uint32_t error1;
uint32_t line1;
const uint8_t * p_file1;
void app_error_handler(uint32_t error_code uint32_t line_num const uint8_t * p_file_name)
{
//Set LED2 high to indicate that error has occurred.
error1 = error_code;
line1 = line_num;
p_file1= p_file_name;
nrf_gpio_pin_set(LED_2);
for (;;)
{
//No implementation needed.
nrf_gpio_pin_toggle(LED_2);
}
}
/**@brief Function for checking if data coming from a SPI slave are valid.
*
* @param[in] p_buf A pointer to a data buffer.
* @param[in] len A length of the data buffer.
*
* @note Expected ASCII characters from: ‘a‘ to: (‘a‘ + len - 1).
*
* @retval true Data are valid.
* @retval false Data are invalid.
*/
static __INLINE bool buf_check(uint8_t * p_buf uint16_t len)
{
uint16_t i;
for (i = 0; i < len; i++)
{
if (p_buf[i] != (uint8_t)(‘a‘ + i))
{
return false;
}
}
return true;
}
/** @brief Function for initializing a SPI master driver.
*/
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-12-31 15:19 spi_master_example_with_spi_slave\
目录 0 2016-12-31 16:59 spi_master_example_with_spi_slave\arm\
文件 63654 2016-12-31 15:28 spi_master_example_with_spi_slave\arm\Jli
文件 755 2016-12-30 12:25 spi_master_example_with_spi_slave\arm\Jli
目录 0 2016-12-31 08:54 spi_master_example_with_spi_slave\arm\RTE\
目录 0 2016-12-31 08:54 spi_master_example_with_spi_slave\arm\RTE\Device\
目录 0 2016-12-31 08:54 spi_master_example_with_spi_slave\arm\RTE\Device\nRF51822_xxAA\
文件 9469 2016-11-18 15:35 spi_master_example_with_spi_slave\arm\RTE\Device\nRF51822_xxAA\arm_startup_nrf51.s
文件 6114 2016-11-18 15:35 spi_master_example_with_spi_slave\arm\RTE\Device\nRF51822_xxAA\system_nrf51.c
目录 0 2016-12-31 08:54 spi_master_example_with_spi_slave\arm\RTE\Device\nRF51822_xxAB\
文件 9469 2016-11-18 15:35 spi_master_example_with_spi_slave\arm\RTE\Device\nRF51822_xxAB\arm_startup_nrf51.s
文件 6114 2016-11-18 15:35 spi_master_example_with_spi_slave\arm\RTE\Device\nRF51822_xxAB\system_nrf51.c
文件 278 2016-12-31 08:54 spi_master_example_with_spi_slave\arm\RTE\RTE_Components.h
目录 0 2016-12-31 15:28 spi_master_example_with_spi_slave\arm\_build\
文件 19 2016-12-31 15:11 spi_master_example_with_spi_slave\arm\_build\ExtDll.iex
文件 76 2016-12-31 15:27 spi_master_example_with_spi_slave\arm\_build\arm_startup_nrf51.d
文件 32294 2016-12-31 15:27 spi_master_example_with_spi_slave\arm\_build\arm_startup_nrf51.lst
文件 4904 2016-12-31 15:27 spi_master_example_with_spi_slave\arm\_build\arm_startup_nrf51.o
文件 464 2016-12-30 18:10 spi_master_example_with_spi_slave\arm\_build\main._2i
文件 275286 2016-12-31 15:27 spi_master_example_with_spi_slave\arm\_build\main.crf
文件 1357 2016-12-31 15:27 spi_master_example_with_spi_slave\arm\_build\main.d
文件 103251 2016-12-31 15:27 spi_master_example_with_spi_slave\arm\_build\main.i
文件 256312 2016-12-31 15:27 spi_master_example_with_spi_slave\arm\_build\main.o
文件 510 2016-12-30 18:10 spi_master_example_with_spi_slave\arm\_build\nrf_delay._2i
文件 258748 2016-12-31 15:28 spi_master_example_with_spi_slave\arm\_build\nrf_delay.crf
文件 944 2016-12-31 15:28 spi_master_example_with_spi_slave\arm\_build\nrf_delay.d
文件 79995 2016-12-31 15:28 spi_master_example_with_spi_slave\arm\_build\nrf_delay.i
文件 235392 2016-12-31 15:28 spi_master_example_with_spi_slave\arm\_build\nrf_delay.o
文件 500 2016-12-30 18:10 spi_master_example_with_spi_slave\arm\_build\nrf_soc._2i
文件 50505 2016-12-31 15:28 spi_master_example_with_spi_slave\arm\_build\nrf_soc.crf
文件 668 2016-12-31 15:28 spi_master_example_with_spi_slave\arm\_build\nrf_soc.d
............此处省略45个文件信息
- 上一篇:手慢无!0~9 数字 用于语音识别 wav格式音频
- 下一篇:SynDemo功击软件
相关资源
- Spire API文档
- The direction of synaptic plasticity mediated
- 飞思卡尔单片机MC9S12XS12G128驱动(硬件
- 51模拟SPI读写SD卡(包括Fat和Fat32文件
- 28335写的用spi读取传感器数据并用CA
- STM32F103 CC2500完整驱动(模拟SPI)
- 手机短信api接口(源代码)
- cs5530的SPI程序
- 9s12单片机SPI功能代码
- stm32 用SPI 方式读写 SDHC
- SPI Master 的Verilog源代码
- Spire.Doc 破解版
- Spin-1目标的广义parton分布的多项式和
- 介子和S波氘核的四极矩以及对spin-1系
- 基于SPCE061A和PTR8000的模拟SPI总线通信
- 用8位spi实现16位spi
- linux SPI设备注册和驱动小结
- 用Verilog语言写的CPLD和MCU通讯的SPI接口
- Spirent iTest用户手册详细介绍iTest的各
- 精确结果为3d N $$ \\ mathcal {N} $$ = 2 S
- 从Poincaré代数的闭合中得
- Temperature dependence of electron-spin cohere
- QCD中三个循环处的Spin-2形状因子
- STM32分别以串口硬件SPI模拟并口驱动
- stm32利用spi驱动tm1803
- 戴尔Inspiron笔记本 摄像头工具webcam
- 戴尔DELL Inspiron 14R N4010网卡驱动 最新
- dell inspiron n4010摄像头驱动 官方最新版
- 戴尔DELL灵越Inspiron N4120快捷键驱动程
- 戴尔DELL灵越Inspiron 14R 5420热键驱动程
评论
共有 条评论