pub fn request(&self, consumer: &str, flags: RequestFlags, gpio: u32, default: u8) -> io::Result<(GpioHandle)> {
        let mut request = ioctl::gpiohandle_request { lineoffsets: [0; 64], flags: 0, default_values: [0; 64], consumer_label: [0; 32], lines: 0, fd: 0 };

        request.lineoffsets[0] = gpio;
        request.flags = flags.bits;
        request.default_values[0] = default;
        request.lines = 1;

        for i in 0..request.consumer_label.len() {
            if i >= consumer.len() {
                break;
            }
            request.consumer_label[i] = consumer.as_bytes()[i] as std::os::raw::c_char;
        }

        try!(from_nix_result(unsafe {
            ioctl::get_linehandle(self.file.as_raw_fd(), &mut request)
        }));

        Ok(GpioHandle {file: unsafe {std::fs::File::from_raw_fd(request.fd)}, consumer: consumer.to_string(), flags: flags, gpio: gpio})
    }
/// Request a `GpioHandle` for a single gpio
Request a `GpioHandle` for a single gpio
Request a ` GpioHandle ` for a single gpio
pub fn request(&self, consumer: &str, flags: RequestFlags, gpio: u32, default: u8) -> io::Result<(GpioHandle)> {
        let mut request = ioctl::gpiohandle_request { lineoffsets: [0; 64], flags: 0, default_values: [0; 64], consumer_label: [0; 32], lines: 0, fd: 0 };
        request.lineoffsets[0] = gpio;
        request.flags = flags.bits;
        request.default_values[0] = default;
        request.lines = 1;
        for i in 0..request.consumer_label.len() {
            if i >= consumer.len() {
                break;
            }
            request.consumer_label[i] = consumer.as_bytes()[i] as std::os::raw::c_char;
        }
        try!(from_nix_result(unsafe {
            ioctl::get_linehandle(self.file.as_raw_fd(), &mut request)
        }));
        Ok(GpioHandle {file: unsafe {std::fs::File::from_raw_fd(request.fd)}, consumer: consumer.to_string(), flags: flags, gpio: gpio})
    }
pub fn request ( & self , consumer : & str , flags : RequestFlags , gpio : u32 , default : u8 ) -> io :: Result < ( GpioHandle ) > { let mut request = ioctl :: gpiohandle_request { lineoffsets : [ 0 ; 64 ] , flags : 0 , default_values : [ 0 ; 64 ] , consumer_label : [ 0 ; 32 ] , lines : 0 , fd : 0 } ; request . lineoffsets [ 0 ] = gpio ; request . flags = flags . bits ; request . default_values [ 0 ] = default ; request . lines = 1 ; for i in 0 .. request . consumer_label . len ( ) { if i >= consumer . len ( ) { break ; } request . consumer_label [ i ] = consumer . as_bytes ( ) [ i ] as std :: os :: raw :: c_char ; } try ! ( from_nix_result ( unsafe { ioctl get_linehandle ( self file as_raw_fd ( ) mut request ) } ) ) ; Ok ( GpioHandle { file : unsafe { std :: fs :: File :: from_raw_fd ( request . fd ) } , consumer : consumer . to_string ( ) , flags : flags , gpio : gpio } ) }
Request a `GpioHandle` for a single gpio
Request a ` GpioHandle ` for a single gpio
&self
consumer
&str
flags
RequestFlags
gpio
u32
default
u8
&self
consumer
&str
flags
RequestFlags
gpio
u32
default
u8