void kx122_uninstall_isr(const kx122_context dev, KX122_INTERRUPT_PIN_T intp) { assert(dev != NULL); if(intp == INT1 && dev->gpio1){ mraa_gpio_isr_exit(dev->gpio1); mraa_gpio_close(dev->gpio1); dev->gpio1 = NULL; } else if(intp == INT2 && dev->gpio2){ mraa_gpio_isr_exit(dev->gpio2); mraa_gpio_close(dev->gpio2); dev->gpio2 = NULL; } }
void bno055_uninstall_isr(const bno055_context dev) { assert(dev != NULL); if (dev->gpio) { mraa_gpio_isr_exit(dev->gpio); mraa_gpio_close(dev->gpio); dev->gpio = NULL; } }
/** * Exits callback - this call will not kill the isr thread immediately * but only when it is out of it's critical section * * @return Result of operation */ Result isrExit() { #if defined(SWIGJAVASCRIPT) #if NODE_MODULE_VERSION >= 0x000D m_v8isr.Reset(); #else m_v8isr.Dispose(); m_v8isr.Clear(); #endif #endif return (Result) mraa_gpio_isr_exit(m_gpio); }
FskErr mraaDigitalRepeat(FskPinDigital pin, FskPinDigitalRepeatTriggerProc triggeredCallback, void *refCon) { mraaDigital md = (mraaDigital)pin; mraa_result_t result = MRAA_SUCCESS; md->triggeredCallback = triggeredCallback; md->refCon = refCon; mraa_gpio_isr_exit(md->context); if (triggeredCallback) result = mraa_gpio_isr(md->context, MRAA_GPIO_EDGE_BOTH, mraaDigitalCallback, md); return (MRAA_SUCCESS == result) ? kFskErrNone : kFskErrOperationFailed; }
void lis3dh_uninstall_isr(const lis3dh_context dev, LIS3DH_INTERRUPT_PINS_T intr) { assert(dev != NULL); switch (intr) { case LIS3DH_INTERRUPT_INT1: if (dev->gpioINT1) { mraa_gpio_isr_exit(dev->gpioINT1); mraa_gpio_close(dev->gpioINT1); dev->gpioINT1 = NULL; } break; case LIS3DH_INTERRUPT_INT2: if (dev->gpioINT2) { mraa_gpio_isr_exit(dev->gpioINT2); mraa_gpio_close(dev->gpioINT2); dev->gpioINT2 = NULL; } break; } }
static mraa_result_t mraa_gpio_unexport_force(mraa_gpio_context dev) { int unexport = open(SYSFS_CLASS_GPIO "/unexport", O_WRONLY); if (unexport == -1) { syslog(LOG_ERR, "gpio: Failed to open unexport for writing"); return MRAA_ERROR_INVALID_RESOURCE; } char bu[MAX_SIZE]; int length = snprintf(bu, sizeof(bu), "%d", dev->pin); if (write(unexport, bu, length*sizeof(char)) == -1) { syslog(LOG_ERR, "gpio: Failed to write to unexport"); close(unexport); return MRAA_ERROR_INVALID_RESOURCE; } close(unexport); mraa_gpio_isr_exit(dev); return MRAA_SUCCESS; }
int main(int argc, char *argv[]) { mraa_init(); fprintf(stdout, "Hello mraa.\nVersion: %s\n", mraa_get_version()); // LED out = mraa_gpio_init(20); if(out == NULL){ printf("Error: init out.\r\n"); return 1; } mraa_gpio_dir(out, MRAA_GPIO_OUT); // Switch mraa_gpio_context in = mraa_gpio_init(14); if(in == NULL){ printf("Error: init in.\r\n"); return 1; } mraa_gpio_dir(in, MRAA_GPIO_IN); mraa_gpio_mode(in, MRAA_GPIO_PULLUP); // 割込関数の登録 mraa_gpio_isr(in, MRAA_GPIO_EDGE_BOTH, interrupt_in, (void *)in); while(1) {} mraa_gpio_isr_exit(in); mraa_gpio_close(in); mraa_gpio_close(out); mraa_deinit(); return 0; }
/** * Exits callback - this call will not kill the isr thread imediatlu * but only when it is out of it's critical section * * @return Result of operation */ mraa_result_t isrExit() { #if defined(SWIGJAVASCRIPT) m_v8isr.Dispose(); #endif return mraa_gpio_isr_exit(m_gpio); }
upm_result_t a110x_uninstall_isr(a110x_context dev){ mraa_gpio_isr_exit(dev->gpio); dev->isr_installed = false; return UPM_SUCCESS; }
/** * Exits callback - this call will not kill the isr thread imediatlu * but only when it is out of it's critical section * * @return Result of operation */ mraa_result_t isrExit() { return mraa_gpio_isr_exit(m_gpio); }
void closeISRO( mraa_gpio_context isro ) { mraa_gpio_isr_exit( isro ); }