sui77 / rc-switch

Arduino lib to operate 433/315Mhz devices like power outlet sockets.
1.94k stars 662 forks source link

CH32X035 how to work #511

Open vuhazu opened 5 months ago

vuhazu commented 5 months ago

i change interrupt function, build ok, but not working

void RCSwitch::enableReceive() { if (this->nReceiverInterrupt != -1) { RCSwitch::nReceivedValue = 0; RCSwitch::nReceivedBitlength = 0;

if defined(RaspberryPi) // Raspberry Pi

wiringPiISR(this->nReceiverInterrupt, INT_EDGE_BOTH, &handleInterrupt);

elif defined(CH32X035) // CH32x035

attachInterrupt(this->nReceiverInterrupt,GPIO_Mode_IPU, handleInterrupt, EXTI_Mode_Interrupt, EXTI_Trigger_Rising_Falling );

else // ARDUINO

attachInterrupt(this->nReceiverInterrupt, handleInterrupt, CHANGE); 

endif

} }

vuhazu commented 5 months ago

CH32X035 interrupt function

void attachInterrupt(uint32_t pin,GPIOMode_TypeDef io_mode, void (*callback)(void), EXTIMode_TypeDef it_mode, EXTITrigger_TypeDef trigger_mode); void detachInterrupt(uint32_t pin);