资源简介
nRF51822的adc和pwm
代码片段和文件信息
/* Copyright (c) 2009 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 uart_example_pca10001_main main.c
* @{
* @ingroup uart_example_pca10001
*
* @brief UART Example Application main file.
*
* This file contains the source code for a sample application using UART.
*
*/
#include
#include
#include “nrf.h“
#include “simple_uart.h“
#include “nrf_gpio.h“
#include “boards.h“
#include “twi_master.h“
#include “nrf_delay.h“
#include “nrf_adc.h“
#include “nrf_pwm.h“
//#define ENABLE_LOOPBACK_TEST /*!< if defined then this example will be a loopback test which means that TX should be connected to RX to get data loopback */
#define ERROR_PIN (LED_0) /*!< gpio pin number to show error if loopback is enabled */
#define MAX_TEST_DATA_BYTES (15U) /*!< max number of test bytes to be used for tx and rx */
#ifndef ENABLE_LOOPBACK_TEST
/** @brief Function for sending ‘ Exit!‘ string to UART.
Execution is blocked until UART peripheral detects all characters have been sent.
*/
static __INLINE void uart_quit()
{
simple_uart_putstring((const uint8_t *)“ \n\rExit!\n\r“);
}
/** @brief Function for sending ‘Start: ‘ string to UART.
Execution is blocked until UART peripheral detects all characters have been sent.
*/
static __INLINE void uart_start()
{
simple_uart_putstring((const uint8_t *)“ \n\rStart: “);
}
#else
/** @brief Function for setting @ref ERROR_PIN to one and enter an infinite loop. This function is called if any of the
* nRF6350 functions fail.
*/
static void show_error(void)
{
nrf_gpio_pin_write(ERROR_PIN 1);
while(true)
{
}
}
/** @brief Function for transmitting one char at a time as check if the loopback received data is same as transmitted
* Just used for testing with loopback setup (i.e @ref TX_PIN_NUMBER connected to @ref RX_PIN_NUMBER)
* return true if test passed else return false
*/
static void uart_loopback_test()
{
uint8_t tx_data[] = (“\n\r LOOPBACK_TEST“);
uint8_t rx_data[MAX_TEST_DATA_BYTES] = {0};
// Start sending one byte and see if you get the same
for(uint8_t i = 0; i < MAX_TEST_DATA_BYTES; i++)
{
bool status;
simple_uart_put(tx_data[i]);
if(!simple_uart_get_with_timeout(2 &rx_data[i]))
{
show_error();
}
}
for(uint8_t i = 0; i < MAX_TEST_DATA_BYTES; i++)
{
if ((rx_data[i] != tx_data[i]))
{
show_error();
}
}
return; // Test passed
}
#endif
/**
* @brief Function for application main entry
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-11-20 16:41 adc\
目录 0 2014-11-20 17:48 adc\arm\
文件 34712 2014-11-20 16:41 adc\arm\Jli
文件 650 2013-12-17 15:57 adc\arm\Jli
文件 138101 2013-12-18 16:55 adc\arm\uart_example.uvgui.L
文件 141263 2014-11-20 17:48 adc\arm\uart_example.uvgui.wntime
文件 136670 2013-12-18 15:58 adc\arm\uart_example.uvgui_L.bak
文件 143240 2014-11-20 10:05 adc\arm\uart_example.uvgui_wntime.bak
文件 20721 2014-11-20 17:48 adc\arm\uart_example.uvopt
文件 65831 2014-11-20 17:48 adc\arm\uart_example.uvproj
文件 6535 2014-11-20 16:41 adc\arm\uart_example_nrf51822_xxaa (256K).dep
文件 20738 2014-11-20 10:05 adc\arm\uart_example_uvopt.bak
文件 65911 2014-11-19 17:39 adc\arm\uart_example_uvproj.bak
目录 0 2014-11-20 16:41 adc\arm\_build\
文件 75 2014-11-20 16:41 adc\arm\_build\arm_startup_nrf51.d
文件 28529 2014-11-20 16:41 adc\arm\_build\arm_startup_nrf51.lst
文件 4436 2014-11-20 16:41 adc\arm\_build\arm_startup_nrf51.o
文件 19 2013-12-17 16:45 adc\arm\_build\ExtDll.iex
文件 256190 2014-11-20 16:41 adc\arm\_build\main.crf
文件 998 2014-11-20 16:41 adc\arm\_build\main.d
文件 237652 2014-11-20 16:41 adc\arm\_build\main.o
文件 347 2014-11-20 16:41 adc\arm\_build\main._2i
文件 6309 2014-11-20 15:22 adc\arm\_build\mpu6050.crf
文件 248662 2014-11-20 16:41 adc\arm\_build\nrf_adc.crf
文件 760 2014-11-20 16:41 adc\arm\_build\nrf_adc.d
文件 231268 2014-11-20 16:41 adc\arm\_build\nrf_adc.o
文件 366 2014-11-20 16:41 adc\arm\_build\nrf_adc._2i
文件 255759 2014-11-20 16:41 adc\arm\_build\nrf_pwm.crf
文件 848 2014-11-20 16:41 adc\arm\_build\nrf_pwm.d
文件 244140 2014-11-20 16:41 adc\arm\_build\nrf_pwm.o
文件 366 2014-11-20 16:41 adc\arm\_build\nrf_pwm._2i
............此处省略276个文件信息
- 上一篇:C++ 影碟租赁系统
- 下一篇:留言板实验报告
相关资源
- STM32f103ADC USART FLASH 八段数码管驱动
- STM32F407四路12位AD采样
- 野火k60 ADC oled可用稀缺
- DSP2812 ADC电压采集完整工程代码
- stm32单片机实现心电图采样以及显示
- STM32采集风向
- STM32采集风速调试成功
- 瑞萨单片机rh850 ADC代码包
- stm32F30x的ADC采样的傅里叶变换
- ADCensus.zip
- adc资源详解
- STM32F103双ADC模式同步采集两通道电压
- 基于nrf51822的TSM12触控例程
- STM32_ADC+TIM+DMA
- LC1860C数据手册 LC1860 Datasheet Leadcore
- ADC的指标详细定义,SNRSNDRSFDRTHD等
- 探索者 ADC DMA多通道实验.rar
- DMA+多路ADC+定时器+均值滤波.zip
- stm32 adc例程
- STM32 ADC多通道采集
- AD8232基于stm32的无线蓝牙传输心电图检
- stm32f030c8t6 ADC_DMA采集电压
- 基于15f单片机的自动灌溉系统设计
- STM32 ADC采集和DAC输出
- stm32f407实现定时器3Timer3触发ADC双通道
- STM32F103同时测8路ADC值代码
- STM8S003工程模版
- broadcom-bcm943602cs-win10-x86
- ADS1299数据采集系统程序.zip
- STM32F7通过TIM+DMA+ADC实现FFT功能.rar
评论
共有 条评论