<commit_before>#include <stdio.h>
#include <stdlib.h>

#include "Csucks.h"
#include "state.h"
#include "peripherals/all.h"

////////////////////////////////////////////////////////////////////////////////

void set_output(state_data state) {
    cli(); // let's say we want this to be atomic
    motor_set_dir(state.speed < 0);
    motor_set_speed((uint16_t)abs(state.speed) >> 8);
    led_set_brightness(state.light >> 8);
    sei();
}

// Must be >1 to avoid overflow down there.
#define FORCE_K 256
#define LIGHT_K 16

// Adjusts `x` towards `intended`, with some "stickiness/inertia".
int32_t ease(int32_t x, int32_t intended, int32_t k) {
    int32_t delta = (intended - x)/k;
    return x + delta;
}

#define INITIAL_REAL_STATE { .speed = 0, .light = 0 }
<commit_msg>add a TODO for tomorrow!<commit_after>#include <stdio.h>
#include <stdlib.h>

#include "Csucks.h"
#include "state.h" // declares the `state` global
#include "peripherals/all.h"

////////////////////////////////////////////////////////////////////////////////

void set_output(state_data state) {
    cli(); // let's say we want this to be atomic
    motor_set_dir(state.speed < 0);
    motor_set_speed((uint16_t)abs(state.speed) >> 8);
    led_set_brightness(state.light >> 8);
    sei();
}

////////////////////////////////////////////////////////////////////////////////

// TODO this probably belongs to state.[ch] -- make a set_state(state_data)
// function and stuff

// Must be >1 to avoid overflow down there.
#define FORCE_K 256
#define LIGHT_K 16

// Adjusts `x` towards `intended`, with some "stickiness/inertia".
int32_t ease(int32_t x, int32_t intended, int32_t k) {
    int32_t delta = (intended - x)/k;
    return x + delta;
}

#define INITIAL_REAL_STATE { .speed = 0, .light = 0 }

{'fraction_non_alphanumeric': 0.25438100621820237, 'fraction_numerical': 0.026003391746749576, 'mean_word_length': 2.1327433628318584, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, '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': '2292498', 'n_tokens_mistral': 625, 'n_tokens_neox': 579, 'n_words': 160}