文档章节

nRF51822库函数速查

h
 houj
发布于 2014/10/28 17:50
字数 1767
阅读 793
收藏 2

nRF51822库函数速查


nrf_soc.h


//初始化互斥锁
uint32_t sd_mutex_new(nrf_mutex_t * p_mutex);

//尝试获取互斥锁.
uint32_t sd_mutex_acquire(nrf_mutex_t * p_mutex);

//释放互斥锁.
uint32_t sd_mutex_release(nrf_mutex_t * p_mutex);

//使能外部中断.
uint32_t sd_nvic_EnableIRQ(IRQn_Type IRQn);

//禁止外部中断.
uint32_t sd_nvic_DisableIRQ(IRQn_Type IRQn);

// Get Pending Interrupt.
uint32_t sd_nvic_GetPendingIRQ(IRQn_Type IRQn, uint32_t * p_pending_irq);

// Set Pending Interrupt.
uint32_t sd_nvic_SetPendingIRQ(IRQn_Type IRQn);

// Clear Pending Interrupt.
uint32_t sd_nvic_ClearPendingIRQ(IRQn_Type IRQn);

//设置中断优先级.
uint32_t sd_nvic_SetPriority(IRQn_Type IRQn, nrf_app_irq_priority_t priority);

//取得中断优先级.
uint32_t sd_nvic_GetPriority(IRQn_Type IRQn, nrf_app_irq_priority_t * p_priority);

//系统复位.
uint32_t sd_nvic_SystemReset(void);

//进入临界区.
uint32_t sd_nvic_critical_region_enter(uint8_t * p_is_nested_critical_region);

//退出临界区.
uint32_t sd_nvic_critical_region_exit(uint8_t is_nested_critical_region);

// 查询应用的随机数池容量.
uint32_t sd_rand_application_pool_capacity_get(uint8_t * p_pool_capacity);

//取得应用中有效地随机数字节数.
uint32_t sd_rand_application_bytes_available_get(uint8_t * p_bytes_available);

//从池中获取随机数字节.
uint32_t sd_rand_application_vector_get(uint8_t * p_buff, uint8_t length);

//取得复位原因寄存器的值. 
uint32_t sd_power_reset_reason_get(uint32_t * p_reset_reason);

//清除复位原因寄存器的若干bit. 
uint32_t sd_power_reset_reason_clr(uint32_t reset_reason_clr_msk);

//设置CPU睡眠时的电源模式.
uint32_t sd_power_mode_set(nrf_power_mode_t power_mode);

//关闭系统. 
uint32_t sd_power_system_off(void);

//开关电源失效比较器
uint32_t sd_power_pof_enable(uint8_t pof_enable);

//设置电源故障阈值.
uint32_t sd_power_pof_threshold_set(nrf_power_failure_threshold_t threshold);

//设置 NRF_POWER->RAMON 寄存器.
uint32_t sd_power_ramon_set(uint32_t ramon);

//清除 NRF_POWER->RAMON 寄存器.
uint32_t sd_power_ramon_clr(uint32_t ramon);

// Get contents of NRF_POWER->RAMON register, indicates power status of ram blocks.
uint32_t sd_power_ramon_get(uint32_t * p_ramon);

//Set bits in the NRF_POWER->GPREGRET register.
uint32_t sd_power_gpregret_set(uint32_t gpregret_msk);

//Clear bits in the NRF_POWER->GPREGRET register.
uint32_t sd_power_gpregret_clr(uint32_t gpregret_msk);

//Get contents of the NRF_POWER->GPREGRET register.
uint32_t sd_power_gpregret_get(uint32_t *p_gpregret);

//设置DCDC模式.
uint32_t sd_power_dcdc_mode_set(nrf_power_dcdc_mode_t dcdc_mode);

//请求使用高频晶体振荡器.
uint32_t sd_clock_hfclk_request(void);

//释放高频晶体振荡器.
uint32_t sd_clock_hfclk_release(void);

//检查高频晶体振荡器是否在运行.
SVCALL(SD_CLOCK_HFCLK_IS_RUNNING, uint32_t, sd_clock_hfclk_is_running(uint32_t * p_is_running));

//等待程序事件.
uint32_t sd_app_evt_wait(void);

// Get PPI channel enable register contents.
uint32_t sd_ppi_channel_enable_get(uint32_t * p_channel_enable);

//Set PPI channel enable register.
uint32_t sd_ppi_channel_enable_set(uint32_t channel_enable_set_msk);

//Clear PPI channel enable register.
uint32_t sd_ppi_channel_enable_clr(uint32_t channel_enable_clr_msk);

// Assign endpoints to a PPI channel.
uint32_t sd_ppi_channel_assign(uint8_t channel_num, const volatile void * evt_endpoint, const volatile void * task_endpoint);

//Task to enable a channel group.
uint32_t sd_ppi_group_task_enable(uint8_t group_num);

//Task to disable a channel group.
uint32_t sd_ppi_group_task_disable(uint8_t group_num);

//Assign PPI channels to a channel group.
uint32_t sd_ppi_group_assign(uint8_t group_num, uint32_t channel_msk);

//Gets the PPI channels of a channel group.
uint32_t sd_ppi_group_get(uint8_t group_num, uint32_t * p_channel_msk);

//配置无线通知信号.
uint32_t sd_radio_notification_cfg_set(nrf_radio_notification_type_t type, nrf_radio_notification_distance_t distance);

// AES-ECB加密.
uint32_t sd_ecb_block_encrypt(nrf_ecb_hal_data_t * p_ecb_data);

// Gets any pending events generated by the SoC API.
uint32_t, sd_evt_get(uint32_t * p_evt_id);

//取得芯片温度
uint32_t sd_temp_get(int32_t * p_temp);

//写数据到Flash
sd_flash_write(uint32_t * const p_dst, uint32_t const * const p_src, uint32_t size);

//擦除Flash页
uint32_t sd_flash_page_erase(uint32_t page_number);

// Flash Protection set
uint32_t sd_flash_protect(uint32_t protenset0, uint32_t protenset1);

ble.h


//从队列中取得等待处理的事件
uint32_t, sd_ble_evt_get(uint8_t* p_dest, uint16_t *p_len);

//取得BLE协议栈中有效地传输缓冲区总数
uint32_t sd_ble_tx_buffer_count_get(uint8_t* p_count);

//添加一个厂商特定UUID.
uint32_t sd_ble_uuid_vs_add(ble_uuid128_t const * const p_vs_uuid, uint8_t * const p_uuid_type);

//解码原始小端UUID字节(16bit或128bit) 到24bit的ble_uuid_t结构
uint32_t sd_ble_uuid_decode(uint8_t uuid_le_len, uint8_t const * const p_uuid_le, ble_uuid_t * const p_uuid);

//编码24bit的ble_uuid_t结构到原始小端UUID字节(16bit或128bit)
uint32_t sd_ble_uuid_encode(ble_uuid_t const * const p_uuid, uint8_t * const  p_uuid_le_len, uint8_t * const p_uuid_le));

//取得版本信息
uint32_t sd_ble_version_get(ble_version_t * p_version);

//提供用户内存块
uint32_t sd_ble_user_mem_reply(uint16_t conn_handle, ble_user_mem_block_t *p_block);

ble_gap.h


//设置本地蓝牙MAC地址
uint32_t sd_ble_gap_address_set(ble_gap_addr_t const * const p_addr);

//取得本地蓝牙MAC地址
uint32_t sd_ble_gap_address_get(ble_gap_addr_t * const p_addr);

//设置,清除,更新广播扫描响应数据
uint32_t sd_ble_gap_adv_data_set(uint8_t const * const p_data, uint8_t dlen, uint8_t const * const p_sr_data, uint8_t srdlen);

//开始广播(Start advertising (GAP Discoverable, Connectable modes, Broadcast Procedure)
uint32_t sd_ble_gap_adv_start(ble_gap_adv_params_t const * const p_adv_params);

//停止广播(Start advertising (GAP Discoverable, Connectable modes, Broadcast Procedure)
uint32_t sd_ble_gap_adv_stop(void);

//更新连接参数
uint32_t sd_ble_gap_conn_param_update(uint16_t conn_handle, ble_gap_conn_params_t const * const p_conn_params);

//断开连接(GAP Link Termination).
uint32_t, sd_ble_gap_disconnect(uint16_t conn_handle, uint8_t hci_status_code);

//设置无线发射功率dBm(accepted values are -40, -30, -20, -16, -12, -8, -4, 0, and 4 dBm).
SVCALL(SD_BLE_GAP_TX_POWER_SET, uint32_t, sd_ble_gap_tx_power_set(int8_t tx_power))
;

//Set GAP Appearance value.
uint32_t sd_ble_gap_appearance_set(uint16_t appearance);

//Get GAP Appearance value.
uint32_t, sd_ble_gap_appearance_get(uint16_t * const p_appearance);

//设置GAP外设优先连接参数
uint32_t sd_ble_gap_ppcp_set(ble_gap_conn_params_t const * const p_conn_params);

//取得GAP外设优先连接参数
uint32_t sd_ble_gap_ppcp_get(ble_gap_conn_params_t * const p_conn_params);

//设置GAP设备名
uint32_t sd_ble_gap_device_name_set(ble_gap_conn_sec_mode_t const * const p_write_perm, uint8_t const * const p_dev_name, uint16_t len);

//取得GAP设备名
uint32_t, sd_ble_gap_device_name_get(uint8_t * const p_dev_name, uint16_t * const p_len);

//启动GAP认证流程
uint32_t, sd_ble_gap_authenticate(uint16_t conn_handle, ble_gap_sec_params_t const * const p_sec_params);

//Reply with GAP security parameters.
uint32_t sd_ble_gap_sec_params_reply(uint16_t conn_handle, uint8_t sec_status, ble_gap_sec_params_t const * const p_sec_params);

//Reply with an authentication key
SVCALL(SD_BLE_GAP_AUTH_KEY_REPLY, uint32_t, sd_ble_gap_auth_key_reply(uint16_t conn_handle, uint8_t key_type, uint8_t const * const key);

//Reply with GAP security information.
uint32_t sd_ble_gap_sec_info_reply(uint16_t conn_handle, ble_gap_enc_info_t const * const p_enc_info, ble_gap_sign_info_t const * const p_sign_info);

//Get the current connection security.
uint32_t, sd_ble_gap_conn_sec_get(uint16_t conn_handle, ble_gap_conn_sec_t * const p_conn_sec);

//开始接受RSSI值的变化通知
uint32_t sd_ble_gap_rssi_start(uint16_t conn_handle);

//停止接收RSSI值变化通知
SVCALL(SD_BLE_GAP_RSSI_STOP, uint32_t, sd_ble_gap_rssi_stop(uint16_t conn_handle);

ble_gattc.h


//启动或继续GATT主要服务的发现过程
uint32_t sd_ble_gattc_primary_services_discover(uint16_t conn_handle, uint16_t start_handle, ble_uuid_t const * const p_srvc_uuid);

//启动或继续GATT关系发现过程
uint32_t sd_ble_gattc_relationships_discover(uint16_t conn_handle, ble_gattc_handle_range_t const * const p_handle_range);

//启动或继续GATT特性发现过程
uint32_t sd_ble_gattc_characteristics_discover(uint16_t conn_handle, ble_gattc_handle_range_t const * const p_handle_range);

//启动或继续GATT特性描述发现过程
uint32_t sd_ble_gattc_descriptors_discover(uint16_t conn_handle, ble_gattc_handle_range_t const * const p_handle_range);

//启动或继续通过GATT特性的UUID的读操作
uint32_t sd_ble_gattc_char_value_by_uuid_read(uint16_t conn_handle, ble_uuid_t const * const p_uuid, ble_gattc_handle_range_t const * const p_handle_range);

//启动或继续GATT读取长特性或描述的过程
uint32_t sd_ble_gattc_read(uint16_t conn_handle, uint16_t handle, uint16_t offset);

//启动GATT读取多个特性值的过程
uint32_t sd_ble_gattc_char_values_read(uint16_t conn_handle, uint16_t const * const p_handles, uint16_t handle_count);

//执行一个无报告的写操作
uint32_t sd_ble_gattc_write(uint16_t conn_handle, ble_gattc_write_params_t const * const p_write_params);

//发送配置到GATT服务器
uint32_t sd_ble_gattc_hv_confirm(uint16_t conn_handle, uint16_t handle);

ble_gatts.h


//添加一个服务声明到本地服务的ATT表
uint32_t sd_ble_gatts_service_add(uint8_t type, ble_uuid_t const*const p_uuid, uint16_t *const p_handle);

//添加一个包含声明到本地服务的ATT表
uint32_t sd_ble_gatts_include_add(uint16_t service_handle, uint16_t inc_srvc_handle, uint16_t *const p_include_handle);

//添加特性声明,特性值声明,可选的特性描述声明到ATT表
uint32_t sd_ble_gatts_characteristic_add(uint16_t service_handle, ble_gatts_char_md_t const*const p_char_md, ble_gatts_attr_t const*const p_attr_char_value, ble_gatts_char_handles_t *const p_handles);

//添加描述到ATT表
uint32_t sd_ble_gatts_descriptor_add(uint16_t char_handle, ble_gatts_attr_t const * const p_attr, uint16_t* const p_handle);

//设置值到特性
uint32_t sd_ble_gatts_value_set(uint16_t handle, uint16_t offset, uint16_t* const p_len, uint8_t const * const p_value);

//取得属性值
uint32_t sd_ble_gatts_value_get(uint16_t handle, uint16_t offset, uint16_t *const p_len, uint8_t* const p_data);

//Notify或Indicate特性值.
uint32_t, sd_ble_gatts_hvx(uint16_t conn_handle, ble_gatts_hvx_params_t const*const p_hvx_params);

//Indicate属性值改变
uint32_t sd_ble_gatts_service_changed(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle);

//报告读写授权请求
uint32_t sd_ble_gatts_rw_authorize_reply(uint16_t conn_handle, ble_gatts_rw_authorize_reply_params_t const*const p_rw_authorize_reply_params);

//Update persistent system attribute information
uint32_t sd_ble_gatts_sys_attr_set(uint16_t conn_handle, uint8_t const*const p_sys_attr_data, uint16_t len); 

//Retrieve persistent system attribute information from the stack.
uint32_t sd_ble_gatts_sys_attr_get(uint16_t conn_handle, uint8_t * const p_sys_attr_data, uint16_t* const p_len);

ble_l2cap.h


//注册一个L2CAP的CID
uint32_t sd_ble_l2cap_cid_register(uint16_t cid);

//注销CID
uint32_t sd_ble_l2cap_cid_unregister(uint16_t cid);

//发送L2CAP包
uint32_t sd_ble_l2cap_tx(uint16_t conn_handle, ble_l2cap_header_t const * const p_header, uint8_t const * const p_data);

nrf_sdm.h


//使能SoftDevice
uint32_t sd_softdevice_enable(nrf_clock_lfclksrc_t clock_source, softdevice_assertion_handler_t assertion_handler);

//禁用SoftDevice
uint32_t sd_softdevice_disable(void);

//检查SoftDevice是否已使能
uint32_t sd_softdevice_is_enabled(uint8_t * p_softdevice_enabled);

//开始转发中断到应用程序
uint32_t sd_softdevice_forward_to_application(void);

© 著作权归作者所有

h
粉丝 9
博文 81
码字总数 57985
作品 0
长沙
技术主管
私信 提问
[nRF51822] 9、基础实验代码解析大全 · 实验12 - ADC

一、本实验ADC 配置 分辨率:10 位。 输入通道:5,即使用输入通道AIN5 检测电位器的电压。 ADC 基准电压:1.2V。 二、NRF51822 ADC 管脚分布   NRF51822 的ADC 共有8 个输入通道,对应的管...

史迪奇2号
2018/01/06
0
0
在BLE400上体验microbit的运行效果

虽然没有micro:bit开发板,但是想到它的主控芯片是nRF51822,而很多蓝牙模块和开发板上,也有这个芯片,正好在网上又找到现成的固件文件,就想应该可以将固件下载进去。 nRF51822有几种型号,...

shaoziyang
2016/10/25
52
0
蓝牙 Nordic nrf51822 评估板 入门

参考: 青云蓝牙光盘V4.17.青云开发板原理图青云蓝牙nrf51822开发板.pdf 青云蓝牙光盘V4.16.青云系列教程青风出品1:前期预备篇:如何开发nrf51822硬件篇:QY-NRF51822硬件详解.pdf 青云蓝牙...

wowocpp
2018/05/07
0
0
介绍一颗NORDIC 低功耗蓝牙芯片-NRF51822系列

nRF51822 是功能强大、高灵活性的多协议 SoC,非常适用于 Bluetooth® 低功耗和 2.4GHz 超低功耗无线应用。 nRF51822 根据配备 256kB flash + 16kB RAM 的 32 位 ARM® Cortex™ M0 CPU 而建...

wx5b49ba1fb5075
2018/07/14
0
0
GetWindowRect

函数功能:该函数返回指定窗口的边框矩形的尺寸。该尺寸以相对于屏幕坐标左上角的屏幕坐标给出。 函数原型:BOOL GetWindowRect(HWND hWnd,LPRECTlpRect); 参数: hWnd:窗口句柄。 lpRe...

云栖希望。
2017/12/04
0
0

没有更多内容

加载失败,请刷新页面

加载更多

Android 图片加载带进度条的ImageView

https://blog.csdn.net/shu_quan/article/details/79975578

shzwork
4分钟前
2
0
关于XAMPP默认端口80 和443被占用的问题

本文转载于:专业的前端网站➩关于XAMPP默认端口80 和443被占用的问题 关于安装xampp-win32-1.8.1-VC9-installer.zip后启动时候报端口80和443被占用的问题解决 xampp-win32-1.8.1-VC9-instal...

前端老手
6分钟前
2
0
错误Setting the parent of a transform which resides in a Prefab Asset is...

错误日志 Setting the parent of a transform which resides in a Prefab Asset is disabled to prevent data corruption 原因1 用Resouce.Load加载一个prefab,没有实例化直接设置parent ......

XBlock
7分钟前
2
0
Spring boot 配置mybatis

当然任何模式都需要首先引入mybatis-spring-boot-starter的pom文件,现在最新版本是1.1.1(刚好快到双11了 :)) <dependency>    <groupId>org.mybatis.spring.boot</groupId>    <......

雷开你的门
8分钟前
4
0
云栖干货回顾 | 更强大的实时数仓构建能力!分析型数据库PostgreSQL 6.0新特性解读

阿里云 AnalyticDB for PostgreSQL 为采用MPP架构的分布式集群数据库,完备支持SQL 2003,部分兼容Oracle语法,支持PL/SQL存储过程,触发器,支持标准数据库事务ACID。AnalyticDB PG通过行存...

开源中国小二
20分钟前
2
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部