<commit_before>#include <uart2.h>
#include <p24fxxxx.h>
#include <pps.h>

#include "blapi/adb.h"
#include "blapi/bootloader.h"

#include "Compiler.h"

typedef enum {
  STATE_INIT,
  STATE_WAIT_CONNECTION,
  STATE_WAIT_CHANNEL_OPEN,
  STATE_CONNECTED
} STATE;

STATE state = STATE_INIT;

void ChannelCallback(ADB_CHANNEL_HANDLE h, const void* data, UINT32 data_len) {
  if (data) {
  } else {
    if (data_len == 0) {
    } else {
    }
    // connection closed, re-establish
    state = STATE_INIT;
  }
}

void ResetAllPeripherals() {
  // TODO: for real
  LATFbits.LATF3 = 1;  // LED off
  TRISFbits.TRISF3 = 0;  // LED pin is output
  ODCFbits.ODF3 = 1;  // LED pin is open drain
}

void AppProtocolInit() {
}

void AppProtocolTasks() {
  static unsigned count = 0;<commit_msg>reset IO ports<commit_after>#include <uart2.h>
#include <p24fxxxx.h>
#include <pps.h>

#include "blapi/adb.h"
#include "blapi/bootloader.h"

#include "Compiler.h"

typedef enum {
  STATE_INIT,
  STATE_WAIT_CONNECTION,
  STATE_WAIT_CHANNEL_OPEN,
  STATE_CONNECTED
} STATE;

STATE state = STATE_INIT;

void ChannelCallback(ADB_CHANNEL_HANDLE h, const void* data, UINT32 data_len) {
  if (data) {
  } else {
    if (data_len == 0) {
    } else {
    }
    // connection closed, re-establish
    state = STATE_INIT;
  }
}

void ResetAllPeripherals() {
  // reset i/o ports - digital input, floating, latch at 0.
  TRISB = 0xFFFF; LATB = 0x0000; ANSB = 0x0000;
  TRISC = 0xFFFF; LATC = 0x0000;
  TRISD = 0xFFFF; LATD = 0x0000;
  TRISE = 0xFFFF; LATE = 0x0000;
  TRISF = 0xFFFF; LATF = 0x0000;
  CNPU1 = 0x0000; CNPD1 = 0x0000;
  CNPU2 = 0x0000; CNPD2 = 0x0000;
  CNPU3 = 0x0000; CNPD3 = 0x0000;
  CNPU4 = 0x0000; CNPD4 = 0x0000;
  CNPU5 = 0x0000; CNPD5 = 0x0000;
  CNPU6 = 0x0000; CNPD6 = 0x0000;

  // configure on-board LED
  LATFbits.LATF3 = 1;  // LED off
  TRISFbits.TRISF3 = 0;  // LED pin is output
  ODCFbits.ODF3 = 1;  // LED pin is open drain

  // TODO: reset other peripherals
}

void AppProtocolInit() {
}

void AppProtocolTasks() {
  static unsigned count = 0;
{'fraction_non_alphanumeric': 0.1201171875, 'fraction_numerical': 0.0654296875, 'mean_word_length': 3.286610878661088, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1435662', 'n_tokens_mistral': 965, 'n_tokens_neox': 827, 'n_words': 204}