def clock(frequency)
      options = {4000     => 0,      #4 kHz
                 8000     => 32768,  #8 kHz
                 15625    => 16384,  #15.625 kHz
                 31250    => 8192,   #31.25 kHz
                 62500    => 4096,   #62.5 kHz
                 125000   => 2048,   #125 kHz
                 250000   => 1024,   #250 kHz
                 500000   => 512,    #500 kHz
                 1000000  => 256,    #1 MHz
                 2000000  => 128,    #2 MHz
                 4000000  => 64,     #4 MHz
                 8000000  => 32,     #8 MHz
                 20000000 => 16      #20 MHz
               }
      divider = options[frequency]
      PiPiper.driver.spi_clock(divider)
    end
def clock(frequency)
      options = {4000     => 0,      #4 kHz
                 8000     => 32768,  #8 kHz
                 15625    => 16384,  #15.625 kHz
                 31250    => 8192,   #31.25 kHz
                 62500    => 4096,   #62.5 kHz
                 125000   => 2048,   #125 kHz
                 250000   => 1024,   #250 kHz
                 500000   => 512,    #500 kHz
                 1000000  => 256,    #1 MHz
                 2000000  => 128,    #2 MHz
                 4000000  => 64,     #4 MHz
                 8000000  => 32,     #8 MHz
                 20000000 => 16      #20 MHz
               }
      divider = options[frequency]
      PiPiper.driver.spi_clock(divider)
    end
Sets the SPI clock frequency