GNU Radio's LORA_SDR Package
modulate_impl.h
Go to the documentation of this file.
1 #ifndef INCLUDED_LORA_MODULATE_IMPL_H
2 #define INCLUDED_LORA_MODULATE_IMPL_H
3 
5 #include <gnuradio/io_signature.h>
6 #include <iostream>
7 #include <fstream>
8 
10 
11 // #define GR_LORA_PRINT_INFO
12 
13 namespace gr {
14  namespace lora_sdr {
15 
16  class modulate_impl : public modulate
17  {
18  private:
19  uint8_t m_sf; ///< Transmission spreading factor
20  uint32_t m_samp_rate; ///< Transmission sampling rate
21  uint32_t m_bw; ///< Transmission bandwidth (Works only for samp_rate=bw)
22  uint32_t m_number_of_bins; ///< number of bin per loar symbol
23  int m_samples_per_symbol; ///< samples per symbols(Works only for 2^sf)
24  std::vector<uint16_t> m_sync_words; ///< sync words (network id)
25 
26  int m_ninput_items_required; ///< number of samples required to call this block (forecast)
27 
28  int m_os_factor; ///< ovesampling factor based on sampling rate and bandwidth
29 
30  uint32_t m_inter_frame_padding; ///< length in samples of zero append to each frame
31 
32  int m_frame_len;///< leng of the frame in number of items
33 
34  std::vector<gr_complex> m_upchirp; ///< reference upchirp
35  std::vector<gr_complex> m_downchirp; ///< reference downchirp
36 
37  uint16_t m_preamb_len; ///< number of upchirps in the preamble
38  int32_t samp_cnt; ///< counter of the number of lora samples sent
39  int32_t preamb_samp_cnt; ///< counter of the number of preamble symbols output
40  uint32_t padd_cnt; ///< counter of the number of null symbols output after each frame
41  uint64_t frame_cnt; ///< counter of the number of frame sent
42  bool frame_end; ///< indicate that we send a full frame
43 
44  tag_t m_config_tag;
45  tag_t m_framelen_tag;
46 
47  public:
48  modulate_impl(uint8_t sf, uint32_t samp_rate, uint32_t bw, std::vector<uint16_t> sync_words, uint32_t frame_zero_padd, uint16_t preamb_len);
50 
51  void set_sf(uint8_t sf);
52 
53  // Where all the action really happens
54  void forecast (int noutput_items, gr_vector_int &ninput_items_required);
55  void update_var(int new_sf, int new_bw);
56  int general_work(int noutput_items,
57  gr_vector_int &ninput_items,
58  gr_vector_const_void_star &input_items,
59  gr_vector_void_star &output_items);
60  };
61 
62  } // namespace lora
63 } // namespace gr
64 
65 #endif /* INCLUDED_LORA_MODULATE_IMPL_H */
Definition: modulate_impl.h:17
modulate_impl(uint8_t sf, uint32_t samp_rate, uint32_t bw, std::vector< uint16_t > sync_words, uint32_t frame_zero_padd, uint16_t preamb_len)
void update_var(int new_sf, int new_bw)
void forecast(int noutput_items, gr_vector_int &ninput_items_required)
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
<+description of block+>
Definition: modulate.h:37
Definition: add_crc.h:28