Skip to content

VictorXY/nRF52_api_code

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

1. Environment construction

1.1 Keil installation

This tool is used for compilation, and code writing and compilation are based on this IDE.

(1)Download path of Keil :https://www.keil.com/download/product/

(2)keil user guids:https://www.keil.com/support/man_arm.htm

1.2 Nordic tool

The tool is placed in the provided sdk file package. The path to the file is in....\BLE_APIS(nRF52)\doc\Nordic tool.

(1)nrfgostudio :

(2)nRF Command Line Tools:....\BLE_APIS(nRF52)\doc\Nordic tool (https://www.nordicsemi.com/Products/Development-tools/nRF-Command-Line-Tools/Download?lang=en#infotabs)

(3)JLink_Windows_V680e

2 SDK description of file structure

2.1 Folder structure

(1)...\BLE_APIS(nRF52)\components: Nordic provide a much components file

(2)...\BLE_APIS(nRF52)\external: Nordic file

(3)...\BLE_APIS(nRF52)\merge_hex: Moko Synthetic firmware required

(4)...\BLE_APIS(nRF52)\moko_src: Moko user code

(5)...\BLE_APIS(nRF52)\Mprojct: The directory where the compiled project is located

(6)...\BLE_APIS(nRF52)\doc: Put installation files and Mokor files

2.2 Special Folder Description

  1. boot.hex : This is the file generated by the compilation of the boot project
  2. ibeacon.hex : This is the file generated by the compilation of the user project
  3. s112_nrf52810_5.1.0_softdevice.hex : This is the file of the protocol stack

This is the script file file.bat. Double-clicking the file will generate the three-in-one file ibeacon_2.0.4.hex, which supports re-modifying the file name.

3.Description of peripheral device API

3.1 Lis3dh driver

There is corresponding lis3dh function code in lis3dh_driver.c

  1. void lis3dh_init(void): Initializes lis3dh sensor drivers
  2. void task_read_3dh(void) : Read lis3dh sensor data

3.2 STK8232 driver

There is corresponding STK8232 function code in STK823x_app.c

  1. void STK832x_Init(void): Initializes STK832x sensor drivers
  2. void STK832x_read_data(void) : Read STK832x sensor data

3.3 SHT30 driver

There is corresponding sht30 temperature and humidity sensor function code in sht3x_driver.c

  1. void sht3x_Init(void) : Initialize sht30 temperature and humidity sensor
  2. void task_read_sht3x(void) : Read temperature and humidity sensor data

3.4 Uart production test function

This function in simple_uart.c and uart_commd.c file.

The protocol Documentation path: ...BLE_APIS(nRF52)\doc\Uart Protocol

  1. simple_uart.c : The initialization part of the uart driver function
  2. uart_commd.c : handle Production test commands

Description of special functions:

  1. void task_uart_manage(void) This is equivalent to the uart's enable and disable management functions. The specific operation is to disable the uart function after 30s, then turn on the RX io interrupt, wait data for the enable uart function of the data, and execute the corresponding cmd.

  2. void task_process_uart_data(void) Uart's function to receive data. in the while function.

  3. void analyze_uart_data(uint8_t cmd,uint8_t*datas,uint8_t len) Serial port data parsing function, parsing corresponding commands and function settings

  4. Note: UART must be closed after the test is completed, otherwise it will cause abnormal power consumption of the device

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 97.3%
  • Assembly 1.1%
  • Other 1.6%