资源简介
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功击软件
相关资源
- pspice的rcc开关电源仿真
- 基于fpga的spi和i2c接口电路转化电路
- 基于dsPIC的精跟踪控制系统设计
- ADC SPI配置FPGA代码
- pspice安装汉化包
- SPI_samplefiles
- SPI通信代码
- r语言计算标准化降水指数
- spi and apei
- 基于STM32的DAC7562模块驱动代码
- veriloga的模型导入hspice的方法
- 忆阻器的Pspice代码
- AD9361_SPI控制无代码,只是一个总结
- dspic----单片机与DSP的完美结合
- si4431 spi通信
- FPGA与铁电存储器SPI通信Verilog实现
- STM32HAL库驱动SPILCD代码
- nRF51822低功耗睡眠函数应用
- DSPII计算机作业2.pdf
- AT91RM9200的SPI设备驱动程序开发.pdf
- STM8 SPI从机通讯程序
- AVR-ATmega16双机通信双向,并带反馈I
- sony IMX290 driver (SPI)
- Automotive SPICE PRM v4.5中文
- 乐鑫esp8266 NONOS SDK 3.0编程使用 SPI 驱动
- ADXL345加速度传感器SPI通信程序
- VHDL控制进行SPI读写
- SPI FLASH 仿真模型
- SPI按键显示接口设计
- dspic33的PWM调试程序
评论
共有 条评论