<commit_before>/**
 * ty, command-line program to manage Teensy devices
 * http://github.com/Koromix/ty
 * Copyright (C) 2014 <NAME>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "ty/common.h"
#include "compat.h"
#include "ty/board.h"
#include "board_priv.h"
#include "ty/firmware.h"
#include "ty/system.h"

struct ty_board_model {
    struct ty_board_model_;

    // Upload settings
    uint8_t usage;
    uint8_t halfkay_version;
    size_t block_size;

    // Build settings
    const char *toolchain;
    const char *core;
    uint32_t frequency;
    const char *flags;
    const char *ldflags;
};

struct ty_board_mode {
    struct ty_board_mode_;

    // Build settings
    const char *flags;
};

static const struct _ty_board_mode_vtable teensy_vtable;

const ty_board_mode teensy_bootloader_mode = {
    .name = "bootloader",
    .desc = "HalfKay Bootloader",

    .vtable = &teensy_vtable,

    .type = TY_DEVICE_HID,
    .vid = 0x16C0,
    .pid = 0x478,
    .iface = 0,
    .capabilities = TY_BOARD_CAPABILITY_IDENTIFY | TY_BOARD_CAPABILITY_UPLOAD | TY_BOARD_CAPABILITY_RESET
};

const ty_board_mode teensy_flightsim_mode = {
    .name = "flightsim",
    .desc = "FlightSim",

    .vtable = &teensy_vtable,

    .type = TY_DEVICE_HID,
    .vid = 0x16C0,
    .pid = 0x488,
    .iface = 1,
    .capabilities = TY_BOARD_CAPABILITY_SERIAL | TY_BOARD_CAPABILITY_REBOOT,

    // FIXME: build capability?
    .flags = "-DUSB_FLIGHTSIM -DLAYOUT_US_ENGLISH"
};

const ty_board_mode teensy_hid_mode = {
    .name = "hid",
    .desc = "HID",

    .vtable = &teensy_vtable,

    .type = TY_DEVICE_HID,
    .vid = 0x16C0,
    .pid = 0x482,
    .iface = 2,
    .capabilities = TY_BOARD_CAPABILITY_SERIAL | TY_BOARD_CAPABILITY_REBOOT,

    .flags = "-DUSB_HID -DLAYOUT_US_ENGLISH"
};

const ty_board_mode teensy_midi_mode = {
    .name = "midi",
    .desc = "MIDI",

    .vtable = &teensy_vtable,

    .type = TY_DEVICE_HID,
    .vid = 0x16C0,
    .pid = 0x485,
    .iface = 0,
    .capabilities = TY_BOARD_CAPABILITY_SERIAL | TY_BOARD_CAPABILITY_REBOOT,

    .flags = "-DUSB_MIDI -DLAYOUT_US_ENGLISH"
};

const ty_board_mode teensy_rawhid_mode = {
    .name = "rawhid",
    .desc = "Raw HID",
<commit_msg>Fix interface number of MIDI mode<commit_after>/**
 * ty, command-line program to manage Teensy devices
 * http://github.com/Koromix/ty
 * Copyright (C) 2014 <NAME>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "ty/common.h"
#include "compat.h"
#include "ty/board.h"
#include "board_priv.h"
#include "ty/firmware.h"
#include "ty/system.h"

struct ty_board_model {
    struct ty_board_model_;

    // Upload settings
    uint8_t usage;
    uint8_t halfkay_version;
    size_t block_size;

    // Build settings
    const char *toolchain;
    const char *core;
    uint32_t frequency;
    const char *flags;
    const char *ldflags;
};

struct ty_board_mode {
    struct ty_board_mode_;

    // Build settings
    const char *flags;
};

static const struct _ty_board_mode_vtable teensy_vtable;

const ty_board_mode teensy_bootloader_mode = {
    .name = "bootloader",
    .desc = "HalfKay Bootloader",

    .vtable = &teensy_vtable,

    .type = TY_DEVICE_HID,
    .vid = 0x16C0,
    .pid = 0x478,
    .iface = 0,
    .capabilities = TY_BOARD_CAPABILITY_IDENTIFY | TY_BOARD_CAPABILITY_UPLOAD | TY_BOARD_CAPABILITY_RESET
};

const ty_board_mode teensy_flightsim_mode = {
    .name = "flightsim",
    .desc = "FlightSim",

    .vtable = &teensy_vtable,

    .type = TY_DEVICE_HID,
    .vid = 0x16C0,
    .pid = 0x488,
    .iface = 1,
    .capabilities = TY_BOARD_CAPABILITY_SERIAL | TY_BOARD_CAPABILITY_REBOOT,

    // FIXME: build capability?
    .flags = "-DUSB_FLIGHTSIM -DLAYOUT_US_ENGLISH"
};

const ty_board_mode teensy_hid_mode = {
    .name = "hid",
    .desc = "HID",

    .vtable = &teensy_vtable,

    .type = TY_DEVICE_HID,
    .vid = 0x16C0,
    .pid = 0x482,
    .iface = 2,
    .capabilities = TY_BOARD_CAPABILITY_SERIAL | TY_BOARD_CAPABILITY_REBOOT,

    .flags = "-DUSB_HID -DLAYOUT_US_ENGLISH"
};

const ty_board_mode teensy_midi_mode = {
    .name = "midi",
    .desc = "MIDI",

    .vtable = &teensy_vtable,

    .type = TY_DEVICE_HID,
    .vid = 0x16C0,
    .pid = 0x485,
    .iface = 1,
    .capabilities = TY_BOARD_CAPABILITY_SERIAL | TY_BOARD_CAPABILITY_REBOOT,

    .flags = "-DUSB_MIDI -DLAYOUT_US_ENGLISH"
};

const ty_board_mode teensy_rawhid_mode = {
    .name = "rawhid",
    .desc = "Raw HID",

{'fraction_non_alphanumeric': 0.10113154172560113, 'fraction_numerical': 0.015912305516265914, 'mean_word_length': 3.1412884333821376, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '873533', 'n_tokens_mistral': 2158, 'n_tokens_neox': 2070, 'n_words': 541}