+ # Either MISO or MOSI can be omitted (but not both). CS# is optional.
+ self.have_miso = self.has_channel(1)
+ self.have_mosi = self.has_channel(2)
+ self.have_cs = self.has_channel(3)
+ if not self.have_miso and not self.have_mosi:
+ raise ChannelError('Either MISO or MOSI (or both) pins required.')
+
+ # Tell stacked decoders that we don't have a CS# signal.
+ if not self.have_cs:
+ self.put(0, 0, self.out_python, ['CS-CHANGE', None, None])
+
+ # "Pixel compatibility" with the v2 implementation. Grab and
+ # process the very first sample before checking for edges. The
+ # previous implementation did this by seeding old values with None,
+ # which led to an immediate "change" in comparison.
+ pins = self.wait({})
+ (clk, miso, mosi, cs) = pins
+ self.find_clk_edge(miso, mosi, clk, cs)
+
+ while True: