弱HAL_GPIO_EXT1_Callback(uint16_t GPIO_Pin),即使我在源中定义了HAL_GPIO_EXT1_Callback(uint16_t GPIO_Pin)

问题描述 投票:0回答:1

我正在使用Blue Pill板在STM32 CubeIDE中工作。

为了控制main.c的大小,我将功能组聚集到几个c / h对文件中。其中一对是'myirqcallbacks.c / h“。此刻,我在该c / h对中有两个UART IRQ和一个外部引脚IRQ回调。

UART工作正常,但是EXT IRQ无法调用我的代码。而是在stm32f1xx_hal_gpio.c中运行__weak副本。

当代码在main.c中时,它运行正常。

似乎编译器看不到我的EXT IRQ回调函数,因此无法弃用__weak的回调副本。但是,它可以在那里看到两个UART回调函数。 GPIO和UART IRQ的结构是否有些不同?

myirqcallbacks.h

    /*
 * myirqcallbacks.h
 *
 *  Created on: 13 May 2020
 *      Author: Paul
 */



#ifndef SRC_MYIRQCALLBACKS_H_
#define SRC_MYIRQCALLBACKS_H_

void HAL_GPIO_EXT1_Callback ( uint16_t GPIO_Pin);  // SIM Reset detected

void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart);  // Outgoing debug, control and up-the-line data.

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) ; // Data from SIM


#endif /* SRC_MYIRQCALLBACKS_H_ */

myirqcallbacks.c

     * myirqcallbacks.c
 *
 *  Created on: 13 May 2020
 *      Author: Paul
 */
#include <circbuf.h>
#include "main.h"
#include "stdio.h"
#include "myfuncs.h"
#include "myirqcallbacks.h"
#include "globals.h"

void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)  // Outgoing debug, control and up-the-line data.
{
    if( huart->Instance == huart1.Instance)
    {
        if( buf_tx1.count > 0)

        {
            uint8_t item;
            cb_pop_front(&buf_tx1, &item );
            if(HAL_UART_Transmit_IT(&huart1, &item, 1 )!= HAL_OK)
                    Error_Handler();
        }
    }
    __NOP();// Check all data sent
}
//HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)

void HAL_GPIO_EXT1_Callback ( uint16_t GPIO_Pin)  //Reset UICC detected
{
    if( GPIO_Pin == SIM_RST_Pin)
    {
        HAL_NVIC_ClearPendingIRQ(GPIO_Pin);
          SIMState= SIM_STATE_ATR;
          SIM_ATR_Processing = 1;
          SIM_ATR_BytesExpected = 2; //  +last byte will always be TK (CheckByte)
          SIM_ATR_COUNT = 0;
          debug("\nSIM-Reset!  Proc. ATR\n");
    }
}



void    HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)  // Data from SIM
    {
        if( huart->Instance == huart2.Instance)
        {
            uint8_t item;
            if(HAL_UART_Receive_IT(&huart2, &item, 1)!=HAL_OK)
                Error_Handler();
            //cb_push_back(&buf_rx2, &item);   // Still need to send this up the line, just using local copy to set speed and to debug
            if(SIM_ATR_Processing)
                processATRByte(item);
        }
    __NOP();// Check all data received
    }

[我认为这比我的C文件结构知识要重要得多,但是我已经花了几天的时间,任何指针都将不胜感激。

hal bluepill stm32cubeide
1个回答
0
投票

有人确实在函数名称中发现了错误,对此表示感谢。遗憾的是,这并不能解决问题,我一定是在试图解决主要问题的过程中产生了这一点。最终解决此问题的是重新生成MX Configurator的代码,该代码重新生成了stm32F1xx_hal_gpio.c / h和stm32F1xx_hal_gpio.ex.c / h文件。我先删除了本地副本。

© www.soinside.com 2019 - 2024. All rights reserved.