Skip to content

Commit

Permalink
renamed configure() to reset() for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
ZodiusInfuser committed Aug 24, 2023
1 parent 6ce7966 commit d142dfb
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 26 deletions.
26 changes: 13 additions & 13 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ Yukon(voltage_limit=DEFAULT_VOLTAGE_LIMIT : float,
current_limit=DEFAULT_CURRENT_LIMIT : float,
temperature_limit=DEFAULT_TEMPERATURE_LIMIT : float
logging_level=logging.LOG_INFO : int)
reset() -> None

## Misc ##
change_logging(logging_level : int)

## Slot ##
Expand All @@ -250,7 +253,7 @@ set_led(switch : int | string, value : bool) -> None
## Power Control ##
enable_main_output() -> None
disable_main_output() -> None
is_main_output() -> bool
is_main_output_enabled() -> bool

## Sensing ##
read_voltage() -> float
Expand All @@ -270,9 +273,6 @@ monitor_once(allowed : list | None, excluded : list | None) -> None
get_readings() -> OrderedDict
process_readings() -> None
clear_readings() -> None

## Other ##
reset() -> None
```

### Yukon Module
Expand All @@ -287,7 +287,7 @@ YukonModule()
initialise(slot : SLOT, adc1_func : Any, adc2_func : Any) -> None
is_initialised() -> bool
deregister() -> None
configure() -> None
reset() -> None

## Monitoring ##
assign_monitor_action(callback_function : Any) -> None
Expand Down Expand Up @@ -322,7 +322,7 @@ is_module(adc_level : int, slow1 : bool, slow2 : bool, slow3 :bool) -> bool
## Initialisation ##
AudioAmpModule()
initialise(slot : SLOT, adc1_func : Any, adc2_func : Any) -> None
configure() -> None
reset() -> None

## Power Control ##
enable() -> None
Expand Down Expand Up @@ -380,7 +380,7 @@ is_module(adc_level : int, slow1 : bool, slow2 : bool, slow3 :bool) -> bool
## Initialisation ##
BenchPowerModule(halt_on_not_pgood=False : bool)
initialise(slot : SLOT, adc1_func : Any, adc2_func : Any) -> None
configure() -> None
reset() -> None

## Power Control
enable() -> None
Expand Down Expand Up @@ -430,7 +430,7 @@ is_module(adc_level : int, slow1 : bool, slow2 : bool, slow3 :bool) -> bool
## Initialisation ##
BigMotorModule(frequency=DEFAULT_FREQUENCY : float)
initialise(slot : SLOT, adc1_func : Any, adc2_func : Any) -> None
configure() -> None
reset() -> None

## Power Control ##
enable() -> None
Expand Down Expand Up @@ -481,7 +481,7 @@ is_module(adc_level : int, slow1 : bool, slow2 : bool, slow3 :bool) -> bool
DualMotorModule(motor_type=DUAL : int,
frequency=DEFAULT_FREQUENCY : float)
initialise(slot : SLOT, adc1_func : Any, adc2_func : Any) -> None
configure() -> None
reset() -> None

## Power Control ##
enable() -> None
Expand Down Expand Up @@ -524,7 +524,7 @@ is_module(adc_level : int, slow1 : bool, slow2 : bool, slow3 :bool) -> bool
## Initialisation ##
DualSwitchedModule(halt_on_not_pgood=False : bool)
initialise(slot : SLOT, adc1_func : Any, adc2_func : Any) -> None
configure() -> None
reset() -> None

## Power Control ##
enable() -> None
Expand Down Expand Up @@ -570,7 +570,7 @@ is_module(adc_level : int, slow1 : bool, slow2 : bool, slow3 :bool) -> bool
## Initialisation ##
LEDStripModule(strip_type : int, num_pixels : int, brightness=1.0 : float, halt_on_not_pgood=False : bool)
initialise(slot : SLOT, adc1_func : Any, adc2_func : Any) -> None
configure() -> None
reset() -> None

## Misc ##
count() -> int
Expand Down Expand Up @@ -617,7 +617,7 @@ is_module(adc_level : int, slow1 : bool, slow2 : bool, slow3 :bool) -> bool
## Initialisation ##
QuadServoDirect()
initialise(slot : SLOT, adc1_func : Any, adc2_func : Any) -> None
configure() -> None
reset() -> None

## Sensing ##
read_adc1() -> float
Expand Down Expand Up @@ -651,7 +651,7 @@ is_module(adc_level : int, slow1 : bool, slow2 : bool, slow3 :bool) -> bool
## Initialisation ##
QuadServoRegModule(halt_on_not_pgood=False : bool)
initialise(slot : SLOT, adc1_func : Any, adc2_func : Any) -> None
configure() -> None
reset() -> None

## Power Control ##
enable() -> None
Expand Down
2 changes: 1 addition & 1 deletion lib/pimoroni_yukon/modules/audio_amp.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def initialise(self, slot, adc1_func, adc2_func):
# Pass the slot and adc functions up to the parent now that module specific initialisation has finished
super().initialise(slot, adc1_func, adc2_func)

def configure(self):
def reset(self):
self.__slow_sda.init(Pin.OUT, value=True)
self.__slow_scl.init(Pin.OUT, value=True)
self.__amp_en.init(Pin.OUT, value=False)
Expand Down
2 changes: 1 addition & 1 deletion lib/pimoroni_yukon/modules/bench_power.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def initialise(self, slot, adc1_func, adc2_func):
# Pass the slot and adc functions up to the parent now that module specific initialisation has finished
super().initialise(slot, adc1_func, adc2_func)

def configure(self):
def reset(self):
self.voltage_pwm.duty_u16(0)

self.__power_en.init(Pin.OUT, value=False)
Expand Down
2 changes: 1 addition & 1 deletion lib/pimoroni_yukon/modules/big_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def initialise(self, slot, adc1_func, adc2_func):
# Pass the slot and adc functions up to the parent now that module specific initialisation has finished
super().initialise(slot, adc1_func, adc2_func)

def configure(self):
def reset(self):
self.motor.disable()
self.motor.decay_mode(SLOW_DECAY)

Expand Down
12 changes: 7 additions & 5 deletions lib/pimoroni_yukon/modules/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def initialise(self, slot, adc1_func, adc2_func):
self.__adc1_func = adc1_func
self.__adc2_func = adc2_func

# Configure any objects created during initialisation
self.configure()
# Put any objects created during initialisation into a known state
self.reset()

def is_initialised(self):
return self.slot is not None
Expand All @@ -50,8 +50,8 @@ def deregister(self):
self.__adc1_func = None
self.__adc2_func = None

def configure(self):
# Function for (re)configuring pins etc to their default states needed by the module
def reset(self):
# Override this to reset the module back into a default state post-initialisation
pass

def __read_adc1(self):
Expand All @@ -75,13 +75,15 @@ def assign_monitor_action(self, callback_function):
self.__monitor_action_callback = callback_function

def monitor(self):
# Override this to perform any module specific monitoring
pass

def get_readings(self):
# Override this to return any readings obtained during monitoring
return OrderedDict()

def process_readings(self):
# Use this to calculate averages, or do other post-processing on readings after monitor
# Override this to calculate averages, or do other post-processing on readings after monitor
pass

def clear_readings(self):
Expand Down
2 changes: 1 addition & 1 deletion lib/pimoroni_yukon/modules/dual_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def initialise(self, slot, adc1_func, adc2_func):
# Pass the slot and adc functions up to the parent now that module specific initialisation has finished
super().initialise(slot, adc1_func, adc2_func)

def configure(self):
def reset(self):
if self.__motor_type == self.DUAL:
for motor in self.motors:
motor.disable()
Expand Down
2 changes: 1 addition & 1 deletion lib/pimoroni_yukon/modules/dual_switched.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def initialise(self, slot, adc1_func, adc2_func):
# Pass the slot and adc functions up to the parent now that module specific initialisation has finished
super().initialise(slot, adc1_func, adc2_func)

def configure(self):
def reset(self):
self.__sw_output[0].init(Pin.OUT, value=False)
self.__sw_output[1].init(Pin.OUT, value=False)

Expand Down
2 changes: 1 addition & 1 deletion lib/pimoroni_yukon/modules/led_strip.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def initialise(self, slot, adc1_func, adc2_func):
# Pass the slot and adc functions up to the parent now that module specific initialisation has finished
super().initialise(slot, adc1_func, adc2_func)

def configure(self):
def reset(self):
self.__power_en.init(Pin.OUT, value=False)
self.__power_good.init(Pin.IN, Pin.PULL_UP)

Expand Down
2 changes: 1 addition & 1 deletion lib/pimoroni_yukon/modules/quad_servo_direct.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def initialise(self, slot, adc1_func, adc2_func):
# Pass the slot and adc functions up to the parent now that module specific initialisation has finished
super().initialise(slot, adc1_func, adc2_func)

def configure(self):
def reset(self):
for servo in self.servos:
servo.disable()

Expand Down
2 changes: 1 addition & 1 deletion lib/pimoroni_yukon/modules/quad_servo_reg.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def initialise(self, slot, adc1_func, adc2_func):
# Pass the slot and adc functions up to the parent now that module specific initialisation has finished
super().initialise(slot, adc1_func, adc2_func)

def configure(self):
def reset(self):
for servo in self.servos:
servo.disable()

Expand Down

0 comments on commit d142dfb

Please sign in to comment.