小弟最近在編寫程式時發現了三個警告,但我一值找不到解決的辦法
目前有三個我無法去除的警告
..SrcWayne_Init.c(42): warning: #61-D: integer operation result is out of range
NVIC->IP[USART1_IRQn>>2]|= 2 << ( (USART1_IRQn&0x3)*8 + 6 );
..SrcWayne_Init.c(42): warning: #68-D: integer conversion resulted in a change of sign
NVIC->IP[USART1_IRQn>>2]|= 2 << ( (USART1_IRQn&0x3)*8 + 6 );
這兩項的來源是中斷(NVIC的初始化)
- void Wayne_Init_NVIC(void)
- {
- NVIC->IP[TIM16_IRQn>>2] |= 3 << ( (TIM16_IRQn&0x3)*8 + 6 ); //設定優先權3
- NVIC->IP[USART1_IRQn>>2] |= 2 << ( (USART1_IRQn&0x3)*8 + 6 ); //設定優先權3
-
- NVIC->ISER[0] |= 1 << TIM16_IRQn //TIM16中斷啟用
- | 1 << USART1_IRQn; //USART1中斷啟用
- }
复制代码
..SrcWayne_Init.c(78): warning: #61-D: integer operation result is out of range
I2C1->TIMINGR = 0x0F<< 28
這一項的來源是中斷(I2C的初始化)
- I2C1->TIMINGR = 0x0F<< 28 //除頻值= 48M/(7+1) = 3MHz
- | 0x0F<< 20 //數據建立時間(4bit) = 16
- | 0x0F<< 16 //數據保持時間(4bit) = 16
- | 0xFF<< 8 //高電平保持時間(8bit)= 32
- | 0xFF<< 0; //低電平保持時間(8bit)= 32
复制代码
請各位幫我看看,是不是我哪裡寫錯了
我這邊是32bit的
typedef struct
{
__IO uint32_t ISER[1]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
uint32_t RESERVED0[31];
__IO uint32_t ICER[1]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
uint32_t RSERVED1[31];
__IO uint32_t ISPR[1]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
uint32_t RESERVED2[31];
__IO uint32_t ICPR[1]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
uint32_t RESERVED3[31];
uint32_t RESERVED4[64];
__IO uint32_t IP[8]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
} NVIC_Type;
一周热门 更多>