<commit_before>#include "lps25hb.h"
#include "tock.h"

struct lps25hb_data {
  bool fired;
  int value;
};

static struct lps25hb_data result = { .fired = false };

// Internal callback for faking synchronous reads
static void lps25hb_cb(int value,
                       __attribute__ ((unused)) int unused1,
                       __attribute__ ((unused)) int unused2,
                       void* ud) {
  struct lps25hb_data* data = (struct lps25hb_data*) ud;
  data->value = value;
  data->fired = true;
}

int lps25hb_set_callback (subscribe_cb callback, void* callback_args) {
  return subscribe(DRIVER_NUM_LPS25HB, 0, callback, callback_args);
}

int lps25hb_get_pressure (void) {
  return command(DRIVER_NUM_LPS25HB, 1, 0, 0);
}
<commit_msg>2.0 lps25hb<commit_after>#include "lps25hb.h"
#include "tock.h"

struct lps25hb_data {
  bool fired;
  int value;
};

static struct lps25hb_data result = { .fired = false };

// Internal callback for faking synchronous reads
static void lps25hb_cb(int value,
                       __attribute__ ((unused)) int unused1,
                       __attribute__ ((unused)) int unused2,
                       void* ud) {
  struct lps25hb_data* data = (struct lps25hb_data*) ud;
  data->value = value;
  data->fired = true;
}

int lps25hb_set_callback (subscribe_cb callback, void* callback_args) {
  subscribe_return_t sval = subscribe2(DRIVER_NUM_LPS25HB, 0, callback, callback_args);
  if (sval.success) {
    return 0;
  } else {
    return tock_error_to_rcode(sval.error);
  }
}

int lps25hb_get_pressure (void) {
  syscall_return_t com = command2(DRIVER_NUM_LPS25HB, 1, 0, 0);
  if (com.type == TOCK_SYSCALL_SUCCESS) {
    return TOCK_SUCCESS;
  } else if (com.type > TOCK_SYSCALL_SUCCESS) {
    // Returned an incorrect success code
    return TOCK_FAIL;
  } else {
    return tock_error_to_rcode(com.data[0]);
  }
}

{'fraction_non_alphanumeric': 0.10283877878950187, 'fraction_numerical': 0.032137118371719335, 'mean_word_length': 3.216704288939052, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6913788', 'n_tokens_mistral': 723, 'n_tokens_neox': 656, 'n_words': 159}