src/C/devices.c
dev_gpio_info_t *dev_get_gpio_from_gpio_kref(gpioref_t kref)
{
    /*
     * We loop on all devices to find the given GPIO kref
     * FIXME: need for some optimizations to avoid "brute force"
     *        searching
     */
    for (uint8_t i = ID_DEV1; i < ID_DEV_MAX; ++i) {
        /* No more devices, just leave loop */
        if (device_tab[i].status == DEV_STATE_NONE) {
            break;
        }
        device_t *udev = (device_t*)&device_tab[i];
        /* We loop on all gpios to find the given GPIO kref */
        for (uint8_t gpio = 0; gpio < udev->gpio_num; ++gpio) {
            if (udev->gpios[gpio].kref.val == kref.val) {
                return &udev->gpios[gpio];
            }
        }
    }
    return 0;
}
/*
 * \brief return GPIO info from gpio kref identifier
 */
\brief return GPIO info from gpio kref identifier
\ brief return GPIO info from gpio kref identifier
dev_gpio_info_t *dev_get_gpio_from_gpio_kref(gpioref_t kref)
{
    for (uint8_t i = ID_DEV1; i < ID_DEV_MAX; ++i) {
        if (device_tab[i].status == DEV_STATE_NONE) {
            break;
        }
        device_t *udev = (device_t*)&device_tab[i];
        for (uint8_t gpio = 0; gpio < udev->gpio_num; ++gpio) {
            if (udev->gpios[gpio].kref.val == kref.val) {
                return &udev->gpios[gpio];
            }
        }
    }
    return 0;
}
dev_gpio_info_t * dev_get_gpio_from_gpio_kref ( gpioref_t kref ) { for ( uint8_t i = ID_DEV1 ; i < ID_DEV_MAX ; ++ i ) { if ( device_tab [ i ] . status == DEV_STATE_NONE ) { break ; } device_t * udev = ( device_t * ) & device_tab [ i ] ; for ( uint8_t gpio = 0 ; gpio < udev -> gpio_num ; ++ gpio ) { if ( udev -> gpios [ gpio ] . kref . val == kref . val ) { return & udev -> gpios [ gpio ] ; } } } return 0 ; }
\brief return GPIO info from gpio kref identifier
\ brief return GPIO info from gpio kref identifier
/*
     * We loop on all devices to find the given GPIO kref
     * FIXME: need for some optimizations to avoid "brute force"
     *        searching
     */ /* No more devices, just leave loop */ /* We loop on all gpios to find the given GPIO kref */