Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
This library is a straightforward wrapper around the C library functions. See the C library documentation: https://github.com/steve-m/librtlsdr/blob/master/include/rtl-sdr.h
Example usage:
import Data.List import Foreign.Marshal.Array import RTLSDR bufSize = 16384 sampleRate = 1280000 frequency = 90200000 main = do dev <- open 0 case dev of Nothing -> putStrLn "Error opening device" Just dev -> do setSampleRate dev sampleRate setCenterFreq dev frequency setTunerGainMode dev False resetBuffer dev allocaArray bufSize $ \ptr -> do res <- readSync dev ptr bufSize case res of False -> putStrLn "Error reading from device" True -> do res <- peekArray bufSize ptr putStrLn $ intercalate " " $ map show res
Documentation
writeEEPROM :: RTLSDR -> [Word8] -> Int -> IO (Maybe EEPROMError) Source #
readEEPROM :: RTLSDR -> Int -> Int -> IO (Either EEPROMError [Word8]) Source #
data DirectSamplingMode Source #
setDirectSampling :: RTLSDR -> DirectSamplingMode -> IO Bool Source #
getDirectSampling :: RTLSDR -> IO (Maybe DirectSamplingMode) Source #