Encoder::~Encoder( ) { cli(); detachInterrupt( g_interruptPinA ); detachInterrupt( g_interruptPinB ); }
void Interrupt::detach() { detachInterrupt(digitalPinToInterrupt(pin_)); disablePullup(); mode_ptr_ = &interrupt::mode_detached; }
void IrTest::stop() { detachInterrupt(digitalPinToInterrupt(irPin)); _testActiveObject = 0; }
void kopouReceiver::deinit() { _enabled = false; if (_interrupt >= 0) { detachInterrupt(_interrupt); } }
void PietteTech_DHT::isrCallback() { unsigned long newUs = micros(); unsigned long delta = (newUs - _us); _us = newUs; if (delta > 6000) { _status = DHTLIB_ERROR_ISR_TIMEOUT; _state = STOPPED; detachInterrupt(_sigPin); return; } switch(_state) { case RESPONSE: // Spec: 80us LOW followed by 80us HIGH if(delta < 65) { // Spec: 20-200us to first falling edge of response _us -= delta; break; //do nothing, it started the response signal } if(125 < delta && delta < 200) { #if defined(DHT_DEBUG_TIMING) *_e++ = delta; // record the edge -> edge time #endif _state = DATA; } else { detachInterrupt(_sigPin); _status = DHTLIB_ERROR_RESPONSE_TIMEOUT; _state = STOPPED; #if defined(DHT_DEBUG_TIMING) *_e++ = delta; // record the edge -> edge time #endif } break; case DATA: // Spec: 50us low followed by high of 26-28us = 0, 70us = 1 if(60 < delta && delta < 155) { //valid in timing _bits[_idx] <<= 1; // shift the data if(delta > 110) //is a one _bits[_idx] |= 1; #if defined(DHT_DEBUG_TIMING) *_e++ = delta; // record the edge -> edge time #endif if (_cnt == 0) { // we have completed the byte, go to next _cnt = 7; // restart at MSB if(++_idx == 5) { // go to next byte, if we have got 5 bytes stop. detachInterrupt(_sigPin); // Verify checksum uint8_t sum = _bits[0] + _bits[1] + _bits[2] + _bits[3]; if (_bits[4] != sum) { _status = DHTLIB_ERROR_CHECKSUM; _state = STOPPED; } else { _status = DHTLIB_OK; _state = ACQUIRED; _convert = true; } break; } } else _cnt--; } else if(delta < 10) { detachInterrupt(_sigPin); _status = DHTLIB_ERROR_DELTA; _state = STOPPED; } else { detachInterrupt(_sigPin); _status = DHTLIB_ERROR_DATA_TIMEOUT; _state = STOPPED; } break; default: break; } }
void int0() { detachInterrupt(0); }
void WlanInterruptDisable() { DEBUGPRINT_F("\tCC3000: WlanInterruptDisable\n\r"); ccspi_int_enabled = 0; detachInterrupt(g_IRQnum); }
// Turn the radio back to standby void RFM69OOK::receiveEnd() { setMode(RF69OOK_MODE_STANDBY); detachInterrupt(_interruptNum); // make sure there're no surprises }
void WlanInterruptDisable() { detachInterrupt(0); //Detaches Pin 3 from interrupt 1 }
void __attribute__((weak)) detachInterruptMultiArch(uint32_t pin) { detachInterrupt(pin); }
void SpiPauseSpi(void) { detachInterrupt(0); //Detaches Pin 3 from interrupt 1 }
String detachinterrupt() { int interrupt=str2int(rdata("interrupt ?")); detachInterrupt(interrupt); return ""; }
/** * @public * There's no timeout with this class: it will listen indefinitely for a change on the interrupt pin. * Use abandon to stop waiting for a pulse. */ void PulseInZero::abandon(){ if(active){ state = active = false; detachInterrupt(0); } }
void WidoNode::deleteInterrupt(uint8_t pin){ detachInterrupt(digitalPinToInterrupt(pin)); }
/** * @brief Get interrupt from buttons. All buttons are pulled up by Saeco intelia motherboard. * Consequently, a button press is detected when : * - a falling edge is detected * - after a time t a rising edge is detected * This time t is button press duration. * * Buttons are debounced on coffee machine hardware side with RC filter. But for some buttons (e.g. brew, small cup) * a software handling must be done to identify button press (refer to oscilloscope captures in hardware/scope_capture). * * @param arg_e_buttonId [description] */ static void saecoIntelia_onBtnStateChanged(ECoffeeButtonsId arg_e_buttonId) { if(_u32_buttPress & (1 << arg_e_buttonId)) { /** Error : button press flag has not been handled on application side - reject new press/release */ return; } /** reject it if caused by noise / rebound */ if(!saecoIntelia_checkButtonState(_au8_coffeePins[arg_e_buttonId + NB_COFFEE_BUTTONS])) { return; } if(digitalRead(_au8_coffeePins[arg_e_buttonId + NB_COFFEE_BUTTONS])) { /** button release */ if(_a_li_pressDur[arg_e_buttonId] == 0) { /** Error : button release but did not get button press */ return; } if(millis() - _a_li_pressDur[arg_e_buttonId] < MIN_PRESS_DUR_MS) { /** not a rebound - refer oscilloscope captures (e.g. on brew) In all cases, do not handle this rising edge - wait next rising edge */ return; } if(_apf_buttonPressCbs[arg_e_buttonId]) { /** set flag indicating button has been pressed in order to handle it in a non interrupted context */ _u32_buttPress |= 1 << arg_e_buttonId; _a_li_pressDur[arg_e_buttonId] = millis() - _a_li_pressDur[arg_e_buttonId]; detachInterrupt(_au8_coffeePins[arg_e_buttonId + NB_COFFEE_BUTTONS]); attachInterrupt(_au8_coffeePins[arg_e_buttonId + NB_COFFEE_BUTTONS], _apf_onButtonStateChangedCbs[arg_e_buttonId], FALLING); } else { /** nothing to do - no callback registered */ } } else { /** button press */ /* start press duration meas */ _a_li_pressDur[arg_e_buttonId] = millis(); detachInterrupt(_au8_coffeePins[arg_e_buttonId + NB_COFFEE_BUTTONS]); attachInterrupt(_au8_coffeePins[arg_e_buttonId + NB_COFFEE_BUTTONS], _apf_onButtonStateChangedCbs[arg_e_buttonId], RISING); } }
/** * Disable receiving data */ void RCSwitch::disableReceive() { #if not defined(RaspberryPi) // Arduino detachInterrupt(this->nReceiverInterrupt); #endif // For Raspberry Pi (wiringPi) you can't unregister the ISR this->nReceiverInterrupt = -1; }
void CC3100_InterruptDisable(void) { if (girq_num != 0xff) detachInterrupt(girq_num); }
// Turn the radio into transmission mode void RFM69OOK::transmitBegin() { setMode(RF69OOK_MODE_TX); detachInterrupt(_interruptNum); // not needed in TX mode pinMode(_interruptPin, OUTPUT); }
/// @details /// Call this once with the node ID (0-31), frequency band (0-3), and /// optional group (0-255 for RFM12B, only 212 allowed for RFM12). /// @param id The ID of this wireless node. ID's should be unique within the /// netGroup in which this node is operating. The ID range is 0 to 31, /// but only 1..30 are available for normal use. You can pass a single /// capital letter as node ID, with 'A' .. 'Z' corresponding to the /// node ID's 1..26, but this convention is now discouraged. ID 0 is /// reserved for OOK use, node ID 31 is special because it will pick /// up packets for any node (in the same netGroup). /// @param band This determines in which frequency range the wireless module /// will operate. The following pre-defined constants are available: /// RF12_433MHZ, RF12_868MHZ, RF12_915MHZ. You should use the one /// matching the module you have. /// @param g Net groups are used to separate nodes: only nodes in the same net /// group can communicate with each other. Valid values are 1 to 212. /// This parameter is optional, it defaults to 212 (0xD4) when omitted. /// This is the only allowed value for RFM12 modules, only RFM12B /// modules support other group values. /// @returns the nodeId, to be compatible with rf12_config(). /// /// Programming Tips /// ---------------- /// Note that rf12_initialize() does not use the EEprom netId and netGroup /// settings, nor does it change the EEPROM settings. To use the netId and /// netGroup settings saved in EEPROM use rf12_config() instead of /// rf12_initialize. The choice whether to use rf12_initialize() or /// rf12_config() at the top of every sketch is one of personal preference. /// To set EEPROM settings for use with rf12_config() use the RF12demo sketch. uint8_t rf12_initialize (uint8_t id, uint8_t band, uint8_t g) { nodeid = id; group = g; rf12_spiInit(); rf12_xfer(0x0000); // intitial SPI transfer added to avoid power-up problem rf12_xfer(RF_SLEEP_MODE); // DC (disable clk pin), enable lbd // wait until RFM12B is out of power-up reset, this takes several *seconds* rf12_xfer(RF_TXREG_WRITE); // in case we're still in OOK mode while (digitalRead(RFM_IRQ) == 0) rf12_xfer(0x0000); rf12_xfer(0x80C7 | (band << 4)); // EL (ena TX), EF (ena RX FIFO), 12.0pF rf12_xfer(0xA640); // 868MHz rf12_xfer(0xC606); // approx 49.2 Kbps, i.e. 10000/29/(1+6) Kbps rf12_xfer(0x94A2); // VDI,FAST,134kHz,0dBm,-91dBm rf12_xfer(0xC2AC); // AL,!ml,DIG,DQD4 if (group != 0) { rf12_xfer(0xCA83); // FIFO8,2-SYNC,!ff,DR rf12_xfer(0xCE00 | group); // SYNC=2DXX; } else { rf12_xfer(0xCA8B); // FIFO8,1-SYNC,!ff,DR rf12_xfer(0xCE2D); // SYNC=2D; } rf12_xfer(0xC483); // @PWR,NO RSTRIC,!st,!fi,OE,EN rf12_xfer(0x9850); // !mp,90kHz,MAX OUT rf12_xfer(0xCC77); // OB1,OB0, LPX,!ddy,DDIT,BW0 rf12_xfer(0xE000); // NOT USE rf12_xfer(0xC800); // NOT USE rf12_xfer(0xC049); // 1.66MHz,3.1V rxstate = TXIDLE; #if PINCHG_IRQ #if RFM_IRQ < 8 if ((nodeid & NODE_ID) != 0) { bitClear(DDRD, RFM_IRQ); // input bitSet(PORTD, RFM_IRQ); // pull-up bitSet(PCMSK2, RFM_IRQ); // pin-change bitSet(PCICR, PCIE2); // enable } else bitClear(PCMSK2, RFM_IRQ); #elif RFM_IRQ < 14 if ((nodeid & NODE_ID) != 0) { bitClear(DDRB, RFM_IRQ - 8); // input bitSet(PORTB, RFM_IRQ - 8); // pull-up bitSet(PCMSK0, RFM_IRQ - 8); // pin-change bitSet(PCICR, PCIE0); // enable } else bitClear(PCMSK0, RFM_IRQ - 8); #else if ((nodeid & NODE_ID) != 0) { bitClear(DDRC, RFM_IRQ - 14); // input bitSet(PORTC, RFM_IRQ - 14); // pull-up bitSet(PCMSK1, RFM_IRQ - 14); // pin-change bitSet(PCICR, PCIE1); // enable } else bitClear(PCMSK1, RFM_IRQ - 14); #endif #else if ((nodeid & NODE_ID) != 0) attachInterrupt(0, rf12_interrupt, LOW); else detachInterrupt(0); #endif return nodeid; }
void OMComHandler::stopWatch() { detachInterrupt(m_which); }
/** * Disable receiving data */ void RCSwitch::disableReceive() { detachInterrupt(this->nReceiverInterrupt); this->nReceiverInterrupt = -1; }
void RFReceiver::stop() { detachInterrupt(m_inputPin); pInstance = NULL; }
static void rcv_disable() { _rcv_state |= RECV_STATE_DISABLED; if (_pinRCV != BrennenstuhlRCS1000N::NO_PIN) { detachInterrupt(digitalPinToInterrupt(_pinRCV)); } }
void neural_task(void *p) { while(1){ detachInterrupt(EXTI_Line0); /*close external interrupt 0*/ detachInterrupt(EXTI_Line1); /*close external interrupt 1*/ detachInterrupt(EXTI_Line2); /*close external interrupt 2*/ detachInterrupt(EXTI_Line3); /*close external interrupt 3*/ if(car_state == CAR_STATE_MOVE_FORWARD){ getMotorData(); rin = move_speed; neural_update(&n_r, rin, speed_right_counter_1, distance_right_counter); neural_update(&n_l, rin, speed_left_counter_1, distance_left_counter); data_record(); float input_l = n_l.u; float input_r = n_r.u; proc_cmd("forward", base_pwm_l+(int)input_l, base_pwm_r+(int)input_r); } else if (car_state == CAR_STATE_MOVE_BACK) { getMotorData(); float err = 0; rin = 10; neural_update(&n_r_back, rin, speed_right_counter_1, distance_right_counter); neural_update(&n_l_back, rin, speed_left_counter_1, distance_left_counter); float input_l = n_l_back.u_1; float input_r = n_r_back.u_1; proc_cmd("forward", base_pwm_l - input_l, base_pwm_r - input_r); } else if (car_state == CAR_STATE_MOVE_LEFT){ rin = 5; getMotorData(); if (distance_right_counter > MOVE_LEFT_RIGHT_PERIOD) { rin = 0; pid_update(&n_r, rin, speed_right_counter_1, distance_right_counter); }else{ pid_update(&n_r, rin, speed_right_counter_1, distance_right_counter); } if (distance_left_counter > MOVE_LEFT_RIGHT_PERIOD) { rin = 0; pid_update(&n_l_back, rin, speed_left_counter_1, distance_left_counter); }else{ pid_update(&n_l_back, rin, speed_left_counter_1, distance_left_counter); } float input_l = n_l_back.u; float input_r = n_r.u; proc_cmd("left", base_pwm_l-(int)input_l, base_pwm_r+(int)input_r); } else if (car_state == CAR_STATE_MOVE_RIGHT){ rin = 5; getMotorData(); if (distance_right_counter > MOVE_LEFT_RIGHT_PERIOD) { rin = 0; pid_update(&n_r_back, rin, speed_right_counter_1, distance_right_counter); }else{ pid_update(&n_r_back, rin, speed_right_counter_1, distance_right_counter); } if (distance_left_counter > MOVE_LEFT_RIGHT_PERIOD) { rin = 0; pid_update(&n_l, rin, speed_left_counter_1, distance_left_counter); }else{ pid_update(&n_l, rin, speed_left_counter_1, distance_left_counter); } float input_l = n_l.u; float input_r = n_r_back.u; proc_cmd("right", base_pwm_l+(int)input_l, base_pwm_r-(int)input_r); } else if(car_state == CAR_STATE_STOPPING){ getMotorData(); if (last_state == CAR_STATE_MOVE_FORWARD) { if ((speed_left_counter_1 > 2) && (speed_right_counter_1 > 2)) { rin = 0; pid_update(&n_l, rin, speed_left_counter_1, distance_left_counter); pid_update(&n_r, rin, speed_right_counter_1, distance_right_counter); float input_l = n_l.u; float input_r = n_r.u; proc_cmd("forward", base_pwm_l + input_l, base_pwm_r + input_r); } else{ record_controller_base(&n_r); record_controller_base(&n_l); controller_reset(&n_r); controller_reset(&n_l); car_state = CAR_STATE_IDLE; proc_cmd("forward", base_pwm_l, base_pwm_r); data_sending = 1; } } else if (last_state == CAR_STATE_MOVE_BACK) { if ((speed_left_counter_1 > 2) && (speed_right_counter_1 > 2)) { rin = 0; pid_update(&n_l_back, rin, speed_left_counter_1, distance_left_counter); pid_update(&n_r_back, rin, speed_right_counter_1, distance_right_counter); float input_l = n_l_back.u; float input_r = n_r_back.u; proc_cmd("forward", base_pwm_l - input_l, base_pwm_r - input_r); } else{ record_controller_base(&n_r_back); record_controller_base(&n_l_back); controller_reset(&n_r_back); controller_reset(&n_l_back); car_state = CAR_STATE_IDLE; proc_cmd("forward", base_pwm_l, base_pwm_r); data_sending = 1; } } else if (last_state == CAR_STATE_MOVE_LEFT) { if ((speed_left_counter_1 > 2) && (speed_right_counter_1 > 2)) { rin = 0; pid_update(&n_l_back, rin, speed_left_counter_1, distance_left_counter); pid_update(&n_r, rin, speed_right_counter_1, distance_right_counter); float input_l = n_l_back.u; float input_r = n_r.u; proc_cmd("forward", base_pwm_l - input_l, base_pwm_r + input_r); } else{ //record_controller_base(&n_r); //record_controller_base(&n_l_back); controller_reset(&n_r); controller_reset(&n_l_back); car_state = CAR_STATE_IDLE; proc_cmd("forward", base_pwm_l, base_pwm_r); data_sending = 1; } } else if (last_state == CAR_STATE_MOVE_RIGHT) { if ((speed_left_counter_1 > 2) && (speed_right_counter_1 > 2)) { rin = 0; pid_update(&n_l, rin, speed_left_counter_1, distance_left_counter); pid_update(&n_r_back, rin, speed_right_counter_1, distance_right_counter); float input_l = n_l.u; float input_r = n_r_back.u; proc_cmd("forward", base_pwm_l + input_l, base_pwm_r - input_r); } else{ //record_controller_base(&n_r_back); //record_controller_base(&n_l); controller_reset(&n_r_back); controller_reset(&n_l); car_state = CAR_STATE_IDLE; proc_cmd("forward", base_pwm_l, base_pwm_r); data_sending = 1; } } } else if(car_state == CAR_STATE_IDLE){ proc_cmd("forward", base_pwm_l, base_pwm_r); speeed_initialize(); distance_initialize(); } else{ } attachInterrupt(EXTI_Line0); attachInterrupt(EXTI_Line1); attachInterrupt(EXTI_Line2); attachInterrupt(EXTI_Line3); vTaskDelay(NEURAL_PERIOD); } }
void IR::uninitialise(int pinNum) { detachInterrupt(pinNum); }
void MCP::interruptCallback() { DEBUG4_PRINT("MCP.intCB "); detachInterrupt(appSettings.m_int); timerBtnHandle.initializeMs(DEBOUNCE_TIME, TimerDelegate(&MCP::interruptHandler, this)).startOnce(); }
void RFReceiver::stop() { detachInterrupt(0); pInstance = NULL; }