【STM32G431RBTx】备战蓝桥杯嵌入式→决赛试题→第七届

news2024/11/24 17:40:30

文章目录

    • 前言
    • 一、题目
    • 二、模块初始化
    • 三、代码实现
      • interrupt.h:
      • interrupt.h:
      • main.h:
      • main.h:
    • 四、完成效果
    • 五、总结

前言

一、题目

请添加图片描述
请添加图片描述
请添加图片描述

二、模块初始化

1.LCD这里不用配置,直接使用提供的资源包就行
2.ADC:开启ADCsingle-ended
3.LED:开启PC8-15,PD2输出模式就行了。
4.定时器:TIM3(按键消抖定时器):PSC:80-1,ARR:10000-1,TIM17(输入捕获定时器):PSC:80,ARR:65535,TIM2CH2(PWM输出定时器):PSC:800-1,ARR:100-1
5.i2c:设置PB6,PB7为GPIO_Output模式即可
6.打开串口串行输出

三、代码实现

bsp组中共有:
在这里插入图片描述

interrupt.h:

#ifndef __INTERRUPT_H__
#define __INTERRUPT_H__

#include "main.h"
#include "stdbool.h"

struct keys 
{
    bool key_sta;
    unsigned char key_judge;
    bool single_flag;
    unsigned int key_time;
    bool long_flag;
};

#endif

interrupt.h:

#include "interrupt.h"

struct keys key[4] = {0, 0, 0, 0, 0};

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef * htim)
{
    if(htim->Instance == TIM3)
    {
        key[0].key_sta = HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_0);
        key[1].key_sta = HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_1);
        key[2].key_sta = HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_2);
        key[3].key_sta = HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_0);
        for(unsigned char i = 0; i < 4; i++)
        {
            switch(key[i].key_judge)
            {
                case 0:
                {
                    if(key[i].key_sta == 0)
                    {
                        key[i].key_time = 0;
                        key[i].key_judge = 1;
                    }
                    break;
                }
                case 1:
                {
                    if(key[i].key_sta == 0)
                    {
                        key[i].key_judge = 2;
                    }
                    else
                    {
                        key[i].key_judge = 0;
                    }
                    break;
                }
                case 2:
                {
                    if(key[i].key_sta == 1)
                    {
                        key[i].key_judge = 0;
                        if(key[i].key_time < 80)
                        {
                            key[i].single_flag = 1;
                        }
                    }
                    else
                    {
                        key[i].key_time++;
                        if(key[i].key_time >= 80)
                        {
                            key[i].long_flag = 1;
                        }
                    }
                    break;
                }
            }
        }
    }
}





/* Captured Values */
uint32_t uwIC1Value1_T17CH1 = 0;
uint32_t uwIC1Value2_T17CH1 = 0;
uint32_t uwLowCapture_T17CH1 = 0;
uint32_t uwHighCapture_T17CH1 = 0;

/* Capture index */
uint16_t uhCaptureIndex_T17CH1 = 0;

/* Frequency Value */
uint32_t uwFrequency_T17CH1 = 0;
double uwDuty_T17CH1 = 0;






void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
{
	if(htim->Instance == TIM17)
	{
		if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1)
		{
			if(uhCaptureIndex_T17CH1 == 0)
			{
				/* Get the 1st Input Capture value */
				uwIC1Value1_T17CH1 = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1);
				__HAL_TIM_SET_CAPTUREPOLARITY(htim, TIM_CHANNEL_1, TIM_INPUTCHANNELPOLARITY_FALLING);
				uhCaptureIndex_T17CH1 = 1;
			}
			else if(uhCaptureIndex_T17CH1 == 1)
			{
				/* Get the 2nd Input Capture value */
				uwIC1Value2_T17CH1 = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1); 
				__HAL_TIM_SET_CAPTUREPOLARITY(htim, TIM_CHANNEL_1, TIM_INPUTCHANNELPOLARITY_RISING);
				/* Capture computation */
				if (uwIC1Value2_T17CH1 > uwIC1Value1_T17CH1)
				{
					uwHighCapture_T17CH1 = (uwIC1Value2_T17CH1 - uwIC1Value1_T17CH1); 
				}
				else if (uwIC1Value2_T17CH1 < uwIC1Value1_T17CH1)
				{
					/* 0xFFFF is max TIM1_CCRx value */
					uwHighCapture_T17CH1 = ((0xFFFF - uwIC1Value1_T17CH1) + uwIC1Value2_T17CH1) + 1;
				}
				else
				{
					/* If capture values are equal, we have reached the limit of frequency
						 measures */
					Error_Handler();
				}
				uwIC1Value1_T17CH1 = uwIC1Value2_T17CH1;
				uhCaptureIndex_T17CH1 = 2;
				/* Frequency computation: for this example TIMx (TIM1) is clocked by
					 APB2Clk */      
			}
			else if(uhCaptureIndex_T17CH1 == 2)
			{
				uwIC1Value2_T17CH1 = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1); 
				if (uwIC1Value2_T17CH1 > uwIC1Value1_T17CH1)
				{
					uwLowCapture_T17CH1 = (uwIC1Value2_T17CH1 - uwIC1Value1_T17CH1); 
				}
				else if (uwIC1Value2_T17CH1 < uwIC1Value1_T17CH1)
				{
					/* 0xFFFF is max TIM1_CCRx value */
					uwLowCapture_T17CH1 = ((0xFFFF - uwIC1Value1_T17CH1) + uwIC1Value2_T17CH1) + 1;
				}
				uwFrequency_T17CH1 = 1000000 / (uwLowCapture_T17CH1 + uwHighCapture_T17CH1);
				uwDuty_T17CH1 = uwHighCapture_T17CH1 * 100.0 / (uwLowCapture_T17CH1 + uwHighCapture_T17CH1) ;
				uhCaptureIndex_T17CH1 = 0;
			}
		}
	}
}


char RxBuffer[30];
unsigned char BufIndex = 0;
unsigned char Rxdat;

void HAL_UART_RxCpltCallback(UART_HandleTypeDef * huart)
{
	if(huart->Instance == USART1)
	{
		RxBuffer[BufIndex++] = Rxdat;
		HAL_UART_Receive_IT(huart, &Rxdat, 1);
	}
}





main.h:

/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : main.h
  * @brief          : Header for main.c file.
  *                   This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2023 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32g4xx_hal.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */

/* USER CODE END ET */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */

/* USER CODE END EC */

/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */

/* USER CODE END EM */

/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);

/* USER CODE BEGIN EFP */

/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/

/* USER CODE BEGIN Private defines */
#define DATA 0
#define PARA 1
/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __MAIN_H */

main.h:

/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : main.c
  * @brief          : Main program body
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2023 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "adc.h"
#include "rtc.h"
#include "tim.h"
#include "usart.h"
#include "gpio.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "lcd.h"
#include "interrupt.h"
#include "stdio.h"
#include "badc.h"
#include "led.h"
#include "i2c.h"
#include "stdlib.h"
#include "string.h"
/* USER CODE END Includes */

/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */

/* USER CODE END PTD */

/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */

/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */

/* USER CODE END PM */

/* Private variables ---------------------------------------------------------*/

/* USER CODE BEGIN PV */
char text[30];
extern struct keys key[4];
double volt_adc2;
extern uint32_t uwFrequency_T17CH1;
extern double uwDuty_T17CH1;
double T, H;
double k1 = 80 / 3.3;
double b1 = -20;
double k2 = 80 / 9.0;
double b2 = 10 - 80 / 9.0;
unsigned int getTick;
double Ttemp[60];
double Htemp[60];
unsigned char count;
unsigned char getOverFlag = 1;
unsigned char eeprom_readData;
unsigned char eeprom_writeData;
RTC_TimeTypeDef Trtc;
RTC_DateTypeDef Drtc;
unsigned char Second = 61;
unsigned int MarkCount;
unsigned char DisplayMode;
unsigned int getTimeMs = 1000;
int Tthresold = 40;
int Hthresold = 80;
unsigned int PA1_Fre = 1000;
unsigned char SettingIndex;
extern char RxBuffer[30];
extern unsigned char BufIndex;
extern unsigned char Rxdat;
unsigned char LD1FlashFlag;
unsigned char LD2FlashFlag;
unsigned char LD1FlashTick;
unsigned char LD2FlashTick;
unsigned char LD1FlashType;
unsigned char LD2FlashType;
unsigned char LD3FlashType;
unsigned char LED;
/* USER CODE END PV */

/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
/* USER CODE BEGIN PFP */
void DisposeKey(void);
void LCD_Disp(void);
void Rx_Proc(void);
void LED_Control(void);
/* USER CODE END PFP */

/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */

/* USER CODE END 0 */

/**
  * @brief  The application entry point.
  * @retval int
  */
int main(void)
{
  /* USER CODE BEGIN 1 */

  /* 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_ADC2_Init();
  MX_RTC_Init();
  MX_TIM2_Init();
  MX_TIM3_Init();
  MX_TIM17_Init();
  MX_USART1_UART_Init();
  /* USER CODE BEGIN 2 */
  LCD_Init();
  LCD_Clear(Black);
  LCD_SetBackColor(Black);
  LCD_SetTextColor(White);
	Tthresold = eeprom_read(0) - 20;
	Hthresold = eeprom_read(1);
	getTimeMs = eeprom_read(2) * 1000;
	PA1_Fre = eeprom_read(3) * 100;
	__HAL_TIM_SET_PRESCALER(&htim2, 80000000 / 100 / PA1_Fre);
	HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_2);
	HAL_TIM_IC_Start_IT(&htim17, TIM_CHANNEL_1);
	getADC(&hadc2);
	HAL_Delay(2);
	for(unsigned char i = 0; i < 60; i++)
	{
		double Tsum = 0;
		double Hsum = 0;
		volt_adc2 = getADC(&hadc2) * 3.3 / 4096;
		Ttemp[i] = k1 * volt_adc2 + b1;
		Tsum += Ttemp[i];
		Htemp[i] = uwFrequency_T17CH1 / 1000.0 * k2 + b2;
		Hsum += Htemp[i];
		if(i == 59)
		{
			T = Tsum / 60.0;
			H = Hsum / 60.0;
		}
	}
  HAL_TIM_Base_Start_IT(&htim3);
	HAL_UART_Receive_IT(&huart1, &Rxdat, 1);
	LED_Disp(0x00);
  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
		HAL_RTC_GetDate(&hrtc, &Drtc, RTC_FORMAT_BIN);
		HAL_RTC_GetTime(&hrtc, &Trtc, RTC_FORMAT_BIN);
		if(uwTick - getTick > getTimeMs / 60)
		{
			getTick = uwTick;
			volt_adc2 = getADC(&hadc2) * 3.3 / 4096;
			Ttemp[count] = k1 * volt_adc2 + b1;
			Htemp[count] = uwFrequency_T17CH1 / 1000.0 * k2 + b2;
			count++;
			if(count == 60)
			{
				count = 0;
				getOverFlag = 1;
			}
		}
		if(uwTick - LD1FlashTick > 100)
		{
			if(LD1FlashFlag)
			{
				LD1FlashType = !LD1FlashType;
				LED = LED & 0xfe | (LD1FlashType << 0);
			}
		}
		if(uwTick - LD2FlashTick > 100)
		{
			if(LD2FlashFlag)
			{
				LD2FlashType = !LD2FlashType;
				LED = LED & 0xfd | (LD2FlashType << 1);
			}
		}
		if(getOverFlag)
		{
			getOverFlag = 0;
			for(unsigned char i = 0; i < 60; i++)
			{
				T += Ttemp[i];
				H += Htemp[i];
			}
			T = T / 60.0;
			H = H / 60.0;
			MarkCount++;
			LD3FlashType = !LD3FlashType;
			LED = LED & 0xfb | (LD3FlashType << 2);
		}
		if(BufIndex != 0)
		{
			unsigned char temp = BufIndex;
			HAL_Delay(1);
			if(BufIndex == temp)
				Rx_Proc();
		}
    DisposeKey();
		LCD_Disp();
		LED_Control();
		LED_Disp(LED);
  }
  /* USER CODE END 3 */
}

/**
  * @brief System Clock Configuration
  * @retval None
  */
void SystemClock_Config(void)
{
  RCC_OscInitTypeDef RCC_OscInitStruct = {0};
  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

  /** Configure the main internal regulator output voltage
  */
  HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1);

  /** Initializes the RCC Oscillators according to the specified parameters
  * in the RCC_OscInitTypeDef structure.
  */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV3;
  RCC_OscInitStruct.PLL.PLLN = 20;
  RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
  RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
  RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  {
    Error_Handler();
  }

  /** Initializes the CPU, AHB and APB buses clocks
  */
  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
                              |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;

  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
  {
    Error_Handler();
  }
}

/* USER CODE BEGIN 4 */
void DisposeKey(void)
{
  if(key[0].single_flag)
  {
		LCD_Clear(Black);
		if(DisplayMode == DATA)
		{
			DisplayMode = PARA;
		}
		else if(DisplayMode == PARA)
		{
			DisplayMode = DATA;
			eeprom_write(0, Tthresold + 20);
			HAL_Delay(10);
			eeprom_write(1, Hthresold);
			HAL_Delay(10);
			eeprom_write(2, getTimeMs / 1000);
			HAL_Delay(10);
			eeprom_write(3, PA1_Fre / 100);
		}
    key[0].single_flag = 0;
  }
	if(key[1].single_flag)
	{
		SettingIndex++;
		SettingIndex %= 4;
		key[1].single_flag = 0;
	}
	if(key[2].single_flag)
	{
		if(SettingIndex == 0)
		{
			if(Tthresold + 1 <= 60)
				Tthresold++;
		}
		else if(SettingIndex == 1)
		{
			if(Hthresold + 5 <= 90)
				Hthresold += 5;
		}
		else if(SettingIndex == 2)
		{
			if(getTimeMs + 1000 <= 5000)
				getTimeMs += 1000;
		}
		else if(SettingIndex == 3)
		{
			if(PA1_Fre + 500 <= 10000)
			{
				PA1_Fre += 500;
				__HAL_TIM_SET_PRESCALER(&htim2, 80000000 / 100 / PA1_Fre);
			}
		}
		key[2].single_flag = 0;
	}
	if(key[3].single_flag)
	{
		if(SettingIndex == 0)
		{
			if(Tthresold - 1 >= -20)
				Tthresold--;
		}
		else if(SettingIndex == 1)
		{
			if(Hthresold - 5 >= 10)
				Hthresold -= 5;
		}
		else if(SettingIndex == 2)
		{
			if(getTimeMs - 1000 >= 1000)
				getTimeMs -= 1000;
		}
		else if(SettingIndex == 3)
		{
			if(PA1_Fre - 500 >= 1000)
			{
				PA1_Fre -= 500;
				__HAL_TIM_SET_PRESCALER(&htim2, 80000000 / 100 / PA1_Fre);
			}
		}
		key[3].single_flag = 0;
	}
}

void LCD_Disp(void)
{
	if(DisplayMode == DATA)
	{
		LCD_DisplayStringLine(Line1, "        DATA");
		sprintf(text, "T:    %dC  ", (int)T);
		LCD_DisplayStringLine(Line3, text);
		sprintf(text, "H:    %d%%", (int)H);
		LCD_DisplayStringLine(Line5, text);
		if(Second != Trtc.Seconds)
		{
			sprintf(text, "RTC:  %02d-%02d-%02d", Trtc.Hours, Trtc.Minutes, Trtc.Seconds);
			LCD_DisplayStringLine(Line7, text);
		}
		sprintf(text, "      MarkCount:%d", MarkCount);
		LCD_DisplayStringLine(Line9, text);
	}
	if(DisplayMode == PARA)
	{
		LCD_DisplayStringLine(Line1, "        PARA");
		sprintf(text, "  Tthresold :%dC  ", Tthresold);
		if(SettingIndex == 0)
			LCD_SetTextColor(Green);
		LCD_DisplayStringLine(Line3, text);
		LCD_SetTextColor(White);
		sprintf(text, "  Hthresold :%d%% ", Hthresold);
		if(SettingIndex == 1)
			LCD_SetTextColor(Green);
		LCD_DisplayStringLine(Line5, text);
		LCD_SetTextColor(White);
		sprintf(text, "  geTime    :%dS", getTimeMs / 1000);
		if(SettingIndex == 2)
			LCD_SetTextColor(Green);
		LCD_DisplayStringLine(Line7, text);
		LCD_SetTextColor(White);
		sprintf(text, "  testFre   :%.1fKHz   ", PA1_Fre / 1000.0);
		if(SettingIndex == 3)
			LCD_SetTextColor(Green);
		LCD_DisplayStringLine(Line9, text);
		LCD_SetTextColor(White);
	}
}

void Rx_Proc(void)
{
	if(BufIndex == 1)
	{
		if(RxBuffer[0] == 'C')
		{
			printf("%02d-%02d-%02d:Tthresohold:%dC, Hthresold:%d%%\n", Trtc.Hours, Trtc.Minutes, Trtc.Seconds, Tthresold, Hthresold);
		}
		if(RxBuffer[0] == 'T')
		{
			for(unsigned char i = 0; i < 60; i++)
			{
				printf("%02d-%02d-%02d:Ttemp[%d]:%.2fC, Htemp[%d]:%.2f%%\n",  Trtc.Hours, Trtc.Minutes, Trtc.Seconds, i, Ttemp[i], i, Htemp[i]);
			}
		}
	}
	BufIndex = 0;
	memset(RxBuffer, 0, 30);
}

int fputc(int ch, FILE * f)
{
	HAL_UART_Transmit(&huart1, (unsigned char *)&ch, 1, HAL_MAX_DELAY);
	return ch;
}

void LED_Control(void)
{
	if(T > (double)Tthresold)
	{
		LD1FlashFlag = 1;
	}
	else
	{
		LD1FlashFlag = 0;
		LD1FlashType = 0;
		LD1FlashTick = uwTick;
		LED = LED & 0xfe;
	}
	if(H > (double)Hthresold)
	{
		LD2FlashFlag = 1;
	}
	else
	{
		LD2FlashFlag = 0;
		LD2FlashType = 0;
		LD2FlashTick = uwTick;
		LED = LED & 0xfd;
	}
}
/* USER CODE END 4 */

/**
  * @brief  This function is executed in case of error occurrence.
  * @retval None
  */
void Error_Handler(void)
{
  /* USER CODE BEGIN Error_Handler_Debug */
  /* User can add his own implementation to report the HAL error return state */
  __disable_irq();
  while (1)
  {
  }
  /* USER CODE END Error_Handler_Debug */
}

#ifdef  USE_FULL_ASSERT
/**
  * @brief  Reports the name of the source file and the source line number
  *         where the assert_param error has occurred.
  * @param  file: pointer to the source file name
  * @param  line: assert_param error line source number
  * @retval None
  */
void assert_failed(uint8_t *file, uint32_t line)
{
  /* USER CODE BEGIN 6 */
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
  /* USER CODE END 6 */
}
#endif /* USE_FULL_ASSERT */

四、完成效果

蓝桥杯嵌入式第七届国赛试题实现效果

五、总结

本篇文章只是为了存放我的代码,所以看不懂很正常,如果需要代码可以找我私信。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/549236.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

手撕代码——同步FIFO

手撕代码——同步FIFO 一、FIFO原理与设计二、完整代码与仿真结果三、仿真结果 一、FIFO原理与设计 查看Xilinx官方FIFO IP核&#xff0c;其主要的信号有时钟信号、写端口信号、读端口信号&#xff0c;其中&#xff0c;写端口信号包括写满信号full、写使能信号wr_en、写数据输入…

[元带你学: eMMC完全解读 7] eMMC 设备与系统概述

依JEDEC eMMC 5.1及经验辛苦整理,付费内容,禁止转载。 所在专栏 《元带你学: eMMC完全解读》 前言 全文3600 字, 全文介绍eMMC 内部系统框架, Bus 总线宽度, 总线Speed Mode, 了解即可。对应Bus 总线重点看 8 Bit 即可, Speed Mode 重点看 HS400。几乎所有的系统都是跑在…

Java并发编程-synchronized

目录 1. synchronized在jdk 1.6中的优化 1.1 锁消除 1.2 锁粗化 1.2 锁升级/锁膨胀 1.2.1 锁升级原理 1.2.2 自适应自旋锁 2. synchronized实现原理 3. synchronized和Lock的对比 1. synchronized在jdk 1.6中的优化 在JDK1.5的时候,Doug Lee推出了ReentrantLock,lock的…

【密码学复习】第九讲 密钥管理(一)

密钥管理简介 • 柯克霍夫斯原则(Kerckhoffs Principle) 即使密码系统的任何细节已为人悉知&#xff0c;只要密钥未泄漏&#xff0c;它也应是安全的(19世纪). 密钥安全&#xff1a;三分技术&#xff0c;七分管理 密钥管理就是在授权各方之间实现密钥关系的建立和维护…

dom4j 读取xml配置文件,根据配置文件利用反射创建对象

pom.xml <?xml version"1.0" encoding"UTF-8"?> <project xmlns"http://maven.apache.org/POM/4.0.0"xmlns:xsi"http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation"http://maven.apache.org/POM/4.0.0 …

maven打包命令打出的可执行的jar包和可依赖的jar包的区别

目录 引出问题: 介绍打包插件 下面开始打包: 解压比较这两个jar包的区别: 引出问题: 当我建了一个maven的springboot项目A写了一个工具类,我把A项目打包成jar包去给B项目用,结果 B项目报错找不到这个jar包. 百度后发现原来jar包分为可执行jar包和可被依赖的jar包 介绍打包…

二、医院设置管理

文章目录 一、医院设置管理1、项目开发流程1.1 定义路由模块1.2 定义api模块1.3 定义页面组件脚本1.4 定义页面组件模板1.5 测试数据通信1.6 跨域处理 2、分页查询2.1 定义页面组件脚本2.2 定义页面组件模板2.3 表单查询 3、删除3.1 定义api模块3.2 定义页面组件模板3.3 定义页…

Midjourney|文心一格prompt教程[进阶篇]:Midjourney Prompt 高级参数、各版本差异、官方提供常见问题

Midjourney|文心一格prompt教程[进阶篇]&#xff1a;Midjourney Prompt 高级参数、各版本差异、官方提供常见问题 1.Midjourney Prompt 高级参数 Quality 图片质量是另一个我比较常用的属性&#xff0c;首先需要注意这个参数并不影响分辨率&#xff0c;并不改变分辨率&#x…

【C++】实现一个日期计算器

&#x1f307;个人主页&#xff1a;平凡的小苏 &#x1f4da;学习格言&#xff1a;命运给你一个低的起点&#xff0c;是想看你精彩的翻盘&#xff0c;而不是让你自甘堕落&#xff0c;脚下的路虽然难走&#xff0c;但我还能走&#xff0c;比起向阳而生&#xff0c;我更想尝试逆风…

线程池学习

一、线程池的7个核心参数说明&#xff1a; corePoolSize&#xff1a;核心线程数 maximumPoolSize&#xff1a;最大线程数 keepAliveTime&#xff1a;最大空闲时间 unit&#xff1a;最大空闲时间单位 workQueue&#xff1a;任务队列 threadFactory&#xff1a;表示生成线程…

1.Hyperledger Fabric架构介绍

&#xff08;1&#xff09;Hyperledger定义&#xff1a; Hyperledger是一个开放源代码的区块链项目合作组织&#xff0c;旨在推动跨行业的企业级区块链解决方案的发展。该项目由Linux基金会于2015年发起&#xff0c;致力于建立一个可靠、安全和可扩展的区块链框架和工具集。Hy…

堆结构 - 大根堆、小根堆

在开发语言中&#xff0c;heap在使用层次的名字叫PriorityQueue&#xff08;优先级队列&#xff09;&#xff0c;PriorityQueue数据结构的名字就叫做堆&#xff0c;底层就是用堆结构实现的。 完全二叉树 空树也算是完全二叉树每一层都是满的也算是完全二叉树如果层不满&#…

魔改车钥匙实现远程控车:(番外)在macOS上安装使用MicroPython

前言 哈哈&#xff0c;各位可能会奇怪为啥上一篇文章还在说怎么在 ESP32C3 上安装 Arduino&#xff0c;现在怎么又变成了安装 MIcroPython。 其实是因为上次写 Arduino 还是我高中时候的事了&#xff0c;已经不太会了。 虽然 MIcroPython 我从来没有接触过&#xff0c;但是 …

Microsoft Office 2003的安装

哈喽&#xff0c;大家好。今天一起学习的是office2003的安装&#xff0c;这个老版本的office可是XP操作系统的老搭档了&#xff0c;有兴趣的小伙伴也可以来一起试试手。 一、测试演示参数 演示操作系统&#xff1a;Windows XP 不建议win7及以上操作系统使用 系统类型&#xff…

Springboot 搭建WebService客户端+服务端

WebService简介 Web Service技术&#xff0c; 能使得运行在不同机器上的不同应用无须借助附加的、专门的第三方软件或硬件&#xff0c; 就可相互交换数据或集成。依据Web Service规范实施的应用之间&#xff0c; 无论它们所使用的语言、 平台或内部协议是什么&#xff0c; 都可…

软件设计和架构设计

软件设计和架构设计 1.软件设计 1.1设计 设计是从架构 构件 接口以及系统其他特征定义的过程。 软件设计的结果必须描述系统的架构&#xff0c;系统如何分解和组织构件。 描述构件间的接口。 描述构件必须详细到可进一步构造的程度。 设计是把分析模型转换成设计模型的过…

三个帮助你整理信息的桌面 WiKi

如果你想在桌面上感受 wiki&#xff0c;而不用做那些复杂的工作&#xff0c;这很容易做到。这有一些轻量级 wiki&#xff0c;可以帮助你组织你的信息、跟踪你的任务、管理你的笔记等等。 这个词时&#xff0c;可能会想到 MediaWiki 或 DokuWiki 这样的例子。它们开源、好用、强…

Go 并发之channel(通道)

一、前言 作为 Go 语言最有特色的数据类型&#xff0c;通道&#xff08;channel&#xff09;完全可以与 goroutine&#xff08;也可称为 go 程&#xff09;并驾齐驱&#xff0c;共同代表 Go 语言独有的并发编程模式和编程哲学。 通道&#xff08;channel&#xff09;可以利用…

TOGAF架构开发方法—G阶段:实施治理

本章提供了对实现的体系结构监督。 一、目标 G阶段的目标是&#xff1a; 通过实施项目确保符合目标架构为解决方案和任何实施驱动的架构更改请求执行适当的架构管理功能 二、 输入 本节定义阶段 G 的输入。 1 、企业外部参考物质 架构参考资料 2、 非架构输入 架构工作请…

K8s之污点、容忍度与Pod重启策略详解

文章目录 一、污点-Taint二、容忍度-Tolerations二、Pod重启策略1、Pod常见状态2、Pod重启策略 一、污点-Taint 在 Kubernetes 中&#xff0c;污点&#xff08;Taint&#xff09;是一种标记&#xff0c;用于标识一个Node节点上的某些资源或条件不可用或不可接受。当一个节点被…