     return ((float)note - 36.0) / 12.0;
   }
 
-  uint16_t bpm_to_ms(uint8_t bpm)
-  {
-    return 600000 / bpm;
+  unsigned long bpm_to_us(uint8_t bpm)
+  {
+    return 6000000 / (unsigned long)bpm;
   }
 
   void display_slew_rate(int16_t x, int16_t y, uint8_t rate, DUINO_SSD1306::SSD1306Color color)

              {
                params.vals.gate_time = 16;
              }
              seq_values.gate_time = (float)params.vals.gate_time / 16.0;
              display->fill_rect(79, 3, 16, 5, DUINO_SSD1306::White);
              display_gate_time(79, 3, params.vals.gate_time, DUINO_SSD1306::Black);
              break;

  bool stage_slew[8];
  uint8_t stage_count;
  bool diradd_mode;
  uint8_t slew_rate;
  uint8_t gate_time;
  unsigned long clock_period;
  bool clock_ext;
};

