<commit_before>/* Read an accelerometer repeatedly in a loop.  Most code adapted from the
 * dlwisp41 firmware. */

#include <enerc.h>
#include <msp430.h>
#include "dlwisp41.h"

#define NUM_READINGS 250u
#define NUM_AVG 16
#define DUMMY_AVG 0xBEEFu

unsigned int numreadings = 0;
unsigned int iters = 0;

// status register &= ~i
inline void __bic_status_register (unsigned i) {
    asm volatile ("BIC.W %0, R2" ::"m"(i));
}

// status register |= i
inline void __bis_status_register (unsigned i) {
    asm volatile ("BIS.W %0, R2" ::"m"(i));
}

APPROX unsigned read_accel() {
    APPROX unsigned volatile char i;
    APPROX unsigned reading;

    // slow down clock
    BCSCTL1 = XT2OFF + RSEL1; // select internal resistor (still has effect when
    // DCOR=1)
    DCOCTL = DCO1+DCO0; // set DCO step.<commit_msg>smaller number of loop iterations in main loop now that we're doing a lot more work in each iteration (by not skipping the ADC settle loop)<commit_after>/* Read an accelerometer repeatedly in a loop.  Most code adapted from the
 * dlwisp41 firmware. */

#include <enerc.h>
#include <msp430.h>
#include "dlwisp41.h"

#define NUM_READINGS 50u
#define NUM_AVG 16
#define DUMMY_AVG 0xBEEFu

unsigned int numreadings = 0;
unsigned int iters = 0;

// status register &= ~i
inline void __bic_status_register (unsigned i) {
    asm volatile ("BIC.W %0, R2" ::"m"(i));
}

// status register |= i
inline void __bis_status_register (unsigned i) {
    asm volatile ("BIS.W %0, R2" ::"m"(i));
}

APPROX unsigned read_accel() {
    APPROX unsigned volatile char i;
    APPROX unsigned reading;

    // slow down clock
    BCSCTL1 = XT2OFF + RSEL1; // select internal resistor (still has effect when
    // DCOR=1)
    DCOCTL = DCO1+DCO0; // set DCO step.
{'fraction_non_alphanumeric': 0.11225071225071225, 'fraction_numerical': 0.02792022792022792, 'mean_word_length': 3.5968586387434556, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5905699', 'n_tokens_mistral': 662, 'n_tokens_neox': 609, 'n_words': 216}