keil 编程遇到关于数组问题

#include
typedef unsigned int u16;
typedef unsigned char u8;
#define GPIO_DIG P0
#define GPIO_KEY P1
#define GPIOdongtai_ P3
sbit LSA=P2^2;
sbit LSB=P2^3;
sbit LSC=P2^4;
sbit JIDIANQI=P2^0;
sbit FENGMINGQI=P2^1;
u8 code smg[8]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07};
u8 code b[8]={0,1,2,3,4,5,6,7};
void fengmingqi ();
void jidianqi ();
void juzhenanjian (u8 a,u8 i);
void panduan (u8 a,u8 i);
void xianshi (u8 a,u8 j);
void delay (u16 i);
void main ()
{
u8 a [8]={0,0,0,0,0,0,0,0};
while(1)
{
u8 t=500000;
juzhenanjian(a,8);
while(t--)
{
xianshi(a,8);
}
panduan(a,8);
}
}
void juzhenanjian (u8 a,u8 i)
{
u8 cishu=0;
u8 key=0;
while(cishu<=7)
{
GPIO_KEY=0x0f;
if(GPIO_KEY!=0x0f)
{
delay(100);
cishu++;
if(GPIO_KEY!=0x0f)
{
switch(GPIO_KEY)
{
case(0X07): key=0;break;
case(0X0b): key=1;break;
case(0X0d): key=2;break;
case(0X0e): key=3;break;
}
GPIO_KEY=0xf0;
switch(GPIO_KEY)
{
case(0X70): key=key;break;
case(0Xb0): key=key+4;break;
}
while((a<50)&&(GPIO_KEY!=0xf0))
{
delay(1000);
a++;
}
}
}
a[cishu]=key;
GPIO_DIG=~smg[key];
}
}
void xianshi (u8 a,u8 j)
{
u8 i;
for(i=0;i<=7;i++)
{
switch(a[i])
{
case(0):
LSA=0;LSB=0;LSC=0; break;
case(1):
LSA=1;LSB=0;LSC=0; break;
case(2):
LSA=0;LSB=1;LSC=0; break;
case(3):
LSA=1;LSB=1;LSC=0; break;
case(4):
LSA=0;LSB=0;LSC=1; break;
case(5):
LSA=1;LSB=0;LSC=1; break;
case(6):
LSA=0;LSB=1;LSC=1; break;
case(7):
LSA=1;LSB=1;LSC=1; break;

}
GPIOdongtai_=smg[a[i]];
delay(100);
GPIOdongtai_=0x00;
}
}
void panduan (u8 a,u8 t)
{
u8 kaiguan=0,i=0,j=0;
while(a[i]==b[j])
{
i++;j++;
if(i==8)
kaiguan=1;
}
if(kaiguan)
jidianqi();

else if (kaiguan==0)

fengmingqi ();

}
void jidianqi ()
{
JIDIANQI=0;
delay(100000);
}
void fengmingqi ()
{
u8 i=10000;
while(i--)
{
FENGMINGQI=~FENGMINGQI;
delay(10);
}
}
void delay (u16 i)
{
while(i--);
}
系统说 a[cishu]=key有错

1个回答

你好。
a是在main函数中定义的一个数组,你在调用juzhenanjian函数时,实际上传递过去的参数是a数组的首地址
而你定义的函数是void juzhenanjian (u8 a,u8 i),参数中的u8 a 表示一个u8变量,应该修改为u8 a[8].
你的问题属于对C语言变量、地址的概念等不清晰,希望可以多巩固下基础。
C语言中,地址、指针等概念很重要。
希望多思考,加油。

qq_39985377
qq_39985377 嗯嗯,谢谢大师
2 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
keil编程,数组方面的一些疑问
uchar code table[]="12345678";这算数组吗?数组初始化不是要用大括号扩起来,用逗号隔开吗?但为什么他可以这样被调用: for(num=0;num<8;num++) LCDdate(table[num]); 如果真的这样的方法可以表示数组,那么他每个数组元素岂不是只可以表示0~9之间的数字?
使用keil编程第一部就出了问题
想问大家我在用keil输入include“STM32l151C8.h”后显示cannot open source input file,说没有这个文件或目录,这种情况怎么办呀
请问一下大家,STM32的编程软件keil5为什么会在第一次编译的时候出现错误?
出现错误的情况是这样的,我用STM32CubeMX定义了一个GPIO口,准备做一个LED灯的实验,但是当我在CubeMX中配置完各项功能之后,我打开keil5准备初始化程序代码,发现在初始化完成的时候有一个错误,这个错误来自于keil5当中的stm32f1xx_ hal_gpio.h的这行代码:“#define GPIO_MODE_INPUT 0x00000000u /*!< Input Floating Mode */” 上面这行代码是正常初始化后的代码,而我遇到问题的代码是这一行:“#define GPIO_7MODE_INPUT 0x00000000u /*!< Input Floating Mode */” 上面是我出现错误的代码,它相较于之前的正常代码在MODE之前多出现了一个数字7,这也让我觉得很奇怪,这个数字7是在keil5程序初始化编译的时候就存在,当我把这个数字7给去除后再次进行编译就没有任何问题,我之前以为只是软件的问题后来我自己也重装了keil5好几遍,包括也重装过STM32CubeMX,但问题依然没有解决,顺便说一下我在电脑里的stm32f1xx_ hal_gpio.h这个文件中比较过代码发现这个文件里面的:“#define GPIO_MODE_INPUT 0x00000000u /*!< Input Floating Mode */”发现这行代码竟然是正常的,而它到了keil5里面的时候在初始化编译的时候就会莫名其妙的多出一个数字7,请问大家这个是什么问题,麻烦帮我解决一下,非常感谢。 ![图片说明](https://img-ask.csdn.net/upload/202002/12/1581475884_92104.png)
关于keil中头文件无法打开
最近在搞keil相关的东西,先遇到一问题,想向各位大神们请教! 我在Keil uVision4中新建了一个工程,添加了一个.c文件,其中包含#include<boebot.h>,但是问题出现了说不能打开。 请问是什么问题?
keil5打开keil4工程后编译出现问题怎么办?
keil5打开keil4工程出现这样的情况,编译后出现"no source": Error: #5: cannot open source input file "..\source\crc32.c": No such file or directory的问题?
有关keil中头文件路径添加问题
有关keil中头文件路径添加问题,是这样的,我昨天做了一个工程,今天删除重做,可是发现无法在工程中添加项目组,后来有人告诉我说把CMSIS中的core的对号去掉就可以了,没错,这样是可以添加项目组了,可是用正确的方法添加头文件路径之后,也会报错说找不到头文件唉!,添加的方法是肯定没错的。我用f1试验过的。跪求个位大佬们
lcd设计电子时钟protues ,keil编程
以AT89C51单片机为核心的时钟,在LCD显示器上显示当前的时间:使用字符型LCD显示器显示当前时间。显示格式为“时时:分分:秒秒”。用4个功能键操作来设置当前时间。功能键K1~K4功能如下。 K1—进入设置现在的时间。 K2—设置小时。 K3—设置分钟。 K4—确认完成设置。 程序执行后工作指示灯LED闪动,表示程序开始执行,LCD显示“00:00:00”,然后开始计时。c语言编程
小白使用keil编程debug进入了harddefault,搞了半天没解决。求大佬帮下忙。
/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : main.c * @brief : Main program body ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ /* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ #include "main.h" #include "can.h" #include "usart.h" #include "gpio.h" /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ void CAN_SetTxMsg(void) { hcan.pTxMsg->ExtId=0x1314; //使用的扩展ID hcan.pTxMsg->IDE=CAN_ID_EXT; //扩展模式 hcan.pTxMsg->RTR=CAN_RTR_DATA; //发送的是数据 hcan.pTxMsg->DLC=8; //数据长度为2字节 hcan.pTxMsg->data[0]=0x01; hcan.pTxMsg->data[1]=0x02; hcan.pTxMsg->data[2]=0x03; hcan.pTxMsg->data[3]=0x04; hcan.pTxMsg->data[4]=0x05; hcan.pTxMsg->data[5]=0x06; hcan.pTxMsg->data[6]=0x07; hcan.pTxMsg->data[7]=0x08; } /* 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 */ /* USER CODE END PV */ /* Private function prototypes -----------------------------------------------*/ void SystemClock_Config(void); /* USER CODE BEGIN PFP */ /* 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_CAN_Init(); MX_USART1_UART_Init(); /* USER CODE BEGIN 2 */ CAN_SetTxMsg(); HAL_CAN_AddTxMessage(&hcan,hcan.pTxMsg,hcan.pTxMsg->data,(uint32_t*)CAN_TX_MAILBOX0); HAL_CAN_ActivateNotification(&hcan,CAN_IT_RX_FIFO0_MSG_PENDING); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ } /* USER CODE END 3 */ } /** * @brief System Clock Configuration * @retval None */ void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1; RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { Error_Handler(); } /** Initializes the CPU, AHB and APB busses 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_DIV2; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) { Error_Handler(); } /** Enables the Clock Security System */ HAL_RCC_EnableCSS(); } /* USER CODE BEGIN 4 */ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan) { HAL_CAN_AddTxMessage(hcan,hcan->pTxMsg,hcan->pTxMsg->data,(uint32_t*)CAN_TX_MAILBOX0); HAL_CAN_ActivateNotification(hcan,CAN_IT_RX_FIFO0_MSG_PENDING); } /* 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 */ /* 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, tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* USER CODE END 6 */ } #endif /* USE_FULL_ASSERT */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 这是我的主程序,debug总是在CAN_SetMsg()那里进入了hardfault.下面是定义的一些初始化结构体。 /** ****************************************************************************** * @file stm32f1xx_hal_can.h * @author MCD Application Team * @brief Header file of CAN HAL module. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef STM32F1xx_HAL_CAN_H #define STM32F1xx_HAL_CAN_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "stm32f1xx_hal_def.h" /** @addtogroup STM32F1xx_HAL_Driver * @{ */ #if defined (CAN1) /** @addtogroup CAN * @{ */ /* Exported types ------------------------------------------------------------*/ /** @defgroup CAN_Exported_Types CAN Exported Types * @{ */ /** * @brief HAL State structures definition */ typedef enum { HAL_CAN_STATE_RESET = 0x00U, /*!< CAN not yet initialized or disabled */ HAL_CAN_STATE_READY = 0x01U, /*!< CAN initialized and ready for use */ HAL_CAN_STATE_LISTENING = 0x02U, /*!< CAN receive process is ongoing */ HAL_CAN_STATE_SLEEP_PENDING = 0x03U, /*!< CAN sleep request is pending */ HAL_CAN_STATE_SLEEP_ACTIVE = 0x04U, /*!< CAN sleep mode is active */ HAL_CAN_STATE_ERROR = 0x05U /*!< CAN error state */ } HAL_CAN_StateTypeDef; /** * @brief CAN init structure definition */ typedef struct { uint32_t Prescaler; /*!< Specifies the length of a time quantum. This parameter must be a number between Min_Data = 1 and Max_Data = 1024. */ uint32_t Mode; /*!< Specifies the CAN operating mode. This parameter can be a value of @ref CAN_operating_mode */ uint32_t SyncJumpWidth; /*!< Specifies the maximum number of time quanta the CAN hardware is allowed to lengthen or shorten a bit to perform resynchronization. This parameter can be a value of @ref CAN_synchronisation_jump_width */ uint32_t TimeSeg1; /*!< Specifies the number of time quanta in Bit Segment 1. This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_1 */ uint32_t TimeSeg2; /*!< Specifies the number of time quanta in Bit Segment 2. This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_2 */ FunctionalState TimeTriggeredMode; /*!< Enable or disable the time triggered communication mode. This parameter can be set to ENABLE or DISABLE. */ FunctionalState AutoBusOff; /*!< Enable or disable the automatic bus-off management. This parameter can be set to ENABLE or DISABLE. */ FunctionalState AutoWakeUp; /*!< Enable or disable the automatic wake-up mode. This parameter can be set to ENABLE or DISABLE. */ FunctionalState AutoRetransmission; /*!< Enable or disable the non-automatic retransmission mode. This parameter can be set to ENABLE or DISABLE. */ FunctionalState ReceiveFifoLocked; /*!< Enable or disable the Receive FIFO Locked mode. This parameter can be set to ENABLE or DISABLE. */ FunctionalState TransmitFifoPriority;/*!< Enable or disable the transmit FIFO priority. This parameter can be set to ENABLE or DISABLE. */ } CAN_InitTypeDef; /** * @brief CAN filter configuration structure definition */ typedef struct { uint32_t FilterIdHigh; /*!< Specifies the filter identification number (MSBs for a 32-bit configuration, first one for a 16-bit configuration). This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ uint32_t FilterIdLow; /*!< Specifies the filter identification number (LSBs for a 32-bit configuration, second one for a 16-bit configuration). This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ uint32_t FilterMaskIdHigh; /*!< Specifies the filter mask number or identification number, according to the mode (MSBs for a 32-bit configuration, first one for a 16-bit configuration). This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ uint32_t FilterMaskIdLow; /*!< Specifies the filter mask number or identification number, according to the mode (LSBs for a 32-bit configuration, second one for a 16-bit configuration). This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ uint32_t FilterFIFOAssignment; /*!< Specifies the FIFO (0 or 1U) which will be assigned to the filter. This parameter can be a value of @ref CAN_filter_FIFO */ uint32_t FilterBank; /*!< Specifies the filter bank which will be initialized. For single CAN instance(14 dedicated filter banks), this parameter must be a number between Min_Data = 0 and Max_Data = 13. For dual CAN instances(28 filter banks shared), this parameter must be a number between Min_Data = 0 and Max_Data = 27. */ uint32_t FilterMode; /*!< Specifies the filter mode to be initialized. This parameter can be a value of @ref CAN_filter_mode */ uint32_t FilterScale; /*!< Specifies the filter scale. This parameter can be a value of @ref CAN_filter_scale */ uint32_t FilterActivation; /*!< Enable or disable the filter. This parameter can be a value of @ref CAN_filter_activation */ uint32_t SlaveStartFilterBank; /*!< Select the start filter bank for the slave CAN instance. For single CAN instances, this parameter is meaningless. For dual CAN instances, all filter banks with lower index are assigned to master CAN instance, whereas all filter banks with greater index are assigned to slave CAN instance. This parameter must be a number between Min_Data = 0 and Max_Data = 27. */ } CAN_FilterTypeDef; /** * @brief CAN Tx message header structure definition */ typedef struct { uint32_t StdId; /*!< Specifies the standard identifier. This parameter must be a number between Min_Data = 0 and Max_Data = 0x7FF. */ uint32_t ExtId; /*!< Specifies the extended identifier. This parameter must be a number between Min_Data = 0 and Max_Data = 0x1FFFFFFF. */ uint32_t IDE; /*!< Specifies the type of identifier for the message that will be transmitted. This parameter can be a value of @ref CAN_identifier_type */ uint32_t RTR; /*!< Specifies the type of frame for the message that will be transmitted. This parameter can be a value of @ref CAN_remote_transmission_request */ uint32_t DLC; /*!< Specifies the length of the frame that will be transmitted. This parameter must be a number between Min_Data = 0 and Max_Data = 8. */ uint8_t data[8]; FunctionalState TransmitGlobalTime; /*!< Specifies whether the timestamp counter value captured on start of frame transmission, is sent in DATA6 and DATA7 replacing pData[6] and pData[7]. @note: Time Triggered Communication Mode must be enabled. @note: DLC must be programmed as 8 bytes, in order these 2 bytes are sent. This parameter can be set to ENABLE or DISABLE. */ } CAN_TxHeaderTypeDef; /** * @brief CAN Rx message header structure definition */ typedef struct { uint32_t StdId; /*!< Specifies the standard identifier. This parameter must be a number between Min_Data = 0 and Max_Data = 0x7FF. */ uint32_t ExtId; /*!< Specifies the extended identifier. This parameter must be a number between Min_Data = 0 and Max_Data = 0x1FFFFFFF. */ uint32_t IDE; /*!< Specifies the type of identifier for the message that will be transmitted. This parameter can be a value of @ref CAN_identifier_type */ uint32_t RTR; /*!< Specifies the type of frame for the message that will be transmitted. This parameter can be a value of @ref CAN_remote_transmission_request */ uint32_t DLC; /*!< Specifies the length of the frame that will be transmitted. This parameter must be a number between Min_Data = 0 and Max_Data = 8. */ uint8_t Data[8]; uint32_t Timestamp; /*!< Specifies the timestamp counter value captured on start of frame reception. @note: Time Triggered Communication Mode must be enabled. This parameter must be a number between Min_Data = 0 and Max_Data = 0xFFFF. */ uint32_t FilterMatchIndex; /*!< Specifies the index of matching acceptance filter element. This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF. */ } CAN_RxHeaderTypeDef; /** * @brief CAN handle Structure definition */ typedef struct __CAN_HandleTypeDef { CAN_TypeDef *Instance; /*!< Register base address */ CAN_InitTypeDef Init; /*!< CAN required parameters */ CAN_TxHeaderTypeDef* pTxMsg; CAN_RxHeaderTypeDef* pRxMsg; HAL_LockTypeDef Lock; __IO HAL_CAN_StateTypeDef State; /*!< CAN communication state */ __IO uint32_t ErrorCode; /*!< CAN Error code. This parameter can be a value of @ref CAN_Error_Code */ } CAN_HandleTypeDef; /** * @} */ /* Exported constants --------------------------------------------------------*/ /** @defgroup CAN_Exported_Constants CAN Exported Constants * @{ */ /** @defgroup CAN_Error_Code CAN Error Code * @{ */ #define HAL_CAN_ERROR_NONE (0x00000000U) /*!< No error */ #define HAL_CAN_ERROR_EWG (0x00000001U) /*!< Protocol Error Warning */ #define HAL_CAN_ERROR_EPV (0x00000002U) /*!< Error Passive */ #define HAL_CAN_ERROR_BOF (0x00000004U) /*!< Bus-off error */ #define HAL_CAN_ERROR_STF (0x00000008U) /*!< Stuff error */ #define HAL_CAN_ERROR_FOR (0x00000010U) /*!< Form error */ #define HAL_CAN_ERROR_ACK (0x00000020U) /*!< Acknowledgment error */ #define HAL_CAN_ERROR_BR (0x00000040U) /*!< Bit recessive error */ #define HAL_CAN_ERROR_BD (0x00000080U) /*!< Bit dominant error */ #define HAL_CAN_ERROR_CRC (0x00000100U) /*!< CRC error */ #define HAL_CAN_ERROR_RX_FOV0 (0x00000200U) /*!< Rx FIFO0 overrun error */ #define HAL_CAN_ERROR_RX_FOV1 (0x00000400U) /*!< Rx FIFO1 overrun error */ #define HAL_CAN_ERROR_TX_ALST0 (0x00000800U) /*!< TxMailbox 0 transmit failure due to arbitration lost */ #define HAL_CAN_ERROR_TX_TERR0 (0x00001000U) /*!< TxMailbox 1 transmit failure due to tranmit error */ #define HAL_CAN_ERROR_TX_ALST1 (0x00002000U) /*!< TxMailbox 0 transmit failure due to arbitration lost */ #define HAL_CAN_ERROR_TX_TERR1 (0x00004000U) /*!< TxMailbox 1 transmit failure due to tranmit error */ #define HAL_CAN_ERROR_TX_ALST2 (0x00008000U) /*!< TxMailbox 0 transmit failure due to arbitration lost */ #define HAL_CAN_ERROR_TX_TERR2 (0x00010000U) /*!< TxMailbox 1 transmit failure due to tranmit error */ #define HAL_CAN_ERROR_TIMEOUT (0x00020000U) /*!< Timeout error */ #define HAL_CAN_ERROR_NOT_INITIALIZED (0x00040000U) /*!< Peripheral not initialized */ #define HAL_CAN_ERROR_NOT_READY (0x00080000U) /*!< Peripheral not ready */ #define HAL_CAN_ERROR_NOT_STARTED (0x00100000U) /*!< Peripheral not started */ #define HAL_CAN_ERROR_PARAM (0x00200000U) /*!< Parameter error */ #define HAL_CAN_ERROR_INTERNAL (0x00800000U) /*!< Internal error */ /** * @} */ /** @defgroup CAN_InitStatus CAN InitStatus * @{ */ #define CAN_INITSTATUS_FAILED (0x00000000U) /*!< CAN initialization failed */ #define CAN_INITSTATUS_SUCCESS (0x00000001U) /*!< CAN initialization OK */ /** * @} */ /** @defgroup CAN_operating_mode CAN Operating Mode * @{ */ #define CAN_MODE_NORMAL (0x00000000U) /*!< Normal mode */ #define CAN_MODE_LOOPBACK ((uint32_t)CAN_BTR_LBKM) /*!< Loopback mode */ #define CAN_MODE_SILENT ((uint32_t)CAN_BTR_SILM) /*!< Silent mode */ #define CAN_MODE_SILENT_LOOPBACK ((uint32_t)(CAN_BTR_LBKM | CAN_BTR_SILM)) /*!< Loopback combined with silent mode */ /** * @} */ /** @defgroup CAN_synchronisation_jump_width CAN Synchronization Jump Width * @{ */ #define CAN_SJW_1TQ (0x00000000U) /*!< 1 time quantum */ #define CAN_SJW_2TQ ((uint32_t)CAN_BTR_SJW_0) /*!< 2 time quantum */ #define CAN_SJW_3TQ ((uint32_t)CAN_BTR_SJW_1) /*!< 3 time quantum */ #define CAN_SJW_4TQ ((uint32_t)CAN_BTR_SJW) /*!< 4 time quantum */ /** * @} */ /** @defgroup CAN_time_quantum_in_bit_segment_1 CAN Time Quantum in Bit Segment 1 * @{ */ #define CAN_BS1_1TQ (0x00000000U) /*!< 1 time quantum */ #define CAN_BS1_2TQ ((uint32_t)CAN_BTR_TS1_0) /*!< 2 time quantum */ #define CAN_BS1_3TQ ((uint32_t)CAN_BTR_TS1_1) /*!< 3 time quantum */ #define CAN_BS1_4TQ ((uint32_t)(CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 4 time quantum */ #define CAN_BS1_5TQ ((uint32_t)CAN_BTR_TS1_2) /*!< 5 time quantum */ #define CAN_BS1_6TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_0)) /*!< 6 time quantum */ #define CAN_BS1_7TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1)) /*!< 7 time quantum */ #define CAN_BS1_8TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 8 time quantum */ #define CAN_BS1_9TQ ((uint32_t)CAN_BTR_TS1_3) /*!< 9 time quantum */ #define CAN_BS1_10TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_0)) /*!< 10 time quantum */ #define CAN_BS1_11TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1)) /*!< 11 time quantum */ #define CAN_BS1_12TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 12 time quantum */ #define CAN_BS1_13TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2)) /*!< 13 time quantum */ #define CAN_BS1_14TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_0)) /*!< 14 time quantum */ #define CAN_BS1_15TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_1)) /*!< 15 time quantum */ #define CAN_BS1_16TQ ((uint32_t)CAN_BTR_TS1) /*!< 16 time quantum */ /** * @} */ /** @defgroup CAN_time_quantum_in_bit_segment_2 CAN Time Quantum in Bit Segment 2 * @{ */ #define CAN_BS2_1TQ (0x00000000U) /*!< 1 time quantum */ #define CAN_BS2_2TQ ((uint32_t)CAN_BTR_TS2_0) /*!< 2 time quantum */ #define CAN_BS2_3TQ ((uint32_t)CAN_BTR_TS2_1) /*!< 3 time quantum */ #define CAN_BS2_4TQ ((uint32_t)(CAN_BTR_TS2_1 | CAN_BTR_TS2_0)) /*!< 4 time quantum */ #define CAN_BS2_5TQ ((uint32_t)CAN_BTR_TS2_2) /*!< 5 time quantum */ #define CAN_BS2_6TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_0)) /*!< 6 time quantum */ #define CAN_BS2_7TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_1)) /*!< 7 time quantum */ #define CAN_BS2_8TQ ((uint32_t)CAN_BTR_TS2) /*!< 8 time quantum */ /** * @} */ /** @defgroup CAN_filter_mode CAN Filter Mode * @{ */ #define CAN_FILTERMODE_IDMASK (0x00000000U) /*!< Identifier mask mode */ #define CAN_FILTERMODE_IDLIST (0x00000001U) /*!< Identifier list mode */ /** * @} */ /** @defgroup CAN_filter_scale CAN Filter Scale * @{ */ #define CAN_FILTERSCALE_16BIT (0x00000000U) /*!< Two 16-bit filters */ #define CAN_FILTERSCALE_32BIT (0x00000001U) /*!< One 32-bit filter */ /** * @} */ /** @defgroup CAN_filter_activation CAN Filter Activation * @{ */ #define CAN_FILTER_DISABLE (0x00000000U) /*!< Disable filter */ #define CAN_FILTER_ENABLE (0x00000001U) /*!< Enable filter */ /** * @} */ /** @defgroup CAN_filter_FIFO CAN Filter FIFO * @{ */ #define CAN_FILTER_FIFO0 (0x00000000U) /*!< Filter FIFO 0 assignment for filter x */ #define CAN_FILTER_FIFO1 (0x00000001U) /*!< Filter FIFO 1 assignment for filter x */ /** * @} */ /** @defgroup CAN_identifier_type CAN Identifier Type * @{ */ #define CAN_ID_STD ((uint32_t)0x00000000) /*!< Standard Id */ #define CAN_ID_EXT ((uint32_t)0x00000004) /*!< Extended Id */ /** * @} */ /** @defgroup CAN_remote_transmission_request CAN Remote Transmission Request * @{ */ #define CAN_RTR_DATA ((uint32_t)0x00000000) /*!< Data frame */ #define CAN_RTR_REMOTE ((uint32_t)0x00000002) /*!< Remote frame */ /** * @} */ /** @defgroup CAN_receive_FIFO_number CAN Receive FIFO Number * @{ */ #define CAN_RX_FIFO0 (0x00000000U) /*!< CAN receive FIFO 0 */ #define CAN_RX_FIFO1 (0x00000001U) /*!< CAN receive FIFO 1 */ /** * @} */ /** @defgroup CAN_Tx_Mailboxes CAN Tx Mailboxes * @{ */ #define CAN_TX_MAILBOX0 (0x00000001U) /*!< Tx Mailbox 0 */ #define CAN_TX_MAILBOX1 (0x00000002U) /*!< Tx Mailbox 1 */ #define CAN_TX_MAILBOX2 (0x00000004U) /*!< Tx Mailbox 2 */ /** * @} */ /** @defgroup CAN_flags CAN Flags * @{ */ /* Transmit Flags */ #define CAN_FLAG_RQCP0 (0x00000500U) /*!< Request complete MailBox 0 flag */ #define CAN_FLAG_TXOK0 (0x00000501U) /*!< Transmission OK MailBox 0 flag */ #define CAN_FLAG_ALST0 (0x00000502U) /*!< Arbitration Lost MailBox 0 flag */ #define CAN_FLAG_TERR0 (0x00000503U) /*!< Transmission error MailBox 0 flag */ #define CAN_FLAG_RQCP1 (0x00000508U) /*!< Request complete MailBox1 flag */ #define CAN_FLAG_TXOK1 (0x00000509U) /*!< Transmission OK MailBox 1 flag */ #define CAN_FLAG_ALST1 (0x0000050AU) /*!< Arbitration Lost MailBox 1 flag */ #define CAN_FLAG_TERR1 (0x0000050BU) /*!< Transmission error MailBox 1 flag */ #define CAN_FLAG_RQCP2 (0x00000510U) /*!< Request complete MailBox2 flag */ #define CAN_FLAG_TXOK2 (0x00000511U) /*!< Transmission OK MailBox 2 flag */ #define CAN_FLAG_ALST2 (0x00000512U) /*!< Arbitration Lost MailBox 2 flag */ #define CAN_FLAG_TERR2 (0x00000513U) /*!< Transmission error MailBox 2 flag */ #define CAN_FLAG_TME0 (0x0000051AU) /*!< Transmit mailbox 0 empty flag */ #define CAN_FLAG_TME1 (0x0000051BU) /*!< Transmit mailbox 1 empty flag */ #define CAN_FLAG_TME2 (0x0000051CU) /*!< Transmit mailbox 2 empty flag */ #define CAN_FLAG_LOW0 (0x0000051DU) /*!< Lowest priority mailbox 0 flag */ #define CAN_FLAG_LOW1 (0x0000051EU) /*!< Lowest priority mailbox 1 flag */ #define CAN_FLAG_LOW2 (0x0000051FU) /*!< Lowest priority mailbox 2 flag */ /* Receive Flags */ #define CAN_FLAG_FF0 (0x00000203U) /*!< RX FIFO 0 Full flag */ #define CAN_FLAG_FOV0 (0x00000204U) /*!< RX FIFO 0 Overrun flag */ #define CAN_FLAG_FF1 (0x00000403U) /*!< RX FIFO 1 Full flag */ #define CAN_FLAG_FOV1 (0x00000404U) /*!< RX FIFO 1 Overrun flag */ /* Operating Mode Flags */ #define CAN_FLAG_INAK (0x00000100U) /*!< Initialization acknowledge flag */ #define CAN_FLAG_SLAK (0x00000101U) /*!< Sleep acknowledge flag */ #define CAN_FLAG_ERRI (0x00000102U) /*!< Error flag */ #define CAN_FLAG_WKU (0x00000103U) /*!< Wake up interrupt flag */ #define CAN_FLAG_SLAKI (0x00000104U) /*!< Sleep acknowledge interrupt flag */ /* Error Flags */ #define CAN_FLAG_EWG (0x00000300U) /*!< Error warning flag */ #define CAN_FLAG_EPV (0x00000301U) /*!< Error passive flag */ #define CAN_FLAG_BOF (0x00000302U) /*!< Bus-Off flag */ /** * @} */ /** @defgroup CAN_Interrupts CAN Interrupts * @{ */ /* Transmit Interrupt */ #define CAN_IT_TX_MAILBOX_EMPTY ((uint32_t)CAN_IER_TMEIE) /*!< Transmit mailbox empty interrupt */ /* Receive Interrupts */ #define CAN_IT_RX_FIFO0_MSG_PENDING ((uint32_t)CAN_IER_FMPIE0) /*!< FIFO 0 message pending interrupt */ #define CAN_IT_RX_FIFO0_FULL ((uint32_t)CAN_IER_FFIE0) /*!< FIFO 0 full interrupt */ #define CAN_IT_RX_FIFO0_OVERRUN ((uint32_t)CAN_IER_FOVIE0) /*!< FIFO 0 overrun interrupt */ #define CAN_IT_RX_FIFO1_MSG_PENDING ((uint32_t)CAN_IER_FMPIE1) /*!< FIFO 1 message pending interrupt */ #define CAN_IT_RX_FIFO1_FULL ((uint32_t)CAN_IER_FFIE1) /*!< FIFO 1 full interrupt */ #define CAN_IT_RX_FIFO1_OVERRUN ((uint32_t)CAN_IER_FOVIE1) /*!< FIFO 1 overrun interrupt */ /* Operating Mode Interrupts */ #define CAN_IT_WAKEUP ((uint32_t)CAN_IER_WKUIE) /*!< Wake-up interrupt */ #define CAN_IT_SLEEP_ACK ((uint32_t)CAN_IER_SLKIE) /*!< Sleep acknowledge interrupt */ /* Error Interrupts */ #define CAN_IT_ERROR_WARNING ((uint32_t)CAN_IER_EWGIE) /*!< Error warning interrupt */ #define CAN_IT_ERROR_PASSIVE ((uint32_t)CAN_IER_EPVIE) /*!< Error passive interrupt */ #define CAN_IT_BUSOFF ((uint32_t)CAN_IER_BOFIE) /*!< Bus-off interrupt */ #define CAN_IT_LAST_ERROR_CODE ((uint32_t)CAN_IER_LECIE) /*!< Last error code interrupt */ #define CAN_IT_ERROR ((uint32_t)CAN_IER_ERRIE) /*!< Error Interrupt */ /** * @} */ /** * @} */ /* Exported macros -----------------------------------------------------------*/ /** @defgroup CAN_Exported_Macros CAN Exported Macros * @{ */ /** @brief Reset CAN handle state * @param __HANDLE__ CAN handle. * @retval None */ #define __HAL_CAN_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CAN_STATE_RESET) /** * @brief Enable the specified CAN interrupts. * @param __HANDLE__ CAN handle. * @param __INTERRUPT__ CAN Interrupt sources to enable. * This parameter can be any combination of @arg CAN_Interrupts * @retval None */ #define __HAL_CAN_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) |= (__INTERRUPT__)) /** * @brief Disable the specified CAN interrupts. * @param __HANDLE__ CAN handle. * @param __INTERRUPT__ CAN Interrupt sources to disable. * This parameter can be any combination of @arg CAN_Interrupts * @retval None */ #define __HAL_CAN_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) &= ~(__INTERRUPT__)) /** @brief Check if the specified CAN interrupt source is enabled or disabled. * @param __HANDLE__ specifies the CAN Handle. * @param __INTERRUPT__ specifies the CAN interrupt source to check. * This parameter can be a value of @arg CAN_Interrupts * @retval The state of __IT__ (TRUE or FALSE). */ #define __HAL_CAN_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) & (__INTERRUPT__)) /** @brief Check whether the specified CAN flag is set or not. * @param __HANDLE__ specifies the CAN Handle. * @param __FLAG__ specifies the flag to check. * This parameter can be one of @arg CAN_flags * @retval The state of __FLAG__ (TRUE or FALSE). */ #define __HAL_CAN_GET_FLAG(__HANDLE__, __FLAG__) \ ((((__FLAG__) >> 8U) == 5U)? ((((__HANDLE__)->Instance->TSR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ (((__FLAG__) >> 8U) == 2U)? ((((__HANDLE__)->Instance->RF0R) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ (((__FLAG__) >> 8U) == 4U)? ((((__HANDLE__)->Instance->RF1R) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ (((__FLAG__) >> 8U) == 1U)? ((((__HANDLE__)->Instance->MSR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ (((__FLAG__) >> 8U) == 3U)? ((((__HANDLE__)->Instance->ESR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): 0U) /** @brief Clear the specified CAN pending flag. * @param __HANDLE__ specifies the CAN Handle. * @param __FLAG__ specifies the flag to check. * This parameter can be one of the following values: * @arg CAN_FLAG_RQCP0: Request complete MailBox 0 Flag * @arg CAN_FLAG_TXOK0: Transmission OK MailBox 0 Flag * @arg CAN_FLAG_ALST0: Arbitration Lost MailBox 0 Flag * @arg CAN_FLAG_TERR0: Transmission error MailBox 0 Flag * @arg CAN_FLAG_RQCP1: Request complete MailBox 1 Flag * @arg CAN_FLAG_TXOK1: Transmission OK MailBox 1 Flag * @arg CAN_FLAG_ALST1: Arbitration Lost MailBox 1 Flag * @arg CAN_FLAG_TERR1: Transmission error MailBox 1 Flag * @arg CAN_FLAG_RQCP2: Request complete MailBox 2 Flag * @arg CAN_FLAG_TXOK2: Transmission OK MailBox 2 Flag * @arg CAN_FLAG_ALST2: Arbitration Lost MailBox 2 Flag * @arg CAN_FLAG_TERR2: Transmission error MailBox 2 Flag * @arg CAN_FLAG_FF0: RX FIFO 0 Full Flag * @arg CAN_FLAG_FOV0: RX FIFO 0 Overrun Flag * @arg CAN_FLAG_FF1: RX FIFO 1 Full Flag * @arg CAN_FLAG_FOV1: RX FIFO 1 Overrun Flag * @arg CAN_FLAG_WKUI: Wake up Interrupt Flag * @arg CAN_FLAG_SLAKI: Sleep acknowledge Interrupt Flag * @retval None */ #define __HAL_CAN_CLEAR_FLAG(__HANDLE__, __FLAG__) \ ((((__FLAG__) >> 8U) == 5U)? (((__HANDLE__)->Instance->TSR) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ (((__FLAG__) >> 8U) == 2U)? (((__HANDLE__)->Instance->RF0R) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ (((__FLAG__) >> 8U) == 4U)? (((__HANDLE__)->Instance->RF1R) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ (((__FLAG__) >> 8U) == 1U)? (((__HANDLE__)->Instance->MSR) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): 0U) /** * @} */ /* Exported functions --------------------------------------------------------*/ /** @addtogroup CAN_Exported_Functions CAN Exported Functions * @{ */ /** @addtogroup CAN_Exported_Functions_Group1 Initialization and de-initialization functions * @brief Initialization and Configuration functions * @{ */ /* Initialization and de-initialization functions *****************************/ HAL_StatusTypeDef HAL_CAN_Init(CAN_HandleTypeDef *hcan); HAL_StatusTypeDef HAL_CAN_DeInit(CAN_HandleTypeDef *hcan); void HAL_CAN_MspInit(CAN_HandleTypeDef *hcan); void HAL_CAN_MspDeInit(CAN_HandleTypeDef *hcan); /** * @} */ /** @addtogroup CAN_Exported_Functions_Group2 Configuration functions * @brief Configuration functions * @{ */ /* Configuration functions ****************************************************/ HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef *hcan, CAN_FilterTypeDef *sFilterConfig); /** * @} */ /** @addtogroup CAN_Exported_Functions_Group3 Control functions * @brief Control functions * @{ */ /* Control functions **********************************************************/ HAL_StatusTypeDef HAL_CAN_Start(CAN_HandleTypeDef *hcan); HAL_StatusTypeDef HAL_CAN_Stop(CAN_HandleTypeDef *hcan); HAL_StatusTypeDef HAL_CAN_RequestSleep(CAN_HandleTypeDef *hcan); HAL_StatusTypeDef HAL_CAN_WakeUp(CAN_HandleTypeDef *hcan); uint32_t HAL_CAN_IsSleepActive(CAN_HandleTypeDef *hcan); HAL_StatusTypeDef HAL_CAN_AddTxMessage(CAN_HandleTypeDef *hcan, CAN_TxHeaderTypeDef *pHeader, uint8_t aData[], uint32_t *pTxMailbox); HAL_StatusTypeDef HAL_CAN_AbortTxRequest(CAN_HandleTypeDef *hcan, uint32_t TxMailboxes); uint32_t HAL_CAN_GetTxMailboxesFreeLevel(CAN_HandleTypeDef *hcan); uint32_t HAL_CAN_IsTxMessagePending(CAN_HandleTypeDef *hcan, uint32_t TxMailboxes); uint32_t HAL_CAN_GetTxTimestamp(CAN_HandleTypeDef *hcan, uint32_t TxMailbox); HAL_StatusTypeDef HAL_CAN_GetRxMessage(CAN_HandleTypeDef *hcan, uint32_t RxFifo, CAN_RxHeaderTypeDef *pHeader, uint8_t aData[]); uint32_t HAL_CAN_GetRxFifoFillLevel(CAN_HandleTypeDef *hcan, uint32_t RxFifo); /** * @} */ /** @addtogroup CAN_Exported_Functions_Group4 Interrupts management * @brief Interrupts management * @{ */ /* Interrupts management ******************************************************/ HAL_StatusTypeDef HAL_CAN_ActivateNotification(CAN_HandleTypeDef *hcan, uint32_t ActiveITs); HAL_StatusTypeDef HAL_CAN_DeactivateNotification(CAN_HandleTypeDef *hcan, uint32_t InactiveITs); void HAL_CAN_IRQHandler(CAN_HandleTypeDef *hcan); /** * @} */ /** @addtogroup CAN_Exported_Functions_Group5 Callback functions * @brief Callback functions * @{ */ /* Callbacks functions ********************************************************/ void HAL_CAN_TxMailbox0CompleteCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_TxMailbox1CompleteCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_TxMailbox2CompleteCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_TxMailbox0AbortCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_TxMailbox1AbortCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_TxMailbox2AbortCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_RxFifo0FullCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_RxFifo1MsgPendingCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_RxFifo1FullCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_SleepCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_WakeUpFromRxMsgCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan); /** * @} */ /** @addtogroup CAN_Exported_Functions_Group6 Peripheral State and Error functions * @brief CAN Peripheral State functions * @{ */ /* Peripheral State and Error functions ***************************************/ HAL_CAN_StateTypeDef HAL_CAN_GetState(CAN_HandleTypeDef *hcan); uint32_t HAL_CAN_GetError(CAN_HandleTypeDef *hcan); HAL_StatusTypeDef HAL_CAN_ResetError(CAN_HandleTypeDef *hcan); /** * @} */ /** * @} */ /* Private types -------------------------------------------------------------*/ /** @defgroup CAN_Private_Types CAN Private Types * @{ */ /** * @} */ /* Private variables ---------------------------------------------------------*/ /** @defgroup CAN_Private_Variables CAN Private Variables * @{ */ /** * @} */ /* Private constants ---------------------------------------------------------*/ /** @defgroup CAN_Private_Constants CAN Private Constants * @{ */ #define CAN_FLAG_MASK (0x000000FFU) /** * @} */ /* Private Macros -----------------------------------------------------------*/ /** @defgroup CAN_Private_Macros CAN Private Macros * @{ */ #define IS_CAN_MODE(MODE) (((MODE) == CAN_MODE_NORMAL) || \ ((MODE) == CAN_MODE_LOOPBACK)|| \ ((MODE) == CAN_MODE_SILENT) || \ ((MODE) == CAN_MODE_SILENT_LOOPBACK)) #define IS_CAN_SJW(SJW) (((SJW) == CAN_SJW_1TQ) || ((SJW) == CAN_SJW_2TQ) || \ ((SJW) == CAN_SJW_3TQ) || ((SJW) == CAN_SJW_4TQ)) #define IS_CAN_BS1(BS1) (((BS1) == CAN_BS1_1TQ) || ((BS1) == CAN_BS1_2TQ) || \ ((BS1) == CAN_BS1_3TQ) || ((BS1) == CAN_BS1_4TQ) || \ ((BS1) == CAN_BS1_5TQ) || ((BS1) == CAN_BS1_6TQ) || \ ((BS1) == CAN_BS1_7TQ) || ((BS1) == CAN_BS1_8TQ) || \ ((BS1) == CAN_BS1_9TQ) || ((BS1) == CAN_BS1_10TQ)|| \ ((BS1) == CAN_BS1_11TQ)|| ((BS1) == CAN_BS1_12TQ)|| \ ((BS1) == CAN_BS1_13TQ)|| ((BS1) == CAN_BS1_14TQ)|| \ ((BS1) == CAN_BS1_15TQ)|| ((BS1) == CAN_BS1_16TQ)) #define IS_CAN_BS2(BS2) (((BS2) == CAN_BS2_1TQ) || ((BS2) == CAN_BS2_2TQ) || \ ((BS2) == CAN_BS2_3TQ) || ((BS2) == CAN_BS2_4TQ) || \ ((BS2) == CAN_BS2_5TQ) || ((BS2) == CAN_BS2_6TQ) || \ ((BS2) == CAN_BS2_7TQ) || ((BS2) == CAN_BS2_8TQ)) #define IS_CAN_PRESCALER(PRESCALER) (((PRESCALER) >= 1U) && ((PRESCALER) <= 1024U)) #define IS_CAN_FILTER_ID_HALFWORD(HALFWORD) ((HALFWORD) <= 0xFFFFU) #if defined(CAN2) #define IS_CAN_FILTER_BANK_DUAL(BANK) ((BANK) <= 27U) #endif #define IS_CAN_FILTER_BANK_SINGLE(BANK) ((BANK) <= 13U) #define IS_CAN_FILTER_MODE(MODE) (((MODE) == CAN_FILTERMODE_IDMASK) || \ ((MODE) == CAN_FILTERMODE_IDLIST)) #define IS_CAN_FILTER_SCALE(SCALE) (((SCALE) == CAN_FILTERSCALE_16BIT) || \ ((SCALE) == CAN_FILTERSCALE_32BIT)) #define IS_CAN_FILTER_ACTIVATION(ACTIVATION) (((ACTIVATION) == CAN_FILTER_DISABLE) || \ ((ACTIVATION) == CAN_FILTER_ENABLE)) #define IS_CAN_FILTER_FIFO(FIFO) (((FIFO) == CAN_FILTER_FIFO0) || \ ((FIFO) == CAN_FILTER_FIFO1)) #define IS_CAN_TX_MAILBOX(TRANSMITMAILBOX) (((TRANSMITMAILBOX) == CAN_TX_MAILBOX0 ) || \ ((TRANSMITMAILBOX) == CAN_TX_MAILBOX1 ) || \ ((TRANSMITMAILBOX) == CAN_TX_MAILBOX2 )) #define IS_CAN_TX_MAILBOX_LIST(TRANSMITMAILBOX) ((TRANSMITMAILBOX) <= (CAN_TX_MAILBOX0 | CAN_TX_MAILBOX1 | CAN_TX_MAILBOX2)) #define IS_CAN_STDID(STDID) ((STDID) <= 0x7FFU) #define IS_CAN_EXTID(EXTID) ((EXTID) <= 0x1FFFFFFFU) #define IS_CAN_DLC(DLC) ((DLC) <= 8U) #define IS_CAN_IDTYPE(IDTYPE) (((IDTYPE) == CAN_ID_STD) || \ ((IDTYPE) == CAN_ID_EXT)) #define IS_CAN_RTR(RTR) (((RTR) == CAN_RTR_DATA) || ((RTR) == CAN_RTR_REMOTE)) #define IS_CAN_RX_FIFO(FIFO) (((FIFO) == CAN_RX_FIFO0) || ((FIFO) == CAN_RX_FIFO1)) #define IS_CAN_IT(IT) ((IT) <= (CAN_IT_TX_MAILBOX_EMPTY | CAN_IT_RX_FIFO0_MSG_PENDING | \ CAN_IT_RX_FIFO0_FULL | CAN_IT_RX_FIFO0_OVERRUN | \ CAN_IT_RX_FIFO1_MSG_PENDING | CAN_IT_RX_FIFO1_FULL | \ CAN_IT_RX_FIFO1_OVERRUN | CAN_IT_WAKEUP | \ CAN_IT_SLEEP_ACK | CAN_IT_ERROR_WARNING | \ CAN_IT_ERROR_PASSIVE | CAN_IT_BUSOFF | \ CAN_IT_LAST_ERROR_CODE | CAN_IT_ERROR)) /** * @} */ /* End of private macros -----------------------------------------------------*/ /** * @} */ #endif /* CAN1 */ /** * @} */ #ifdef __cplusplus } #endif #endif /* STM32F1xx_HAL_CAN_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 求大佬指点哪里错了。。
使用keil是所遇到的警告问题
Build target 'Target 1' compiling main.c... linking... *** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: _?PIXEL MODULE: main.obj (MAIN) *** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: _LINE MODULE: main.obj (MAIN) *** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: ?_LINE?BYTE MODULE: main.obj (MAIN) *** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: ?_LINE?BIT MODULE: main.obj (MAIN) *** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: _?SET_LCD_POS MODULE: main.obj (MAIN) *** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: CLS MODULE: main.obj (MAIN) *** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: LCD_INITIALISE MODULE: main.obj (MAIN) *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _?PIXEL MODULE: main.obj (MAIN) ADDRESS: 0D2AH *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _?PIXEL MODULE: main.obj (MAIN) ADDRESS: 0DDAH *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _?PIXEL MODULE: main.obj (MAIN) ADDRESS: 0E23H *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: ?_LINE?BYTE MODULE: main.obj (MAIN) ADDRESS: 1064H *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: ?_LINE?BIT MODULE: main.obj (MAIN) ADDRESS: 1066H *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _LINE MODULE: main.obj (MAIN) ADDRESS: 106CH *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: ?_LINE?BYTE MODULE: main.obj (MAIN) ADDRESS: 10FFH *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: ?_LINE?BIT MODULE: main.obj (MAIN) ADDRESS: 1101H *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _LINE MODULE: main.obj (MAIN) ADDRESS: 1107H *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: LCD_INITIALISE MODULE: main.obj (MAIN) ADDRESS: 12D9H *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _?SET_LCD_POS MODULE: main.obj (MAIN) ADDRESS: 12E0H *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: CLS MODULE: main.obj (MAIN) ADDRESS: 12E3H Program Size: data=41.1 xdata=0 code=2937 creating hex file from "指针式电子钟main"... "指针式电子钟main" - 0 Error(s), 19 Warning(s). 源程序如下 #include<LCD_12864.h> #include<stdio.h> #include<math.h> #define PI 3.1415926 sbit SDA=P1^0; //DS1302数据线 sbit CLK=P1^1; //DS1302时钟线 sbit RST=P1^2; //DS1302复位线 sbit K1=P3^0; //选择 sbit K2=P3^1; //调整 sbit K3=P3^3; //确定 uchar tCount=0, d_Flag=0; uchar Current_Time[7]; //所读取的日期时间 char Adjust_Index=-1; //当前调节的时间对象:秒,分,时(0,1,2) extern void cls(); //清屏 extern char LCD_Initialise(); //LCD初始化 extern uchar LCD_Write_Command(uchar cmd); //写无参数的命令 extern uchar LCD_Write_Command_P2(uchar cmd,uchar para1,uchar para2); //写双参数命令 extern uchar LCD_Write_Data(uchar dat); //写数据 extern void Set_LCD_POS(uchar row,uchar col)reentrant; //设置当前地址 extern void Line(uchar x1,uchar y1,uchar x2,uchar y2,bit Mode); //画直线函数 extern void Pixel(uchar x,uchar y,uchar Mode)reentrant; //画点函数 uchar Time_Back[]={-1,-1,-1}; uchar HMS_Hand_Length[]={24,20,15}; //秒,分,时针的长度 //------------------------------------------------------------------------------------------ //绘制电子钟圆形面板 //------------------------------------------------------------------------------------------ void Clock_Plate() { float sta,x,y; //绘制外围图形园圈 for (sta=0;sta<=2*PI;sta+=0.1) { x=sin(sta); y=cos(sta); Pixel(30+30*x,30+30*y,1); } // 绘制刻度1~12 for (sta=0;sta<=2*PI;sta+=2*PI/12) { x=sin(sta); y=cos(sta); Pixel(30+27*x,30+27*y,1); Pixel(30+26*x,30+26*y,1); } } //------------------------------------------------------------------------------------------ //重绘HMS中的某一指针(参数0,1,2分别为秒,分,时) //------------------------------------------------------------------------------------------ void Repaint_A_Hand(uchar i) { float r,m; uint x,y; m=(i==0 || i==1)?60.0:12.0; //擦除 r=Time_Back[i]/m*2*PI+1.5*PI; x=HMS_Hand_Length[i]*cos(r); y=HMS_Hand_Length[i]*sin(r); Line(30,30,x+30,y+30,0); //重绘 r=Current_Time[i]/m*2*PI+1.5*PI; x=HMS_Hand_Length[i]*cos(r); y=HMS_Hand_Length[i]*sin(r); Line(30,30,x+30,y+30,1); //时间备份 Time_Back[i]=Current_Time[i]; } //------------------------------------------------------------------------------------------- //时间变化时重绘 //秒针与分针、时针接近重叠,或分针与时针接近重叠时也重绘 //------------------------------------------------------------------------------------------- void Display_HMS_Hand() { Repaint_A_Hand(0); Repaint_A_Hand(1); Repaint_A_Hand(2); } //------------------------------------------------------------------------------------------- //向DS1302写入一字节 //------------------------------------------------------------------------------------------- void Write_A_Byte_TO_DS1302(uchar x) { uchar i; for(i=0;i<8;i++) { SDA = x&1; CLK = 1; CLK = 0; x >>= 1; } } //------------------------------------------------------------------------------------------- //从DS1302读取一字节 //------------------------------------------------------------------------------------------- uchar Get_A_Byte_FROM_DS1302() { uchar i,b,t; for(i=1;i<8;i++) { b >>= 1; t = SDA; b |= t<<7; CLK = 1; CLK = 0; } return b/16*10+b%16; //BCD码转换 } //-------------------------------------------------------------------------------------------- //从DS1302指定位置读数据 //-------------------------------------------------------------------------------------------- uchar Read_Data(uchar addr) { uchar dat; RST = 0; CLK = 0; RST = 1; Write_A_Byte_TO_DS1302(addr); dat = Get_A_Byte_FROM_DS1302(); CLK = 1; RST = 0; return dat; } //-------------------------------------------------------------------------------------------- //向DS1302某地址写入数据 //-------------------------------------------------------------------------------------------- void Write_DS1302(uchar addr,uchar dat) { CLK = 0; RST = 1; Write_A_Byte_TO_DS1302(addr); Write_A_Byte_TO_DS1302(dat); CLK = 0; RST = 0; } //-------------------------------------------------------------------------------------------- //设置时间 //-------------------------------------------------------------------------------------------- void SET_DS1302() { Write_DS1302(0x8E,0x00); //写控制字,取消写保护 Write_DS1302(0x82,(Current_Time[1]/10<<4)|(Current_Time[1]%10)); //写入分 Write_DS1302(0x84,(Current_Time[2]/10<<4)|(Current_Time[2]%10)); //写入时 Write_DS1302(0x8E,0x80); //加保护 } //-------------------------------------------------------------------------------------------- //读取当前时间(秒,分,时) //-------------------------------------------------------------------------------------------- void GetTime() { Current_Time[0] = Read_Data(0x81); Current_Time[1] = Read_Data(0x83); Current_Time[2] = Read_Data(0x85); } //-------------------------------------------------------------------------------------------- //时,分调整 //-------------------------------------------------------------------------------------------- void Current_Time_Adjust() { switch(Adjust_Index) { case 2: Current_Time[2] = (Current_Time[2]+1)%24;//时 break; case 1: Current_Time[1] = (Current_Time[1]+1)%60;//分 break; } } //--------------------------------------------------------------------------------------------- //定时器0每秒刷新LCD显示 //--------------------------------------------------------------------------------------------- void T0_INT() interrupt 1 { TH0 = -50000/256; TL0 = -50000%256; if( ++ tCount != 2)return; tCount = 0; if(d_Flag == 0) { Clock_Plate(); d_Flag = 1; } Display_HMS_Hand(); } //--------------------------------------------------------------------------------------------- //键盘中断(INT0) //--------------------------------------------------------------------------------------------- void EX_INT0() interrupt 0 { if(K1 == 0) //选择调整对象 { if(Adjust_Index == -1 || Adjust_Index == 1) Adjust_Index = 3; Adjust_Index -- ; } else if(K2 == 0) //调整 Current_Time_Adjust(); else if(K3 == 0) //确定 { SET_DS1302(); //将调整后的时间写入DS1302 Adjust_Index = -1; //操作索引重设为-1,时间继续正常显示 } } //---------------------------------------------------------------------------------------------- //主程序 //---------------------------------------------------------------------------------------------- void main() { LCD_Initialise(); //液晶初始化 Set_LCD_POS(0,0); //从LCD左上角开始清屏 cls(); IE = 0x83; //允许INT0,T0中断 IP = 0x01; IT0 = 0x01; TMOD = 0x01; TH0 = -50000/256; TL0 = -50000%256; TR0 = 1; while(1) { //如果未执行调整操作则正常读取当前时间 if(Adjust_Index == -1) GetTime(); } }
keil C51 数码管的动态显示 延时问题
我在写数码管动态显示的时候发现意义相同的两个代码写出来显示的结果却不同,代码如下: ``` void display_SEG(unsigned int t) { Y_SEG_show(1, 2); while(t--); Y_SEG_show(2, 0); while(t--); Y_SEG_show(3, 1); while(t--); Y_SEG_show(4, 8); while(t--); Y_SEG_show(5, 16); while(t--); Y_SEG_show(6, 16); while(t--); Y_SEG_show(7, i/10); while(t--); Y_SEG_show(8, i%10); while(t--); } ``` t=500;上面这个运行起来延时时间明显过长,从而达不到余辉效应。 ``` void delay_SEG(unsigned char t) { while(t--); } void display_SEG() { Y_SEG_show(1, 2); delay_SEG(500); Y_SEG_show(2, 0); delay_SEG(500); Y_SEG_show(3, 1); delay_SEG(500); Y_SEG_show(4, 8); delay_SEG(500); Y_SEG_show(5, 16); delay_SEG(500); Y_SEG_show(6, 16); delay_SEG(500); Y_SEG_show(7, i/10); delay_SEG(500); Y_SEG_show(8, i%10); delay_SEG(500); } ``` 当定义一个延时函数放进去时,却可以达到效果,可用的不都是while(500--)的延迟吗,为什么会有这个差别。求解答
keil5安装出现这样问题?请问怎么解决?
![图片说明](https://img-ask.csdn.net/upload/202001/04/1578115967_648098.png)
KEIL MDK 怎么设置--no_conditionalize?
我的STM32L476在调用 arm_rfft_fast_f32函数时出现“ Warning: L6989W: Could not apply patch sdcomp-29491-629360 to instruction VPOP {d8-d15} at offset 0x1c2, instruction is within an IT block and is not the last instruction for arm_cfft_radix8_f32.o(.text).”的报错信息。网上查看了下,需要在KEIL里面将编译选项设置成--no_conditionalize,但是这一步不知道怎么操作。
51单片机编程sbit与#define的区别
在keil编程中: #define dula P2^6不对 而必须sbit dula=P2^6; 请问为何?
keil c51 和keil v6.12有什么区别
我需要下载的keil版本为v6.12,但在keil官网上只能买到keil c51,请问这两个有区别吗?可以买c51吗?(用于单片机编程)主要是我买的书上使用的版本为v6.12
关于keil软件卸载的一点提问。。。
小弟不才,昨天装了两个keil软件。一个keil uversion2,一个keil5。。当卸载keil2时,他提示找不到相关模块,当卸载keil5时,删除成功但安装目录下的文件并没有被完全删除。。。。求大神,指点一二。。。
Keil软件
我Keil本来用的好好的,一段时间没用,突然怎么一打开就说“Can't read C:\Users\liudamin\TOOLS.INI”?~~~我是一个同学给传的安装包放在D盘里的,文件名也是叫Keil,不存在文件名是中文导致出错的原因。然后点击那个“Can't read C:\Users\liudamin\TOOLS.INI”确定之后也能进软件,但是就是编辑程序之后不能编译运行,编译运行都是灰色的,压根不能点。之前还好好的呢······求助爱心人士了!不胜感激!
keil error #20 stm32
![图片说明](https://img-ask.csdn.net/upload/201912/27/1577419627_902411.jpg) 刚开始用stm32,还不会用,不了解stm32f10x系列芯片用管脚需要如何配置,望各路大神提点小弟一二
关于keil的问题,请帮帮我,谢谢
我安装了一个keil4,但是当我打开project中的New μVision Project后建立了一个新文件后保存,想在我的cpu中找到AT89S51或52,可是我的cpu中并没有ATML,我该怎么办![图片说明](http://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/5.gif)
自动填充keil的自动填充
keil 5 的自动填充问题 我设置了 设置选项卡那里的文本选项 设置了在输入一个字符后自动填充 但是 他还是只能自动填充类似于GPIOA等等这些关键词 我自己定义的变量还有宏定义的名称都不能自动填充 这样遇到比较长的变量名之后就很容易出错 有没有哪位大神有遇到过我这样的情况愿意赐教的? 菜鸟一枚,求助!!
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小人工智障。 思路可以运用在不同地方,主要介绍的是思路。
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
阿里面试官问我:如何设计秒杀系统?我的回答让他比起大拇指
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图和个人联系方式,欢迎Star和指教 前言 Redis在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在Redis的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸,打败了...
C语言魔塔游戏
很早就很想写这个,今天终于写完了。 游戏截图: 编译环境: VS2017 游戏需要一些图片,如果有想要的或者对游戏有什么看法的可以加我的QQ 2985486630 讨论,如果暂时没有回应,可以在博客下方留言,到时候我会看到。 下面我来介绍一下游戏的主要功能和实现方式 首先是玩家的定义,使用结构体,这个名字是可以自己改变的 struct gamerole { char n...
面试官问我:什么是消息队列?什么场景需要他?用了会出现什么问题?
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式和人才交流群,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸...
Android性能优化(4):UI渲染机制以及优化
文章目录1. 渲染机制分析1.1 渲染机制1.2 卡顿现象1.3 内存抖动2. 渲染优化方式2.1 过度绘制优化2.1.1 Show GPU overdraw2.1.2 Profile GPU Rendering2.2 卡顿优化2.2.1 SysTrace2.2.2 TraceView 在从Android 6.0源码的角度剖析View的绘制原理一文中,我们了解到View的绘制流程有三个步骤,即m...
微服务中的Kafka与Micronaut
今天,我们将通过Apache Kafka主题构建一些彼此异步通信的微服务。我们使用Micronaut框架,它为与Kafka集成提供专门的库。让我们简要介绍一下示例系统的体系结构。我们有四个微型服务:订单服务,行程服务,司机服务和乘客服务。这些应用程序的实现非常简单。它们都有内存存储,并连接到同一个Kafka实例。 我们系统的主要目标是为客户安排行程。订单服务应用程序还充当网关。它接收来自客户的请求...
致 Python 初学者们!
作者| 许向武 责编 | 屠敏 出品 | CSDN 博客 前言 在 Python 进阶的过程中,相信很多同学应该大致上学习了很多 Python 的基础知识,也正在努力成长。在此期间,一定遇到了很多的困惑,对未来的学习方向感到迷茫。我非常理解你们所面临的处境。我从2007年开始接触 Python 这门编程语言,从2009年开始单一使用 Python 应对所有的开发工作,直至今...
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观...
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外...
字节跳动面试官这样问消息队列:分布式事务、重复消费、顺序消费,我整理了一下
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式和人才交流群,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸...
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip installselenium -ihttps://pypi.tuna.tsinghua.edu.cn/simple/ ...
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca...
SpringBoot2.x系列教程(三十六)SpringBoot之Tomcat配置
Spring Boot默认内嵌的Tomcat为Servlet容器,关于Tomcat的所有属性都在ServerProperties配置类中。同时,也可以实现一些接口来自定义内嵌Servlet容器和内嵌Tomcat等的配置。 关于此配置,网络上有大量的资料,但都是基于SpringBoot1.5.x版本,并不适合当前最新版本。本文将带大家了解一下最新版本的使用。 ServerProperties的部分源...
Python绘图,圣诞树,花,爱心 | Turtle篇
每周每日,分享Python实战代码,入门资料,进阶资料,基础语法,爬虫,数据分析,web网站,机器学习,深度学习等等。 公众号回复【进群】沟通交流吧,QQ扫码进群学习吧 微信群 QQ群 1.画圣诞树 import turtle screen = turtle.Screen() screen.setup(800,600) circle = turtle.Turtle()...
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东...
破14亿,Python分析我国存在哪些人口危机!
一、背景 二、爬取数据 三、数据分析 1、总人口 2、男女人口比例 3、人口城镇化 4、人口增长率 5、人口老化(抚养比) 6、各省人口 7、世界人口 四、遇到的问题 遇到的问题 1、数据分页,需要获取从1949-2018年数据,观察到有近20年参数:LAST20,由此推测获取近70年的参数可设置为:LAST70 2、2019年数据没有放上去,可以手动添加上去 3、将数据进行 行列转换 4、列名...
听说想当黑客的都玩过这个Monyer游戏(1~14攻略)
第零关 进入传送门开始第0关(游戏链接) 请点击链接进入第1关: 连接在左边→ ←连接在右边 看不到啊。。。。(只能看到一堆大佬做完的留名,也能看到菜鸡的我,在后面~~) 直接fn+f12吧 &lt;span&gt;连接在左边→&lt;/span&gt; &lt;a href="first.php"&gt;&lt;/a&gt; &lt;span&gt;←连接在右边&lt;/span&gt; o...
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ...... ...
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!...
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。 再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。 下文是原回答,希望能对你能有所启发。 如果我说,这个世界上人真的分三六九等,...
2020年全新Java学习路线图,含配套视频,学完即为中级Java程序员!!
新的一年来临,突如其来的疫情打破了平静的生活! 在家的你是否很无聊,如果无聊就来学习吧! 世上只有一种投资只赚不赔,那就是学习!!! 传智播客于2020年升级了Java学习线路图,硬核升级,免费放送! 学完你就是中级程序员,能更快一步找到工作! 一、Java基础 JavaSE基础是Java中级程序员的起点,是帮助你从小白到懂得编程的必经之路。 在Java基础板块中有6个子模块的学...
B 站上有哪些很好的学习资源?
哇说起B站,在小九眼里就是宝藏般的存在,放年假宅在家时一天刷6、7个小时不在话下,更别提今年的跨年晚会,我简直是跪着看完的!! 最早大家聚在在B站是为了追番,再后来我在上面刷欧美新歌和漂亮小姐姐的舞蹈视频,最近两年我和周围的朋友们已经把B站当作学习教室了,而且学习成本还免费,真是个励志的好平台ヽ(.◕ฺˇд ˇ◕ฺ;)ノ 下面我们就来盘点一下B站上优质的学习资源: 综合类 Oeasy: 综合...
爬取薅羊毛网站百度云资源
这是疫情期间无聊做的爬虫, 去获取暂时用不上的教程 import threading import time import pandas as pd import requests import re from threading import Thread, Lock # import urllib.request as request # req=urllib.request.Requ...
如何优雅地打印一个Java对象?
你好呀,我是沉默王二,一个和黄家驹一样身高,和刘德华一样颜值的程序员。虽然已经写了十多年的 Java 代码,但仍然觉得自己是个菜鸟(请允许我惭愧一下)。 在一个月黑风高的夜晚,我思前想后,觉得再也不能这么蹉跎下去了。于是痛下决心,准备通过输出的方式倒逼输入,以此来修炼自己的内功,从而进阶成为一名真正意义上的大神。与此同时,希望这些文章能够帮助到更多的读者,让大家在学习的路上不再寂寞、空虚和冷。 ...
雷火神山直播超两亿,Web播放器事件监听是怎么实现的?
Web播放器解决了在手机浏览器和PC浏览器上播放音视频数据的问题,让视音频内容可以不依赖用户安装App,就能进行播放以及在社交平台进行传播。在视频业务大数据平台中,播放数据的统计分析非常重要,所以Web播放器在使用过程中,需要对其内部的数据进行收集并上报至服务端,此时,就需要对发生在其内部的一些播放行为进行事件监听。 那么Web播放器事件监听是怎么实现的呢? 01 监听事件明细表 名...
3万字总结,Mysql优化之精髓
本文知识点较多,篇幅较长,请耐心学习 MySQL已经成为时下关系型数据库产品的中坚力量,备受互联网大厂的青睐,出门面试想进BAT,想拿高工资,不会点MySQL优化知识,拿offer的成功率会大大下降。 为什么要优化 系统的吞吐量瓶颈往往出现在数据库的访问速度上 随着应用程序的运行,数据库的中的数据会越来越多,处理时间会相应变慢 数据是存放在磁盘上的,读写速度无法和内存相比 如何优化 设计...
HTML5适合的情人节礼物有纪念日期功能
前言 利用HTML5,css,js实现爱心树 以及 纪念日期的功能 网页有播放音乐功能 以及打字倾诉感情的画面,非常适合情人节送给女朋友 具体的HTML代码 具体只要修改代码里面的男某某和女某某 文字段也可自行修改,还有代码下半部分的JS代码需要修改一下起始日期 注意月份为0~11月 也就是月份需要减一。 当然只有一部分HTML和JS代码不够运行的,文章最下面还附加了完整代码的下载地址 &lt;!...
相关热词 c# 为空 判断 委托 c#记事本颜色 c# 系统默认声音 js中调用c#方法参数 c#引入dll文件报错 c#根据名称实例化 c#从邮件服务器获取邮件 c# 保存文件夹 c#代码打包引用 c# 压缩效率
立即提问