<commit_before>/**
 * @file CosaRF433.ino
 * @version 1.0
 *
 * @section License
 * Copyright (C) 2015, <NAME>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * @section Description
 * Study RF433 AGC behavior.
 *
 * This file is part of the Arduino Che Cosa project.
 */

#include "Cosa/RTC.hh"
#include "Cosa/Trace.hh"
#include "Cosa/Watchdog.hh"
#include "Cosa/OutputPin.hh"
#include "Cosa/IOStream/Driver/UART.hh"

OutputPin rf(Board::D6);

void setup()
{
  uart.begin(9600);
  trace.begin(&uart, PSTR("CosaRF433: started"));
  Watchdog::begin();
  RTC::begin();
}

void loop()
{
  const uint16_t D[] = { 1000, 500, 200, 100, 50 };
  rf.set();
  delay(10);
  rf.clear();
  for (uint8_t j = 0; j < membersof(D); j++) {
    uint16_t T = D[j];
    for (uint8_t i = 0; i < 8; i++) {
      DELAY(T);
      rf.set();
      DELAY(T);
      rf.clear();
    }
  }
  sleep(2);
}
<commit_msg>Adjust for ATTiny and add basic Manchester encoding. Study AGC recovery.<commit_after>/**
 * @file CosaRF433.ino
 * @version 1.0
 *
 * @section License
 * Copyright (C) 2015, <NAME>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * @section Description
 * Study RF433 AGC behavior.
 *
 * This file is part of the Arduino Che Cosa project.
 */

#include "Cosa/RTC.hh"
#include "Cosa/Watchdog.hh"
#include "Cosa/OutputPin.hh"

#if defined(BOARD_ATTINY)
#define PIN Board::D0
#else
#define PIN Board::D6
#endif

OutputPin rf(PIN);

void setup()
{
  RTC::begin();
}

void loop()
{
  const uint16_t D[] = { 1000, 500, 200, 100, 50 };
  for (uint8_t j = 0; j < membersof(D); j++) {
    uint16_t T = D[j];
    rf.set();
    DELAY(2000);
    rf.clear();
    DELAY(2*T);
    uint16_t data = 0x5555;
    uint8_t bit;
    for (uint8_t i = 0; i < 16; i++) {
      bit = data & 1;
      rf.write(bit);
      DELAY(T);
      data >>= 1;
      rf.write(!bit);
      DELAY(T);
    }
    rf.clear();
    sleep(1);
  }
}

{'fraction_non_alphanumeric': 0.12746478873239436, 'fraction_numerical': 0.03732394366197183, 'mean_word_length': 3.177941176470588, 'pattern_counts': {'":': 0, '<': 9, '<?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': '1200844', 'n_tokens_mistral': 1060, 'n_tokens_neox': 957, 'n_words': 349}