nRF51822庫函數(shù)速查

轉(zhuǎn)載于http://blog.csdn.net/pig10086/article/details/65451510

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);


//設(shè)置中斷優(yōu)先級.

uint32_t sd_nvic_SetPriority(IRQn_Type IRQn, nrf_app_irq_priority_t priority);


//取得中斷優(yōu)先級.

uint32_t sd_nvic_GetPriority(IRQn_Type IRQn, nrf_app_irq_priority_t * p_priority);


//系統(tǒng)復(fù)位.

uint32_t sd_nvic_SystemReset(void);


//進(jìn)入臨界區(qū).

uint32_t sd_nvic_critical_region_enter(uint8_t * p_is_nested_critical_region);


//退出臨界區(qū).

uint32_t sd_nvic_critical_region_exit(uint8_t is_nested_critical_region);


//查詢應(yīng)用的隨機(jī)數(shù)池容量.

uint32_t sd_rand_application_pool_capacity_get(uint8_t * p_pool_capacity);


//取得應(yīng)用中有效地隨機(jī)數(shù)字節(jié)數(shù).

uint32_t sd_rand_application_bytes_available_get(uint8_t * p_bytes_available);


//從池中獲取隨機(jī)數(shù)字節(jié).

uint32_t sd_rand_application_vector_get(uint8_t * p_buff, uint8_t length);


//取得復(fù)位原因寄存器的值.

uint32_t sd_power_reset_reason_get(uint32_t * p_reset_reason);


//清除復(fù)位原因寄存器的若干bit.

uint32_t sd_power_reset_reason_clr(uint32_t reset_reason_clr_msk);


//設(shè)置CPU睡眠時的電源模式.

uint32_t sd_power_mode_set(nrf_power_mode_t power_mode);


//關(guān)閉系統(tǒng).

uint32_t sd_power_system_off(void);


//開關(guān)電源失效比較器

uint32_t sd_power_pof_enable(uint8_t pof_enable);


//設(shè)置電源故障閾值.

uint32_t sd_power_pof_threshold_set(nrf_power_failure_threshold_t threshold);


//設(shè)置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);


//設(shè)置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);


//檢查高頻晶體振蕩器是否在運(yùn)行.

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,constvolatilevoid* evt_endpoint,constvolatilevoid* 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);


//寫數(shù)據(jù)到Flash

sd_flash_write(uint32_t *constp_dst, uint32_tconst*constp_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協(xié)議棧中有效地傳輸緩沖區(qū)總數(shù)

uint32_t sd_ble_tx_buffer_count_get(uint8_t* p_count);

//添加一個廠商特定UUID.

uint32_t sd_ble_uuid_vs_add(ble_uuid128_tconst*constp_vs_uuid, uint8_t *constp_uuid_type);

//解碼原始小端UUID字節(jié)(16bit或128bit)到24bit的ble_uuid_t結(jié)構(gòu)

uint32_t sd_ble_uuid_decode(uint8_t uuid_le_len, uint8_tconst*constp_uuid_le, ble_uuid_t *constp_uuid);

//編碼24bit的ble_uuid_t結(jié)構(gòu)到原始小端UUID字節(jié)(16bit或128bit)

uint32_t sd_ble_uuid_encode(ble_uuid_tconst*constp_uuid, uint8_t *constp_uuid_le_len, uint8_t *constp_uuid_le));

//取得版本信息

uint32_t sd_ble_version_get(ble_version_t * p_version);

//提供用戶內(nèi)存塊

uint32_t sd_ble_user_mem_reply(uint16_t conn_handle, ble_user_mem_block_t *p_block);

ble_gap.h

//設(shè)置本地藍(lán)牙MAC地址

uint32_t sd_ble_gap_address_set(ble_gap_addr_tconst*constp_addr);

//取得本地藍(lán)牙MAC地址

uint32_t sd_ble_gap_address_get(ble_gap_addr_t *constp_addr);

//設(shè)置,清除,更新廣播掃描響應(yīng)數(shù)據(jù)

uint32_t sd_ble_gap_adv_data_set(uint8_tconst*constp_data, uint8_t dlen, uint8_tconst*constp_sr_data, uint8_t srdlen);

//開始廣播(Start advertising (GAP Discoverable, Connectable modes, Broadcast Procedure)

uint32_t sd_ble_gap_adv_start(ble_gap_adv_params_tconst*constp_adv_params);

//停止廣播(Start advertising (GAP Discoverable, Connectable modes, Broadcast Procedure)

uint32_t sd_ble_gap_adv_stop(void);

//更新連接參數(shù)

uint32_t sd_ble_gap_conn_param_update(uint16_t conn_handle, ble_gap_conn_params_tconst*constp_conn_params);

//斷開連接(GAP Link Termination).

uint32_t, sd_ble_gap_disconnect(uint16_t conn_handle, uint8_t hci_status_code);

//設(shè)置無線發(fā)射功率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 *constp_appearance);

//設(shè)置GAP外設(shè)優(yōu)先連接參數(shù)

uint32_t sd_ble_gap_ppcp_set(ble_gap_conn_params_tconst*constp_conn_params);

//取得GAP外設(shè)優(yōu)先連接參數(shù)

uint32_t sd_ble_gap_ppcp_get(ble_gap_conn_params_t *constp_conn_params);

//設(shè)置GAP設(shè)備名

uint32_t sd_ble_gap_device_name_set(ble_gap_conn_sec_mode_tconst*constp_write_perm, uint8_tconst*constp_dev_name, uint16_t len);

//取得GAP設(shè)備名

uint32_t, sd_ble_gap_device_name_get(uint8_t *constp_dev_name, uint16_t *constp_len);

//啟動GAP認(rèn)證流程

uint32_t, sd_ble_gap_authenticate(uint16_t conn_handle, ble_gap_sec_params_tconst*constp_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_tconst*constp_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_tconst*constkey);

//Reply with GAP security information.

uint32_t sd_ble_gap_sec_info_reply(uint16_t conn_handle, ble_gap_enc_info_tconst*constp_enc_info, ble_gap_sign_info_tconst*constp_sign_info);

//Get the current connection security.

uint32_t, sd_ble_gap_conn_sec_get(uint16_t conn_handle, ble_gap_conn_sec_t *constp_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

//啟動或繼續(xù)GATT主要服務(wù)的發(fā)現(xiàn)過程

uint32_t sd_ble_gattc_primary_services_discover(uint16_t conn_handle, uint16_t start_handle, ble_uuid_tconst*constp_srvc_uuid);

//啟動或繼續(xù)GATT關(guān)系發(fā)現(xiàn)過程

uint32_t sd_ble_gattc_relationships_discover(uint16_t conn_handle, ble_gattc_handle_range_tconst*constp_handle_range);

//啟動或繼續(xù)GATT特性發(fā)現(xiàn)過程

uint32_t sd_ble_gattc_characteristics_discover(uint16_t conn_handle, ble_gattc_handle_range_tconst*constp_handle_range);

//啟動或繼續(xù)GATT特性描述發(fā)現(xiàn)過程

uint32_t sd_ble_gattc_descriptors_discover(uint16_t conn_handle, ble_gattc_handle_range_tconst*constp_handle_range);

//啟動或繼續(xù)通過GATT特性的UUID的讀操作

uint32_t sd_ble_gattc_char_value_by_uuid_read(uint16_t conn_handle, ble_uuid_tconst*constp_uuid, ble_gattc_handle_range_tconst*constp_handle_range);

//啟動或繼續(xù)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_tconst*constp_handles, uint16_t handle_count);

//執(zhí)行一個無報告的寫操作

uint32_t sd_ble_gattc_write(uint16_t conn_handle, ble_gattc_write_params_tconst*constp_write_params);

//發(fā)送配置到GATT服務(wù)器

uint32_t sd_ble_gattc_hv_confirm(uint16_t conn_handle, uint16_t handle);

ble_gatts.h

//添加一個服務(wù)聲明到本地服務(wù)的ATT表

uint32_t sd_ble_gatts_service_add(uint8_t type, ble_uuid_tconst*constp_uuid, uint16_t *constp_handle);

//添加一個包含聲明到本地服務(wù)的ATT表

uint32_t sd_ble_gatts_include_add(uint16_t service_handle, uint16_t inc_srvc_handle, uint16_t *constp_include_handle);

//添加特性聲明,特性值聲明,可選的特性描述聲明到ATT表

uint32_t sd_ble_gatts_characteristic_add(uint16_t service_handle, ble_gatts_char_md_tconst*constp_char_md, ble_gatts_attr_tconst*constp_attr_char_value, ble_gatts_char_handles_t *constp_handles);

//添加描述到ATT表

uint32_t sd_ble_gatts_descriptor_add(uint16_t char_handle, ble_gatts_attr_tconst*constp_attr, uint16_t*constp_handle);

//設(shè)置值到特性

uint32_t sd_ble_gatts_value_set(uint16_t handle, uint16_t offset, uint16_t*constp_len, uint8_tconst*constp_value);

//取得屬性值

uint32_t sd_ble_gatts_value_get(uint16_t handle, uint16_t offset, uint16_t *constp_len, uint8_t*constp_data);

//Notify或Indicate特性值.

uint32_t, sd_ble_gatts_hvx(uint16_t conn_handle, ble_gatts_hvx_params_tconst*constp_hvx_params);

//Indicate屬性值改變

uint32_t sd_ble_gatts_service_changed(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle);

//報告讀寫授權(quán)請求

uint32_t sd_ble_gatts_rw_authorize_reply(uint16_t conn_handle, ble_gatts_rw_authorize_reply_params_tconst*constp_rw_authorize_reply_params);

//Update persistent system attribute information

uint32_t sd_ble_gatts_sys_attr_set(uint16_t conn_handle, uint8_tconst*constp_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 *constp_sys_attr_data, uint16_t*constp_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);

//發(fā)送L2CAP包

uint32_t sd_ble_l2cap_tx(uint16_t conn_handle, ble_l2cap_header_tconst*constp_header, uint8_tconst*constp_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);

//開始轉(zhuǎn)發(fā)中斷到應(yīng)用程序

uint32_t sd_softdevice_forward_to_application(void);

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容