import dv_processing as dv

# Open a Davis camera
capture = dv.io.camera.DAVIS()

# - Access biases raw value
# Photoreceptor bias
defaultPrBpInt = capture.getDavis346BiasCurrent(dv.io.camera.DAVIS.Davis346BiasCF.Photoreceptor)
# Source follower bias
defaultPrSfBpInt = capture.getDavis346BiasCurrent(dv.io.camera.DAVIS.Davis346BiasCF.PhotoreceptorSourceFollower)
# Differential bias
defaultDiffBnInt = capture.getDavis346BiasCurrent(dv.io.camera.DAVIS.Davis346BiasCF.Diff)
# On threshold bias
defaultOnBnInt = capture.getDavis346BiasCurrent(dv.io.camera.DAVIS.Davis346BiasCF.On)
# Off threshold bias
defaultOffBnInt = capture.getDavis346BiasCurrent(dv.io.camera.DAVIS.Davis346BiasCF.Off)
# Refractory period bias
defaultRefrBpInt = capture.getDavis346BiasCurrent(dv.io.camera.DAVIS.Davis346BiasCF.Refractory)

# Change biases values by 1 milliAmpere (1 mio picoAmpere).
defaultPrBpInt += 1000000
defaultPrSfBpInt += 1000000
defaultDiffBnInt += 1000000
defaultOnBnInt += 1000000
defaultOffBnInt += 1000000
defaultRefrBpInt += 1000000

# Set biases raw value
# Setting photoreceptor bias
capture.setDavis346BiasCurrent(dv.io.camera.DAVIS.Davis346BiasCF.Photoreceptor, defaultPrBpInt)
# Setting source follower bias
capture.setDavis346BiasCurrent(dv.io.camera.DAVIS.Davis346BiasCF.PhotoreceptorSourceFollower, defaultPrSfBpInt)
# Setting differential bias
capture.setDavis346BiasCurrent(dv.io.camera.DAVIS.Davis346BiasCF.Diff, defaultDiffBnInt)
# Setting on threshold bias
capture.setDavis346BiasCurrent(dv.io.camera.DAVIS.Davis346BiasCF.On, defaultOnBnInt)
# Setting off threshold bias
capture.setDavis346BiasCurrent(dv.io.camera.DAVIS.Davis346BiasCF.Off, defaultOffBnInt)
# Setting refractory period bias
capture.setDavis346BiasCurrent(dv.io.camera.DAVIS.Davis346BiasCF.Refractory, defaultRefrBpInt)
