<commit_before>#include "libbbn-ni-r.h"

//global to hold on to session handle
NiFpga_Session session;
bool isOpen = false;

//Initialize FPGA on loading the library -- constructor hook in header
void init() {
  NiFpga_Status status = NiFpga_Initialize();
}

//Cleanup NI library -- destructor hook in header
void cleanup(){
  if (isOpen) {NiFpga_Close(session, 0);};
  NiFpga_Finalize();
}

BBN_NI_R_STATUS open_load_run(){
  NiFpga_Status status = NiFpga_Open("../" NiFpga_SimpleDigitizer_VI_Bitfile,
                                      NiFpga_SimpleDigitizer_VI_Signature,
                                      "RIO0", 0, &session);
  if (status == NiFpga_Status_Success){
    isOpen = true;
  }
  return status;
}

BBN_NI_R_STATUS set_numSamples(uint32_t numSamples){
  NiFpga_Status status = NiFpga_WriteU32(session, NiFpga_SimpleDigitizer_VI_ControlU32_NumberofSamples, numSamples);
  return status;
};
BBN_NI_R_STATUS get_numSamples(uint32_t* numSamples){
  NiFpga_Status status = NiFpga_ReadU32(session, NiFpga_SimpleDigitizer_VI_ControlU32_NumberofSamples, numSamples);
  return status;
};

BBN_NI_R_STATUS set_sampleInterval(double sampleInterval){
  uint32_t sampleInterval_us = static_cast<uint32_t>(sampleInterval/1e6);
  NiFpga_Status status = NiFpga_WriteU32(session, NiFpga_SimpleDigitizer_VI_ControlU32_SampleIntervaluSec, sampleInterval * 1000000);
  return status;
};
BBN_NI_R_STATUS get_sampleInterval(double* sampleInterval){
  uint32_t sampleInterval_us;
  NiFpga_Status status = NiFpga_ReadU32(session, NiFpga_SimpleDigitizer_VI_ControlU32_SampleIntervaluSec, &sampleInterval_us);
  *sampleInterval = static_cast<double>(sampleInterval_us) / 1000000;
  return status;
};

BBN_NI_R_STATUS enable_acquisition(){
  return NiFpga_WriteBool(session, NiFpga_SimpleDigitizer_VI_ControlBool_Acquire, 1);
}

BBN_NI_R_STATUS disable_acquisition(){
  return NiFpga_WriteBool(session, NiFpga_SimpleDigitizer_VI_ControlBool_Acquire, 0);
}

BBN_NI_R_STATUS trigger(){
  //Toggle the trigger rising-edge
  NiFpga_Status status = NiFpga_WriteBool(session, NiFpga_SimpleDigitizer_VI_ControlBool_Trigger, 0);
  NiFpga_MergeStatus(&status, NiFpga_WriteBool(session, NiFpga_SimpleDigitizer_VI_ControlBool_Trigger, 1));
  return status;
}
<commit_msg>Use NiFpga_True/NiFpga_False<commit_after>#include "libbbn-ni-r.h"

//global to hold on to session handle
NiFpga_Session session;
bool isOpen = false;

//Initialize FPGA on loading the library -- constructor hook in header
void init() {
  NiFpga_Status status = NiFpga_Initialize();
}

//Cleanup NI library -- destructor hook in header
void cleanup(){
  if (isOpen) {NiFpga_Close(session, 0);};
  NiFpga_Finalize();
}

BBN_NI_R_STATUS open_load_run(){
  NiFpga_Status status = NiFpga_Open("../" NiFpga_SimpleDigitizer_VI_Bitfile,
                                      NiFpga_SimpleDigitizer_VI_Signature,
                                      "RIO0", 0, &session);
  if (status == NiFpga_Status_Success){
    isOpen = true;
  }
  return status;
}

BBN_NI_R_STATUS set_numSamples(uint32_t numSamples){
  NiFpga_Status status = NiFpga_WriteU32(session, NiFpga_SimpleDigitizer_VI_ControlU32_NumberofSamples, numSamples);
  return status;
};
BBN_NI_R_STATUS get_numSamples(uint32_t* numSamples){
  NiFpga_Status status = NiFpga_ReadU32(session, NiFpga_SimpleDigitizer_VI_ControlU32_NumberofSamples, numSamples);
  return status;
};

BBN_NI_R_STATUS set_sampleInterval(double sampleInterval){
  uint32_t sampleInterval_us = static_cast<uint32_t>(sampleInterval/1e6);
  NiFpga_Status status = NiFpga_WriteU32(session, NiFpga_SimpleDigitizer_VI_ControlU32_SampleIntervaluSec, sampleInterval * 1000000);
  return status;
};
BBN_NI_R_STATUS get_sampleInterval(double* sampleInterval){
  uint32_t sampleInterval_us;
  NiFpga_Status status = NiFpga_ReadU32(session, NiFpga_SimpleDigitizer_VI_ControlU32_SampleIntervaluSec, &sampleInterval_us);
  *sampleInterval = static_cast<double>(sampleInterval_us) / 1000000;
  return status;
};

BBN_NI_R_STATUS enable_acquisition(){
  return NiFpga_WriteBool(session, NiFpga_SimpleDigitizer_VI_ControlBool_Acquire, NiFpga_True);
}

BBN_NI_R_STATUS disable_acquisition(){
  return NiFpga_WriteBool(session, NiFpga_SimpleDigitizer_VI_ControlBool_Acquire, NiFpga_False);
}

BBN_NI_R_STATUS trigger(){
  //Toggle the trigger rising-edge
  NiFpga_Status status = NiFpga_WriteBool(session, NiFpga_SimpleDigitizer_VI_ControlBool_Trigger, NiFpga_False);
  NiFpga_MergeStatus(&status, NiFpga_WriteBool(session, NiFpga_SimpleDigitizer_VI_ControlBool_Trigger, NiFpga_True));
  return status;
}

{'fraction_non_alphanumeric': 0.08079702211517407, 'fraction_numerical': 0.020582439238011823, 'mean_word_length': 6.016897081413211, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5858246', 'n_tokens_mistral': 1743, 'n_tokens_neox': 1651, 'n_words': 277}