MCPcopy Create free account
hub / github.com/RetiredWizard/PyDOS / __exit__

Method __exit__

mpython/NanoConnect/lib/spidevice.py:86–103  ·  view source on GitHub ↗
(
        self,
        exc_type: Optional[Type[type]],
        exc_val: Optional[BaseException],
        exc_tb: Optional[TracebackType],
    )

Source from the content-addressed store, hash-verified

84 return self.spi
85
86 def __exit__(
87 self,
88 exc_type: Optional[Type[type]],
89 exc_val: Optional[BaseException],
90 exc_tb: Optional[TracebackType],
91 ) -> bool:
92 if self.chip_select:
93 self.chip_select.value(not self.cs_active_value)
94 if self.extra_clocks > 0:
95 buf = bytearray(1)
96 buf[0] = 0xFF
97 clocks = self.extra_clocks // 8
98 if self.extra_clocks % 8 != 0:
99 clocks += 1
100 for _ in range(clocks):
101 self.spi.write(buf)
102 #self.spi.unlock()
103 return False

Callers

nothing calls this directly

Calls 2

valueMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected