<commit_before>#include <time.h>
#include <letmecreate/core/gpio.h>
#include <letmecreate/rpisensehat/board.h>
#include <letmecreate/rpisensehat/hts221.h>


static void sleep_50ms(void)
{
    struct timespec rem, req = {
        .tv_sec = 0,
        .tv_nsec = 50000000
    };

    while (nanosleep(&req, &rem))
        req = rem;
}

static int reset_atmel_chip(void)
{
    if (gpio_init(GPIO_21) < 0
    ||  gpio_set_direction(GPIO_21, GPIO_OUTPUT) < 0)
        return -1;

    if (gpio_set_value(GPIO_21, 0) < 0)
        return -1;

    sleep_50ms();

    if (gpio_set_value(GPIO_21, 1) < 0)
        return -1;
<commit_msg>rpisensehat: add delay after reseting atmel chip<commit_after>#include <time.h>
#include <letmecreate/core/gpio.h>
#include <letmecreate/rpisensehat/board.h>
#include <letmecreate/rpisensehat/hts221.h>


static void sleep_50ms(void)
{
    struct timespec rem, req = {
        .tv_sec = 0,
        .tv_nsec = 50000000
    };

    while (nanosleep(&req, &rem))
        req = rem;
}

static int reset_atmel_chip(void)
{
    if (gpio_init(GPIO_21) < 0
    ||  gpio_set_direction(GPIO_21, GPIO_OUTPUT) < 0)
        return -1;

    if (gpio_set_value(GPIO_21, 0) < 0)
        return -1;

    sleep_50ms();

    if (gpio_set_value(GPIO_21, 1) < 0)
        return -1;

    sleep_50ms();
    sleep_50ms();

{'fraction_non_alphanumeric': 0.1308623298033283, 'fraction_numerical': 0.0529500756429652, 'mean_word_length': 2.8017241379310347, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '3914538', 'n_tokens_mistral': 582, 'n_tokens_neox': 516, 'n_words': 104}