sui77 / rc-switch

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

CH32X035 how to work #511

Open vuhazu opened 1 month ago

vuhazu commented 1 month 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 1 month 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);