5 Replies Latest reply on Nov 11, 2019 6:53 PM by YiZ_31

    怎么控制某一个GPIO管脚开关中断

    jawu_4351971

      我想程序运行的过程中开启/关闭管脚中断,通过以下方式没有成功,请问正确的方式是什么?

      void CyCx3ImuIntEnable(void)
      {
          CyU3PGpioSimpleConfig_t gpioConf;
          CyU3PReturnStatus_t status = CY_U3P_SUCCESS;
          /* Configure CLOVER_IMU_INT pin*/
          gpioConf.outValue = CyFalse;
          gpioConf.driveLowEn = CyFalse;
          gpioConf.driveHighEn = CyFalse;
          gpioConf.inputEn = CyTrue;
          gpioConf.intrMode = CY_U3P_GPIO_INTR_POS_EDGE;
          status = CyU3PGpioSetSimpleConfig(CLOVER_IMU_INT, &gpioConf);
          if (status != CY_U3P_SUCCESS)
          {
              Cx3Err("[GPIO] imu interrupt pin enable failure %d\r\n", status);
              return;
          }
      }
      
      void CyCx3ImuIntDisable(void)
      {
          CyU3PGpioSimpleConfig_t gpioConf;
          CyU3PReturnStatus_t status = CY_U3P_SUCCESS;
          /* Configure CLOVER_IMU_INT pin*/
          gpioConf.outValue = CyFalse;
          gpioConf.driveLowEn = CyFalse;
          gpioConf.driveHighEn = CyFalse;
          gpioConf.inputEn = CyFalse;
          gpioConf.intrMode = CY_U3P_GPIO_NO_INTR;
          status = CyU3PGpioSetSimpleConfig(CLOVER_IMU_INT, &gpioConf);
          if (status != CY_U3P_SUCCESS)
          {
              Cx3Err("[GPIO] imu interrupt pin disable failure %d\r\n", status);
              return;
          }
      }
      
      CyU3PGpioSetSimpleConfig  返回值为0x44 CY_U3P_ERROR_NOT_CONFIGURED