【STM32】STM32学习笔记-对射式红外传感器计次 旋转编码器计次(12)

00. 目录

文章目录

    • 00. 目录
    • 01. NVIC相关函数
      • 1.1 NVIC_PriorityGroupConfig函数
      • 1.2 NVIC_PriorityGroup类型
      • 1.3 NVIC_Init函数
      • 1.4 NVIC_InitTypeDef类型
    • 02. 外部中断相关API
      • 2.1 GPIO_EXTILineConfig
      • 2.2 EXTI_Init
      • 2.3 EXTI_GetITStatus
      • 2.4 EXTI_ClearITPendingBit
      • 2.5 中断回调函数
    • 03. 对射式红外传感器计次接线图
    • 04. 对射式红外传感器计次程序示例
    • 05. 旋转编码器计次接线图
    • 06. 旋转编码器计次程序示例
    • 07. 示例程序下载
    • 08. 附录

01. NVIC相关函数

相关头文件: misc.h

1.1 NVIC_PriorityGroupConfig函数

/*** @brief  Configures the priority grouping: pre-emption priority and subpriority.* @param  NVIC_PriorityGroup: specifies the priority grouping bits length. *   This parameter can be one of the following values:*     @arg NVIC_PriorityGroup_0: 0 bits for pre-emption priority*                                4 bits for subpriority*     @arg NVIC_PriorityGroup_1: 1 bits for pre-emption priority*                                3 bits for subpriority*     @arg NVIC_PriorityGroup_2: 2 bits for pre-emption priority*                                2 bits for subpriority*     @arg NVIC_PriorityGroup_3: 3 bits for pre-emption priority*                                1 bits for subpriority*     @arg NVIC_PriorityGroup_4: 4 bits for pre-emption priority*                                0 bits for subpriority* @retval None*/
void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
功能:设置优先级分组:先占优先级和从优先级
参数:NVIC_PriorityGroup:优先级分组位长度     
返回值:

1.2 NVIC_PriorityGroup类型

/** @defgroup Preemption_Priority_Group * @{*/#define NVIC_PriorityGroup_0         ((uint32_t)0x700) /*!< 0 bits for pre-emption priority4 bits for subpriority */
#define NVIC_PriorityGroup_1         ((uint32_t)0x600) /*!< 1 bits for pre-emption priority3 bits for subpriority */
#define NVIC_PriorityGroup_2         ((uint32_t)0x500) /*!< 2 bits for pre-emption priority2 bits for subpriority */
#define NVIC_PriorityGroup_3         ((uint32_t)0x400) /*!< 3 bits for pre-emption priority1 bits for subpriority */
#define NVIC_PriorityGroup_4         ((uint32_t)0x300) /*!< 4 bits for pre-emption priority0 bits for subpriority */

1.3 NVIC_Init函数

/*** @brief  Initializes the NVIC peripheral according to the specified*         parameters in the NVIC_InitStruct.* @param  NVIC_InitStruct: pointer to a NVIC_InitTypeDef structure that contains*         the configuration information for the specified NVIC peripheral.* @retval None*/
void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct)
功能:根据 NVIC_InitStruct 中指定的参数初始化外设 NVIC 寄存器
参数:NVIC_InitStruct:指向结构 NVIC_InitTypeDef 的指针,包含了外设 GPIO 的配置信息     
返回值:

1.4 NVIC_InitTypeDef类型

typedef struct
{uint8_t NVIC_IRQChannel; //指定要启用或禁用的IRQ通道uint8_t NVIC_IRQChannelPreemptionPriority;//指定的IRQ通道的抢占优先级uint8_t NVIC_IRQChannelSubPriority; //指定的IRQ通道的次级优先级FunctionalState NVIC_IRQChannelCmd; //IRQ通道是启用还是禁用 
} NVIC_InitTypeDef;

NVIC_IRQChannel取值

#ifdef STM32F10X_MDADC1_2_IRQn                 = 18,     /*!< ADC1 and ADC2 global Interrupt                       */USB_HP_CAN1_TX_IRQn         = 19,     /*!< USB Device High Priority or CAN1 TX Interrupts       */USB_LP_CAN1_RX0_IRQn        = 20,     /*!< USB Device Low Priority or CAN1 RX0 Interrupts       */CAN1_RX1_IRQn               = 21,     /*!< CAN1 RX1 Interrupt                                   */CAN1_SCE_IRQn               = 22,     /*!< CAN1 SCE Interrupt                                   */EXTI9_5_IRQn                = 23,     /*!< External Line[9:5] Interrupts                        */TIM1_BRK_IRQn               = 24,     /*!< TIM1 Break Interrupt                                 */TIM1_UP_IRQn                = 25,     /*!< TIM1 Update Interrupt                                */TIM1_TRG_COM_IRQn           = 26,     /*!< TIM1 Trigger and Commutation Interrupt               */TIM1_CC_IRQn                = 27,     /*!< TIM1 Capture Compare Interrupt                       */TIM2_IRQn                   = 28,     /*!< TIM2 global Interrupt                                */TIM3_IRQn                   = 29,     /*!< TIM3 global Interrupt                                */TIM4_IRQn                   = 30,     /*!< TIM4 global Interrupt                                */I2C1_EV_IRQn                = 31,     /*!< I2C1 Event Interrupt                                 */I2C1_ER_IRQn                = 32,     /*!< I2C1 Error Interrupt                                 */I2C2_EV_IRQn                = 33,     /*!< I2C2 Event Interrupt                                 */I2C2_ER_IRQn                = 34,     /*!< I2C2 Error Interrupt                                 */SPI1_IRQn                   = 35,     /*!< SPI1 global Interrupt                                */SPI2_IRQn                   = 36,     /*!< SPI2 global Interrupt                                */USART1_IRQn                 = 37,     /*!< USART1 global Interrupt                              */USART2_IRQn                 = 38,     /*!< USART2 global Interrupt                              */USART3_IRQn                 = 39,     /*!< USART3 global Interrupt                              */EXTI15_10_IRQn              = 40,     /*!< External Line[15:10] Interrupts                      */RTCAlarm_IRQn               = 41,     /*!< RTC Alarm through EXTI Line Interrupt                */USBWakeUp_IRQn              = 42      /*!< USB Device WakeUp from suspend through EXTI Line Interrupt */  
#endif /* STM32F10X_MD */  

成员NVIC_IRQChannelPreemptionPriority可赋的值:最大取值15,具体有上面设置的优先级组中规定的位数决定
成员NVIC_IRQChannelSubPriority可赋的值:最大取值15,具体有上面设置的优先级组中规定的位数决定
成员NVIC_IRQChannelCmd可赋的值:ENABLE or DISABLE

02. 外部中断相关API

2.1 GPIO_EXTILineConfig

void GPIO_EXTILineConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource);
功能:选择 GPIO 管脚用作外部中断线路
参数:GPIO_PortSource: 选择用作外部中断线源的 GPIO 端口GPIO_PinSource:待设置的外部中断线路    
返回值:

参数:GPIO_PortSource 选择用于EXTI线的GPIO端口

/** @defgroup GPIO_Port_Sources * @{*/#define GPIO_PortSourceGPIOA       ((uint8_t)0x00)
#define GPIO_PortSourceGPIOB       ((uint8_t)0x01)
#define GPIO_PortSourceGPIOC       ((uint8_t)0x02)
#define GPIO_PortSourceGPIOD       ((uint8_t)0x03)
#define GPIO_PortSourceGPIOE       ((uint8_t)0x04)
#define GPIO_PortSourceGPIOF       ((uint8_t)0x05)
#define GPIO_PortSourceGPIOG       ((uint8_t)0x06)

参数:GPIO_PortSource 选择用于EXTI线的GPIO端口

/** @defgroup GPIO_Pin_sources * @{*/#define GPIO_PinSource0            ((uint8_t)0x00)
#define GPIO_PinSource1            ((uint8_t)0x01)
#define GPIO_PinSource2            ((uint8_t)0x02)
#define GPIO_PinSource3            ((uint8_t)0x03)
#define GPIO_PinSource4            ((uint8_t)0x04)
#define GPIO_PinSource5            ((uint8_t)0x05)
#define GPIO_PinSource6            ((uint8_t)0x06)
#define GPIO_PinSource7            ((uint8_t)0x07)
#define GPIO_PinSource8            ((uint8_t)0x08)
#define GPIO_PinSource9            ((uint8_t)0x09)
#define GPIO_PinSource10           ((uint8_t)0x0A)
#define GPIO_PinSource11           ((uint8_t)0x0B)
#define GPIO_PinSource12           ((uint8_t)0x0C)
#define GPIO_PinSource13           ((uint8_t)0x0D)
#define GPIO_PinSource14           ((uint8_t)0x0E)
#define GPIO_PinSource15           ((uint8_t)0x0F)

2.2 EXTI_Init

void EXTI_Init(EXTI_InitTypeDef* EXTI_InitStruct);
功能:根据 EXTI_InitStruct 中指定的参数初始化外设 EXTI 寄存器
参数:EXTI_InitStruct:指向结构 EXTI_InitTypeDef 的指针,包含了外设 EXTI 的配置信息 
返回值:

EXTI_InitTypeDef类型

typedef struct
{uint32_t EXTI_Line; 				//中断线EXTIMode_TypeDef EXTI_Mode; 		//中断模式EXTITrigger_TypeDef EXTI_Trigger; 	//中断触发方式FunctionalState EXTI_LineCmd; 		//中断功能使能
}EXTI_InitTypeDef;

EXTI_Line

/** @defgroup EXTI_Lines * @{*/#define EXTI_Line0       ((uint32_t)0x00001)  /*!< External interrupt line 0 */
#define EXTI_Line1       ((uint32_t)0x00002)  /*!< External interrupt line 1 */
#define EXTI_Line2       ((uint32_t)0x00004)  /*!< External interrupt line 2 */
#define EXTI_Line3       ((uint32_t)0x00008)  /*!< External interrupt line 3 */
#define EXTI_Line4       ((uint32_t)0x00010)  /*!< External interrupt line 4 */
#define EXTI_Line5       ((uint32_t)0x00020)  /*!< External interrupt line 5 */
#define EXTI_Line6       ((uint32_t)0x00040)  /*!< External interrupt line 6 */
#define EXTI_Line7       ((uint32_t)0x00080)  /*!< External interrupt line 7 */
#define EXTI_Line8       ((uint32_t)0x00100)  /*!< External interrupt line 8 */
#define EXTI_Line9       ((uint32_t)0x00200)  /*!< External interrupt line 9 */
#define EXTI_Line10      ((uint32_t)0x00400)  /*!< External interrupt line 10 */
#define EXTI_Line11      ((uint32_t)0x00800)  /*!< External interrupt line 11 */
#define EXTI_Line12      ((uint32_t)0x01000)  /*!< External interrupt line 12 */
#define EXTI_Line13      ((uint32_t)0x02000)  /*!< External interrupt line 13 */
#define EXTI_Line14      ((uint32_t)0x04000)  /*!< External interrupt line 14 */
#define EXTI_Line15      ((uint32_t)0x08000)  /*!< External interrupt line 15 */
#define EXTI_Line16      ((uint32_t)0x10000)  /*!< External interrupt line 16 Connected to the PVD Output */
#define EXTI_Line17      ((uint32_t)0x20000)  /*!< External interrupt line 17 Connected to the RTC Alarm event */
#define EXTI_Line18      ((uint32_t)0x40000)  /*!< External interrupt line 18 Connected to the USB Device/USB OTG FSWakeup from suspend event */                                    
#define EXTI_Line19      ((uint32_t)0x80000)  /*!< External interrupt line 19 Connected to the Ethernet Wakeup event */

成员EXTI_Mode可赋的值:(中断模式)

typedef enum
{EXTI_Mode_Interrupt = 0x00,//中断EXTI_Mode_Event = 0x04   //事件
}EXTIMode_TypeDef;

成员EXTI_Trigger可赋的值(中断)

typedef enum
{EXTI_Trigger_Rising = 0x08, //上升沿触发EXTI_Trigger_Falling = 0x0C, //下降沿触发EXTI_Trigger_Rising_Falling = 0x10 //双边延触发
}EXTITrigger_TypeDef;

成员EXTI_LineCmd可赋的值: ENABLE or DISABLE

2.3 EXTI_GetITStatus

/*** @brief  Checks whether the specified EXTI line is asserted or not.* @param  EXTI_Line: specifies the EXTI line to check.*   This parameter can be:*     @arg EXTI_Linex: External interrupt line x where x(0..19)* @retval The new state of EXTI_Line (SET or RESET).*/
ITStatus EXTI_GetITStatus(uint32_t EXTI_Line)
功能:检查指定的 EXTI 线路触发请求发生与否
参数:EXTI_Line:待检查 EXTI 线路的挂起位 
返回值:EXTI_Line 的新状态(SET 或者 RESET) 

2.4 EXTI_ClearITPendingBit

/*** @brief  Clears the EXTI's line pending bits.* @param  EXTI_Line: specifies the EXTI lines to clear.*   This parameter can be any combination of EXTI_Linex where x can be (0..19).* @retval None*/
void EXTI_ClearITPendingBit(uint32_t EXTI_Line)
功能:清除 EXTI 线路挂起位
参数:EXTI_Line:待清除 EXTI 线路的挂起位 
返回值:

2.5 中断回调函数

EXPORT EXTI0_IRQHandler
EXPORT EXTI1_IRQHandler
EXPORT EXTI2_IRQHandler
EXPORT EXTI3_IRQHandler
EXPORT EXTI4_IRQHandler
EXPORT EXTI9_5_IRQHandler
EXPORT EXTI15_10_IRQHandler

常用的中断服务函数格式为:

void EXTI3_IRQHandler(void)
{if(EXTI_GetITStatus(EXTI_Line3)!=RESET)//判断某个线上的中断是否发生{//中断逻辑…EXTI_ClearITPendingBit(EXTI_Line3); //清除 LINE 上的中断标志位} 
}

03. 对射式红外传感器计次接线图

在这里插入图片描述

04. 对射式红外传感器计次程序示例

CountSensor.h

#ifndef __COUNT_SENSOR_H__
#define __COUNT_SENSOR_H__#include "stm32f10x.h" void count_sensor_init(void);uint16_t CountSensor_Get(void);#endif /*__COUNT_SENSOR_H__*/

CountSensor.c

#include "CountSensor.h"uint16_t CountSensor_Count = 0;//初始化
void count_sensor_init(void)
{GPIO_InitTypeDef GPIO_InitStruct;EXTI_InitTypeDef EXTI_InitStruct;NVIC_InitTypeDef NVIC_InitStruct;//使能时钟RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);//初始化GPIOGPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU ;GPIO_InitStruct.GPIO_Pin = GPIO_Pin_14;GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOB, &GPIO_InitStruct);//初始化外部中断线GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource14);//初始化外部中断EXTI_InitStruct.EXTI_Line = EXTI_Line14;EXTI_InitStruct.EXTI_LineCmd = ENABLE ;EXTI_InitStruct.EXTI_Mode = EXTI_Mode_Interrupt;EXTI_InitStruct.EXTI_Trigger = EXTI_Trigger_Falling;EXTI_Init(&EXTI_InitStruct);//初始化NVICNVIC_InitStruct.NVIC_IRQChannel = EXTI15_10_IRQn;NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE ;NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = 1;NVIC_InitStruct.NVIC_IRQChannelSubPriority = 1;NVIC_Init(&NVIC_InitStruct);
}uint16_t CountSensor_Get(void)
{return CountSensor_Count;
}void EXTI15_10_IRQHandler(void)
{if (EXTI_GetITStatus(EXTI_Line14) == SET){/*如果出现数据乱跳的现象,可再次判断引脚电平,以避免抖动*/if (GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_14) == 0){CountSensor_Count ++;}EXTI_ClearITPendingBit(EXTI_Line14);}
}

main.c

#include "stm32f10x.h"#include "delay.h"
#include "oled.h"
#include "CountSensor.h"int main(void){		 //初始化OLED_Init();OLED_ShowString(1, 1, "Count:");NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);count_sensor_init();while(1){OLED_ShowNum(1 , 7, CountSensor_Get(), 5);}return 0;}

05. 旋转编码器计次接线图

在这里插入图片描述

【其它】

在这里插入图片描述

06. 旋转编码器计次程序示例

encode.h

#ifndef __ENCODE_H__
#define __ENCODE_H__#include "stm32f10x.h"   void Encoder_Init(void);
int16_t Encoder_Get(void);#endif /*__ENCODE_H__*/

encode.c

#include "encode.h"int16_t Encoder_Count;void Encoder_Init(void)
{NVIC_InitTypeDef NVIC_InitStructure;GPIO_InitTypeDef GPIO_InitStructure;EXTI_InitTypeDef EXTI_InitStructure;RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1;GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOB, &GPIO_InitStructure);GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource0);GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource1);EXTI_InitStructure.EXTI_Line = EXTI_Line0 | EXTI_Line1;EXTI_InitStructure.EXTI_LineCmd = ENABLE;EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;EXTI_Init(&EXTI_InitStructure);NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;NVIC_Init(&NVIC_InitStructure);NVIC_InitStructure.NVIC_IRQChannel = EXTI1_IRQn;NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;NVIC_Init(&NVIC_InitStructure);
}int16_t Encoder_Get(void)
{int16_t Temp;Temp = Encoder_Count;Encoder_Count = 0;return Temp;
}void EXTI0_IRQHandler(void)
{if (EXTI_GetITStatus(EXTI_Line0) == SET){/*如果出现数据乱跳的现象,可再次判断引脚电平,以避免抖动*/if (GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_0) == 0){if (GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_1) == 0){Encoder_Count --;}}EXTI_ClearITPendingBit(EXTI_Line0);}
}void EXTI1_IRQHandler(void)
{if (EXTI_GetITStatus(EXTI_Line1) == SET){/*如果出现数据乱跳的现象,可再次判断引脚电平,以避免抖动*/if (GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_1) == 0){if (GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_0) == 0){Encoder_Count ++;}}EXTI_ClearITPendingBit(EXTI_Line1);}
}

main.c

#include "stm32f10x.h"#include "delay.h"
#include "oled.h"
#include "CountSensor.h"
#include "encode.h"int16_t Num;int main(void){		 //初始化OLED_Init();NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);Encoder_Init();OLED_ShowString(1, 1, "Num:");while (1){Num += Encoder_Get();OLED_ShowSignedNum(1, 5, Num, 5);}return 0;}

07. 示例程序下载

07-对射式红外传感器计次.rar

08-旋转编码器计次.rar

08. 附录

参考: 【STM32】江科大STM32学习笔记汇总

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

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

详细解析POI 和 EasyExcel

在数据量需要被批量导入、导出的时候&#xff0c;就可以使用POI和easyExcel 常用场景&#xff1a; 1、将用户信息导出为excel表格(导出数据…) 2、将Excel表中的信息录入到网站数据库&#xff08;习题上传…&#xff09;大大减轻网站录入量!开发中经常会设计到excel的处理&am…

NNDL 作业11 LSTM [HBU ]

目录 习题6-4 推导LSTM网络中参数的梯度&#xff0c; 并分析其避免梯度消失的效果 >LSTM前向传播 >反向传播 求梯度 >梯度消失和梯度爆炸怎么来的&#xff1f; >关键点&#xff1a;LSTM如何缓解梯度消失&#xff1f; 习题6-3P 编程实现下图LSTM运行过程 1…

uniapp中uni-data-select下拉框组件如何去除边框?

在目录中找到文件夹。 找到下拉框组件文件夹 注释该文件夹以下代码就能实现下拉框不带边框。

主从reactor多线程实现

现场模型图片&#xff0c;从网上找的 出于学习的目的实现的&#xff0c;如有不对的地方欢迎留言知道&#xff0c;简单实现了http的请求&#xff0c;可通过postman进行访问 启动项目&#xff1a; 返回数据示例 postman请求 附上源码&#xff0c;有问题直接看源码吧

java21特性学习

jdk21下载地址 JDK21文件 JDK21是javaSE平台最新的长期支持版本。 Java SE Java Archive | Oracle JDK21版本说明 JDK 21 Release Notes, Important Changes, and Information JavaSE 版本字符串格式 Version-String Format JavaSE平台采用了基于时间的发布模型,JDK每六个…

晚期食管癌肿瘤治疗线程分类

文章目录 1、肿瘤治疗的线数1.1 基础概念1.2 线程定义1.3 如何计算治疗线数 2 食管癌治疗指南2.1 食管癌诊疗指南2.1 CSCO 本文前半部分主要来源于参考文件1&#xff0c;其余部分来源于官方指南。无原创内容&#xff0c;全部为摘要。 1、肿瘤治疗的线数 1.1 基础概念 抗肿瘤药…

前后端传参:掌握FormData并解决form-data类型传参问题

目录 第一章 解决问题过程 第二章 对form-data的理解 2.1 使用场景 2.2 了解formData对象的创建与使用 2.3 formData常用方法 2.3.1 构造函数 2.3.2 获取数据 2.3.3 添加数据 2.3.4 修改数据 2.3.5 检查是否有该数据 2.3.6 删除数据 2.3.7 遍历formData里的键值对…

Charles 安装与激活

步骤 1&#xff1a;购买 Charles 许可证 访问 Charles 官方网站&#xff1a;https://www.charlesproxy.com/ 在网站上查找并选择 “Buy” 或类似的选项。 选择适合你需求的许可证类型&#xff0c;填写相关信息并完成购买。 如果不想购买可点击此链接Charles 步骤 2&#xff…

深入探讨线程池及其关键参数

目录 引言 1. 线程池概述 2. 线程池的工作原理 3. 线程池的关键参数 4. 线程池的最佳实践 5. 实际应用场景 结论 引言 在并发编程领域&#xff0c;线程池是一种重要的工具&#xff0c;用于管理和重用线程&#xff0c;提高程序的性能和效率。线程池可以有效地管理线程的生…

小红书kop营销策略有哪些,达人投放总结!

从kol到koc&#xff0c;当今时代产品种草模式&#xff0c;层出不穷。品牌想要跟上市场更新迭代的洪流&#xff0c;就需要时刻了解新型的营销方式。那么对于新型的kop模式你了解多少呢?我们今天就将详细分享小红书kop营销策略有哪些&#xff0c;达人投放总结&#xff01; 一、什…

Docker容器如何优雅地访问宿主机网络

# 前言 某些时候&#xff0c;我们会有在容器内容访问宿主机某个服务的需求&#xff0c;比如现在 openai 无法直接访问&#xff0c;需要给项目添加代理&#xff0c;我的 chatgpt-dingtalk (opens new window) 项目支持了通过环境变量指定代理地址。 添加方式如下&#xff1a; …

【Linux】sed命令使用

sed 命令 sed全称是&#xff1a;Stream EDitor。 sed 命令是利用脚本来处理文本文件。sed 一次只读取一行文本到缓冲区&#xff0c;然后读取命令&#xff0c;对此行进行编辑&#xff0c;然后读取下一行&#xff0c;重复此过程直到结束。 sed 与 vi 的区别 【Linux】 vi / v…