Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions source/pyControl/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ def __init__(self, channel=1):
# User functions

def off(self):
self._DAC.write_timed(_off_buf, pyb.Timer(2, freq=10000), mode=pyb.DAC.NORMAL)
self._DAC.write_timed(_off_buf, pyb.Timer(4, freq=10000), mode=pyb.DAC.NORMAL)
self._timer.deinit()
self._playing = False

def sine(self, freq): # Play a sine wave tone at the specified frequency.
self._DAC.write_timed(_sine_buf, pyb.Timer(2, freq=freq * _sine_len), mode=pyb.DAC.CIRCULAR)
self._DAC.write_timed(_sine_buf, pyb.Timer(4, freq=freq * _sine_len), mode=pyb.DAC.CIRCULAR)

def square(self, freq): # Play a square wave tone at the specified frequency.
self._DAC.write_timed(_sqr_buf, pyb.Timer(2, freq=freq * 2), mode=pyb.DAC.CIRCULAR)
self._DAC.write_timed(_sqr_buf, pyb.Timer(4, freq=freq * 2), mode=pyb.DAC.CIRCULAR)

def noise(self, freq=10000): # Play white noise with specified maximum frequency.
self._DAC.noise(freq * 2)

def click(self, timer=None): # Play a single click.
self._DAC.write_timed(_click_buf, pyb.Timer(2, freq=40000), mode=pyb.DAC.NORMAL)
self._DAC.write_timed(_click_buf, pyb.Timer(4, freq=40000), mode=pyb.DAC.NORMAL)

def clicks(self, rate): # Play clicks at specified rate.
self._timer.init(freq=rate)
Expand Down
4 changes: 2 additions & 2 deletions source/pyControl/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def get(self) -> int:

IO_dict = {} # Dictionary {ID: IO_object} containing all hardware inputs and outputs.

available_timers = [3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14] # Hardware timers not in use
# Used timers; 1: Framework clock tick, 2: Audio write_timed, 6: DAC write_timed.
available_timers = [3, 5, 7, 8, 9, 10, 11, 12, 13, 14] # Hardware timers not in use.
# Used timers; 1: Framework clock tick, 2: Rotary encoder, 4: Audio write_timed, 6: DAC write_timed.

initialised = False # Set to True once hardware has been intiialised.

Expand Down