0 | module Bindings.RtlSdr.Frequency
2 | import Bindings.RtlSdr.Device
3 | import Bindings.RtlSdr.Error
4 | import Bindings.RtlSdr.Raw.Frequency
5 | import Bindings.RtlSdr.Raw.Support
23 | setXTALFreq : Ptr RtlSdrHandle -> Int -> Int -> IO (Either RTLSDR_ERROR ())
24 | setXTALFreq h f tf = do
25 | r <- fromPrim $
set_xtal_freq h f tf
26 | io_pure $
if r == 0 then Right () else Left RtlSdrError
38 | getXTALFreq : Ptr RtlSdrHandle -> IO (Either RTLSDR_ERROR (Int, Int))
40 | rtl_freq <- prim__castPtr <$> malloc 4
41 | tuner_freq <- prim__castPtr <$> malloc 4
42 | r <- fromPrim $
get_xtal_freq h rtl_freq tuner_freq
43 | let v = (peekInt rtl_freq, peekInt tuner_freq)
44 | free $
prim__forgetPtr rtl_freq
45 | free $
prim__forgetPtr tuner_freq
46 | io_pure $
if r == 0 then Right v else Left RtlSdrError
54 | setCenterFreq : Ptr RtlSdrHandle -> Int -> IO (Either RTLSDR_ERROR ())
55 | setCenterFreq h f = do
56 | r <- fromPrim $
set_center_freq h f
57 | io_pure $
if r == 0 then Right () else Left RtlSdrInvalidFreq
63 | getCenterFreq : Ptr RtlSdrHandle -> IO (Either RTLSDR_ERROR Int)
64 | getCenterFreq h = do
65 | r <- fromPrim $
get_center_freq h
66 | io_pure $
if r == 0 then Left RtlSdrError else Right r
73 | setFreqCorrection : Ptr RtlSdrHandle -> Int -> IO (Either RTLSDR_ERROR ())
74 | setFreqCorrection h ppm = do
75 | r <- fromPrim $
set_freq_correction h ppm
76 | io_pure $
if r == 0 then Right () else Left RtlSdrError
82 | getFreqCorrection : Ptr RtlSdrHandle -> IO Int
83 | getFreqCorrection h = fromPrim $
get_freq_correction h