Skip to content

Commit

Permalink
Merge pull request #22 from martynvdijke/dev
Browse files Browse the repository at this point in the history
v0.3.4
  • Loading branch information
martynvdijke authored Aug 19, 2021
2 parents 7c7c97e + f275ee9 commit d779124
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 27 deletions.
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
# Set the version information here
set(VERSION_MAJOR 0)
set(VERSION_API 3)
set(VERSION_ABI 3)
set(VERSION_ABI 4)
set(VERSION_PATCH git)

cmake_policy(SET CMP0011 NEW)
Expand Down Expand Up @@ -111,21 +111,21 @@ ELSE()
ENDIF()

IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD 23)
ELSEIF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD 23)
ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD 23)
ELSE()
message(WARNING "C++ standard could not be set because compiler is not GNU, Clang or MSVC.")
ENDIF()

IF(CMAKE_C_COMPILER_ID STREQUAL "GNU")
SET(CMAKE_C_STANDARD 17)
SET(CMAKE_C_STANDARD 11)
ELSEIF(CMAKE_C_COMPILER_ID MATCHES "Clang")
SET(CMAKE_C_STANDARD 17)
SET(CMAKE_C_STANDARD 11)
ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
SET(CMAKE_C_STANDARD 17)
SET(CMAKE_C_STANDARD 11)
ELSE()
message(WARNING "C standard could not be set because compiler is not GNU, Clang or MSVC.")
ENDIF()
Expand Down
8 changes: 4 additions & 4 deletions lib/helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ double double_mod(double a, long b) { return fmod(fmod(a, b) + b, b); }
* @param n_bits The output number of bits
* @return std::vector<bool>
*/
std::vector<bool> int2bool(uint integer, uint8_t n_bits) {
std::vector<bool> int2bool(uint8_t integer, uint8_t n_bits) {
std::vector<bool> vec(n_bits, 0);
int j = n_bits;
for (int i = 0; i < n_bits; i++) {
Expand Down Expand Up @@ -147,7 +147,7 @@ uint32_t bool2int(std::vector<bool> b) {
*/
void build_ref_chirps(gr_complex *upchirp, gr_complex *downchirp, uint8_t sf) {
double N = (1 << sf);
for (uint n = 0; n < N; n++) {
for (uint16_t n = 0; n < N; n++) {
// the scaling factor of 0.9 is here to avoid to saturate the USRP_SINK
// gr_expj is the phase of the angle of the complex exponential and returns
// and real and imag part by gr_sincosf(phase, &t_imag, &t_real);
Expand All @@ -168,7 +168,7 @@ void build_ref_chirps(gr_complex *upchirp, gr_complex *downchirp, uint8_t sf) {
void build_upchirp(gr_complex *chirp, uint32_t id, uint8_t sf) {
double N = 1 << sf;
// procces all samples
for (uint n = 0; n < N; n++) {
for (uint16_t n = 0; n < N; n++) {
// the scaling factor of 0.9 is here to avoid to saturate the USRP_SINK
chirp[n] = gr_complex(0.9f, 0.0f) *
gr_expj(2.0 * M_PI * (n * n / (2 * N) + (id / N - 0.5) * n));
Expand All @@ -178,7 +178,7 @@ void build_upchirp(gr_complex *chirp, uint32_t id, uint8_t sf) {
void build_upchirp_os_factor(gr_complex* chirp, uint32_t id, uint8_t sf, uint8_t os_factor = 1){
double N = (1 << sf) ;
int n_fold = N* os_factor - id*os_factor;
for(uint n = 0; n < N* os_factor; n++){
for(uint16_t n = 0; n < N* os_factor; n++){
if(n<n_fold)
chirp[n] = gr_complex(1.0,0.0)*gr_expj(2.0*M_PI *(n*n/(2*N)/pow(os_factor,2)+(id/N-0.5)*n/os_factor));
else
Expand Down
16 changes: 1 addition & 15 deletions lib/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ double double_mod(double a, long b);
* @param n_bits The output number of bits
* @return std::vector<bool>
*/
std::vector<bool> int2bool(uint integer, uint8_t n_bits);
std::vector<bool> int2bool(uint8_t integer, uint8_t n_bits);

/**
* @brief Generates a random string of given length
Expand Down Expand Up @@ -88,20 +88,6 @@ uint32_t get_symbol_val(const gr_complex *samples, gr_complex *ref_chirp,
float determine_energy(const gr_complex *samples,
uint32_t m_samples_per_symbol);

/**
* @brief return the modulus a%b between 0 and (b-1)
*/
long mod(long a, long b);

/**
* @brief Convert an integer into a MSB first vector of bool
*
* @param integer : The integer to convert
* @param n_bits : The output number of bits
* @return std::vector<bool>
*/
std::vector<bool> int2bool(uint integer, uint8_t n_bits);

/**
* @brief Convert a MSB first vector of bool to a integer
*
Expand Down
2 changes: 1 addition & 1 deletion lib/interleaver_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ int interleaver_impl::general_work(int noutput_items,
// convert to input codewords to binary vector of vector
for (int i = 0; i < sf_app; i++) {
if (i >= nitems_to_process) // ninput_items[0])
cw_bin[i] = int2bool(0, cw_len);
cw_bin[i] = int2bool((uint8_t )0, cw_len);
else
cw_bin[i] = int2bool(in[i], cw_len);
cw_cnt++;
Expand Down

0 comments on commit d779124

Please sign in to comment.