From 8e7fe971cb6f8fc807a9e41ea21e32963b53f085 Mon Sep 17 00:00:00 2001 From: occheung Date: Mon, 10 Aug 2020 00:52:05 +0800 Subject: [PATCH] cpld: add release --- src/cpld.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/cpld.rs b/src/cpld.rs index b2ceece..730e7e9 100644 --- a/src/cpld.rs +++ b/src/cpld.rs @@ -48,15 +48,20 @@ impl CPLD where match channel & (1 << 0) { 0 => self.chip_select.0.set_low(), _ => self.chip_select.0.set_high(), - }; + }.ok(); match channel & (1 << 1) { 0 => self.chip_select.1.set_low(), _ => self.chip_select.1.set_high(), - }; + }.ok(); match channel & (1 << 2) { 0 => self.chip_select.2.set_low(), _ => self.chip_select.2.set_high(), - }; + }.ok(); + } + + // Return the SPI and CS pins + pub fn release(self) -> (SPI, (CS0, CS1, CS2)) { + return (self.spi, self.chip_select); } }