| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
RTLSDR
Description
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 resDocumentation
getDeviceName :: Word32 -> IO String Source
writeEEPROM :: RTLSDR -> [Word8] -> Int -> IO (Maybe EEPROMError) Source
readEEPROM :: RTLSDR -> Int -> Int -> IO (Either EEPROMError [Word8]) Source
getFreqCorrection :: RTLSDR -> IO Int32 Source
getTunerType :: RTLSDR -> IO Tuner Source
data DirectSamplingMode Source
Constructors
| DSDisabled | |
| DSI | |
| DSQ |
setDirectSampling :: RTLSDR -> DirectSamplingMode -> IO Bool Source
resetBuffer :: RTLSDR -> IO Int Source
cancelAsync :: RTLSDR -> IO Bool Source