Closed microbit-matt-hillsdon closed 1 year ago
Instead of this I think we should make two new defines to set the threshold (the existing ones are event numbers), because these two sets are conceptually independent.
Eg:
#define MICROBIT_HAL_MICROPHONE_SET_THRESHOLD_LOW (0)
#define MICROBIT_HAL_MICROPHONE_SET_THRESHOLD_HIGH (1)
And probably rename the existing ones to:
#define MICROBIT_HAL_MICROPHONE_EVT_THRESHOLD_LOW (1)
#define MICROBIT_HAL_MICROPHONE_EVT_THRESHOLD_HIGH (2)
As discussed elsewhere, I implemented my above suggestion in a1be53a8ed0501609d869c3147bf47effa38a0a5 and 804c5fee4fd12e786e3815ef37aaefd5649153fa
HAL implementers need to work with both microbit_hal_level_detector_callback and microbit_hal_microphone_set_threshold. It's confusing for the former to use 1 and 2 and the latter 0 and 1 to represent low and high.
Consistently use 1 and 2 via the HAL defines.