4646except ImportError :
4747 pass # not always supported by every board!
4848
49+ __version__ = "0.0.0-auto.0"
50+ __repo__ = "https://github.com/adafruit/CircuitPython_SimpleIO.git"
51+
52+
4953def tone (pin , frequency , duration = 1 , length = 100 ):
5054 """
5155 Generates a square wave of the specified frequency on a pin
5256
53- :param ~microcontroller.Pin Pin : Pin on which to output the tone
57+ :param ~microcontroller.Pin pin : Pin on which to output the tone
5458 :param float frequency: Frequency of tone in Hz
5559 :param int length: Variable size buffer (optional)
5660 :param int duration: Duration of tone in seconds (optional)
@@ -79,7 +83,6 @@ def tone(pin, frequency, duration=1, length=100):
7983 dac .stop ()
8084
8185
82-
8386def bitWrite (x , n , b ): #pylint: disable-msg=invalid-name
8487 """
8588 Based on the Arduino bitWrite function, changes a specific bit of a value to 0 or 1.
@@ -97,7 +100,6 @@ def bitWrite(x, n, b): #pylint: disable-msg=invalid-name
97100 return x
98101
99102
100-
101103def shift_in (data_pin , clock , msb_first = True ):
102104 """
103105 Shifts in a byte of data one bit at a time. Starts from either the LSB or
@@ -127,6 +129,7 @@ def shift_in(data_pin, clock, msb_first=True):
127129 i += 1
128130 return value
129131
132+
130133def shift_out (data_pin , clock , value , msb_first = True , bitcount = 8 ):
131134 """
132135 Shifts out a byte of data one bit at a time. Data gets written to a data
@@ -194,6 +197,7 @@ def shift_out(data_pin, clock, value, msb_first=True, bitcount=8):
194197 clock .value = True
195198 clock .value = False
196199
200+
197201class DigitalOut :
198202 """
199203 Simple digital output that is valid until reload.
@@ -215,6 +219,7 @@ def value(self):
215219 def value (self , value ):
216220 self .iopin .value = value
217221
222+
218223class DigitalIn :
219224 """
220225 Simple digital input that is valid until reload.
@@ -235,6 +240,7 @@ def value(self):
235240 def value (self , value ): #pylint: disable-msg=no-self-use, unused-argument
236241 raise AttributeError ("Cannot set the value on a digital input." )
237242
243+
238244def map_range (x , in_min , in_max , out_min , out_max ):
239245 """
240246 Maps a number from one range to another.
0 commit comments