nrf2832 DFU在线更新源程序软件开发
- 软件开发#include "main.h"
- 软件开发#include "stm32f0xx_hal.h"
- 软件开发#include "spi.h"
- #include "gpio.h"
- /* USER CODE BEGIN Includes */
- #include "ads1118.h"
- /* USER CODE END Includes */
- /* Private variables ---------------------------------------------------------*/
- /* USER CODE BEGIN PV */
- /* Private variables ---------------------------------------------------------*/
- /* USER CODE END PV */
- /* Private function prototypes -----------------------------------------------*/
- void SystemClock_Config(void);
- /* USER CODE BEGIN PFP */
- /* Private function prototypes -----------------------------------------------*/
- /* USER CODE END PFP */
- /* USER CODE BEGIN 0 */
- uint16_t ConversionValue;
- float ad;
- uint16_t count = 0xC283;//0x8283;
- /* USER CODE END 0 */
- void delay1(uint32_t x) //x=100W 延时1s(不精确)
- {
- uint32_t i=0;
- while(x--)
- {
- i=10;
- while(i--);
- }
- }
- uint16_t adValue[4];
- uint32_t conversion;
- uint32_t config;
- float adV[4];
- int main(void)
- {
- /* USER CODE BEGIN 1 */
- int i = 0;
- /* USER CODE END 1 */
- /* MCU Configuration----------------------------------------------------------*/
- /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
- HAL_Init();
- /* USER CODE BEGIN Init */
- /* USER CODE END Init */
- /* Configure the system clock */
- SystemClock_Config();
- /* USER CODE BEGIN SysInit */
- /* USER CODE END SysInit */
- /* Initialize all configured peripherals */
- MX_GPIO_Init();
- MX_SPI1_Init();
-
- /* USER CODE BEGIN 2 */
- /* USER CODE END 2 */
- /* Infinite loop */
- /* USER CODE BEGIN WHILE */
- while (1)
- {
- /* USER CODE END WHILE */
- /* USER CODE BEGIN 3 */
- switch(i) {
- case 0:
- count = 0xc283;
- break;
- case 1:
- count = 0xd283;
- break;
- case 2:
- count = 0xe283;
- break;
- case 3:
- count = 0xf283;
- break;
- default:
- count = 0xc283;
- i = 0;
- break;
- }

芯片解密