AHF_ContactCheck
AHF_ContactCheck is responsible for detecting the mouse. Currently implemented using Adafruit IR Beam Break Sensors.
startLogging is used to begin registering detections, and updates contact status in AHF_Task.
AHF_ContactCheck.AHF_ContactCheck module
- class AHF_ContactCheck.AHF_ContactCheck(taskP, settingsDictP)
Bases:
AHF_Base.AHF_BaseBase class for ContactCheck. This class handles the detection of mice entering/exiting the trial area.
- abstract checkContact()
Checks for contact.
- Returns
boolwhether contact is made.
- hardwareTest()
Tests functionality, gives user a chance to change settings. :Returns: bool – True if any settings have changed
- abstract startLogging()
Starts running background task, checking for contact.
Constantly updates gTask.contact variable in AHF_Task.
Note: do not use waitForContact or waitForNoContact while logging
- abstract stopLogging()
Stops contactChecker running background task.
- turnOff()
- turnOn()
- abstract waitForContact(timeoutSecs)
Blocks execution until contact or timeout.
Note: do not call while logging via startLogging, as it could lead to deadlocks.
- abstract waitForNoContact(timeoutSecs)
Blocks execution until no contact or timeout.
Note: do not call while logging via startLogging, as it could lead to deadlocks.
AHF_ContactCheck.AHF_ContactCheck_BeamBreak module
- class AHF_ContactCheck_BeamBreak.AHF_ContactCheck_BeamBreak(taskP, settingsDictP)
Bases:
AHF_ContactCheck_Elec.AHF_ContactCheck_Elec- static about()
Returns a brief message describing your sub-class, used when asking user to pick a sub-class of this class
- static config_user_get(starterDict={})
static method that querries user for settings, with default responses from starterDict, and returns starterDict with settings as edited by the user.
- defaultLEDPin = 24
- defaultPin = 12
- setup()
does hardware initialization with(possibly updated) info in self.settingsDict Run by __init__, or can be run separately after editing the settingsDict
- Returns
- code
bool whether setup completed without errors
- turnOff()
- turnOn()
AHF_ContactCheck.AHF_ContactCheck_Elec module
- class AHF_ContactCheck_Elec.AHF_ContactCheck_Elec(taskP, settingsDictP)
Bases:
AHF_ContactCheck.AHF_ContactCheck- static about()
Returns a brief message describing your sub-class, used when asking user to pick a sub-class of this class
- checkContact()
Checks for contact.
- Returns
boolwhether contact is made.
- static config_user_get(starterDict={})
static method that querries user for settings, with default responses from starterDict, and returns starterDict with settings as edited by the user.
- static contactCheckCallback(channel)
Contacts are immediate, but un-contacts are delayed
- debounceTime = 0.1
- defaultPUD = 'PUD_UP'
- defaultPin = 12
- defaultPolarity = 'FALLING'
- setdown()
oppposite of setup. Releases any hardware resouces. can be run before editing settings so GPIO pins can be reused, for example. This strategy should be used in hardwareTest method.
- setup()
does hardware initialization with(possibly updated) info in self.settingsDict Run by __init__, or can be run separately after editing the settingsDict
- Returns
- code
bool whether setup completed without errors
- startLogging()
Starts running background task, checking for contact.
Constantly updates gTask.contact variable in AHF_Task.
Note: do not use waitForContact or waitForNoContact while logging
- stopLogging()
Stops contactChecker running background task.
- waitForContact(timeOutSecs)
Blocks execution until contact or timeout.
Note: do not call while logging via startLogging, as it could lead to deadlocks.
- waitForNoContact(timeOutSecs)
Blocks execution until no contact or timeout.
Note: do not call while logging via startLogging, as it could lead to deadlocks.