]> git.earman.xyz Git - sensor-watch.git/commitdiff
Adjust function semantics by "flipping" bit order
authorAlexsander Akers <me@a2.io>
Thu, 27 Jan 2022 16:23:27 +0000 (11:23 -0500)
committerAlexsander Akers <me@a2.io>
Thu, 27 Jan 2022 17:06:06 +0000 (12:06 -0500)
movement/movement.c
watch-library/shared/watch/watch_rtc.h
watch-library/simulator/watch/watch_rtc.c

index 1c8e641ca06087fa4d419312715e0c578f022980..aa95f2f1f711e2a2e2b269a2ac5c075466b48798 100644 (file)
@@ -155,7 +155,7 @@ void movement_request_tick_frequency(uint8_t freq) {
     if (freq == 128) return; // Movement uses the 128 Hz tick internally
 
     // disable all callbacks except the 128 Hz one
-    watch_rtc_disable_matching_periodic_callbacks(0b01111111);
+    watch_rtc_disable_matching_periodic_callbacks(0xFE);
 
     movement_state.subsecond = 0;
     movement_state.tick_frequency = freq;
index b51d6c48b64e1eda481f4de1bcee8a5f28fd6575..183e6dd04e4483f03e1e9bc225390643eaef7509 100644 (file)
@@ -138,7 +138,8 @@ void watch_rtc_register_periodic_callback(ext_irq_cb_t callback, uint8_t frequen
 void watch_rtc_disable_periodic_callback(uint8_t frequency);
 
 /** @brief Disables tick callbacks for the given periods (as a bitmask).
-  * @param mask The frequencies of tick callbacks you wish to disable, in Hz. To disable the 2 and 4 Hz callbacks, pass 0b00000110;
+  * @param mask The frequencies of tick callbacks you wish to disable, in Hz.
+  * The 128 Hz callback is 0b1, the 64 Hz callback is 0b10, the 32 Hz callback is 0b100, etc.
   */
 void watch_rtc_disable_matching_periodic_callbacks(uint8_t mask);
 
index 2cae701daee1fb434bfeab27ce22049a6ae6c43e..ea8659dcbd44fd63ab0cbbe863ddbd62b813d5fa 100644 (file)
@@ -115,7 +115,7 @@ void watch_rtc_disable_periodic_callback(uint8_t frequency) {
 
 void watch_rtc_disable_matching_periodic_callbacks(uint8_t mask) {
     for (int i = 0; i < 8; i++) {
-        if (tick_callbacks[i] != -1 && (mask & (1 << i)) != 0) {
+        if (tick_callbacks[i] != -1 && (mask & (1 << (7 - i))) != 0) {
             emscripten_clear_interval(tick_callbacks[i]);
             tick_callbacks[i] = -1;
         }