mirror of
https://github.com/firewalkwithm3/Sensor-Watch.git
synced 2024-11-22 19:20:30 +08:00
Removed some dead code
This commit is contained in:
parent
df2dac5a07
commit
4a4fce428e
|
@ -222,28 +222,16 @@ static void _movement_handle_scheduled_tasks(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t swap_endian(uint8_t num) {
|
|
||||||
uint8_t result = 0;
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < 8; i++) {
|
|
||||||
result <<= 1;
|
|
||||||
result |= (num & 1);
|
|
||||||
num >>= 1;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void movement_request_tick_frequency(uint8_t freq) {
|
void movement_request_tick_frequency(uint8_t freq) {
|
||||||
// Movement uses the 128 Hz tick internally
|
// Movement uses the 128 Hz tick internally
|
||||||
if (freq == 128 || freq == DEBOUNCE_FREQ ) return;
|
if (freq == 128) return;
|
||||||
|
|
||||||
// Movement requires at least a 1 Hz tick.
|
// Movement requires at least a 1 Hz tick.
|
||||||
// If we are asked for an invalid frequency, default back to 1 Hz.
|
// If we are asked for an invalid frequency, default back to 1 Hz.
|
||||||
if (freq == 0 || __builtin_popcount(freq) != 1) freq = 1;
|
if (freq == 0 || __builtin_popcount(freq) != 1) freq = 1;
|
||||||
|
|
||||||
// disable all callbacks except the 128 Hz one
|
// disable all callbacks except the 128 Hz one
|
||||||
int disable_mask = 0xFE ^ swap_endian(DEBOUNCE_FREQ);
|
watch_rtc_disable_matching_periodic_callbacks(0xFE);
|
||||||
watch_rtc_disable_matching_periodic_callbacks(disable_mask);
|
|
||||||
|
|
||||||
movement_state.subsecond = 0;
|
movement_state.subsecond = 0;
|
||||||
movement_state.tick_frequency = freq;
|
movement_state.tick_frequency = freq;
|
||||||
|
|
Loading…
Reference in a new issue