Skip to content

Commit

Permalink
Add ty_board_model_vtable (although empty right now)
Browse files Browse the repository at this point in the history
  • Loading branch information
Koromix committed Dec 21, 2014
1 parent 44c5a0d commit 14dc9a6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
5 changes: 5 additions & 0 deletions src/board_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,16 @@ struct ty_board_mode_ {
uint16_t capabilities;
};

struct _ty_board_model_vtable {
};

struct ty_board_model_ {
const char *name;
const char *mcu;
const char *desc;

const struct _ty_board_model_vtable *vtable;

size_t code_size;
};

Expand Down
33 changes: 24 additions & 9 deletions src/board_teensy.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ struct ty_board_mode {
const char *flags;
};

static const struct _ty_board_mode_vtable teensy_vtable;
static const struct _ty_board_mode_vtable teensy_mode_vtable;

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

.vtable = &teensy_vtable,
.vtable = &teensy_mode_vtable,

.type = TY_DEVICE_HID,
.vid = 0x16C0,
Expand All @@ -66,7 +66,7 @@ const ty_board_mode teensy_flightsim_mode = {
.name = "flightsim",
.desc = "FlightSim",

.vtable = &teensy_vtable,
.vtable = &teensy_mode_vtable,

.type = TY_DEVICE_HID,
.vid = 0x16C0,
Expand All @@ -82,7 +82,7 @@ const ty_board_mode teensy_hid_mode = {
.name = "hid",
.desc = "HID",

.vtable = &teensy_vtable,
.vtable = &teensy_mode_vtable,

.type = TY_DEVICE_HID,
.vid = 0x16C0,
Expand All @@ -97,7 +97,7 @@ const ty_board_mode teensy_midi_mode = {
.name = "midi",
.desc = "MIDI",

.vtable = &teensy_vtable,
.vtable = &teensy_mode_vtable,

.type = TY_DEVICE_HID,
.vid = 0x16C0,
Expand All @@ -112,7 +112,7 @@ const ty_board_mode teensy_rawhid_mode = {
.name = "rawhid",
.desc = "Raw HID",

.vtable = &teensy_vtable,
.vtable = &teensy_mode_vtable,

.type = TY_DEVICE_HID,
.vid = 0x16C0,
Expand All @@ -127,7 +127,7 @@ const ty_board_mode teensy_serial_mode = {
.name = "serial",
.desc = "Serial",

.vtable = &teensy_vtable,
.vtable = &teensy_mode_vtable,

.type = TY_DEVICE_SERIAL,
.vid = 0x16C0,
Expand All @@ -142,7 +142,7 @@ const ty_board_mode teensy_serial_hid_mode = {
.name = "serial_hid",
.desc = "Serial HID",

.vtable = &teensy_vtable,
.vtable = &teensy_mode_vtable,

.type = TY_DEVICE_SERIAL,
.vid = 0x16C0,
Expand All @@ -153,11 +153,15 @@ const ty_board_mode teensy_serial_hid_mode = {
.flags = "-DUSB_SERIAL_HID -DLAYOUT_US_ENGLISH"
};

static const struct _ty_board_model_vtable teensy_model_vtable;

const ty_board_model teensy_pp10_model = {
.name = "teensy++10",
.mcu = "at90usb646",
.desc = "Teensy++ 1.0",

.vtable = &teensy_model_vtable,

.usage = 0x1A,
.halfkay_version = 0,
.code_size = 64512,
Expand All @@ -175,6 +179,8 @@ const ty_board_model teensy_20_model = {
.mcu = "atmega32u4",
.desc = "Teensy 2.0",

.vtable = &teensy_model_vtable,

.usage = 0x1B,
.halfkay_version = 0,
.code_size = 32256,
Expand All @@ -192,6 +198,8 @@ const ty_board_model teensy_pp20_model = {
.mcu = "at90usb1286",
.desc = "Teensy++ 2.0",

.vtable = &teensy_model_vtable,

.usage = 0x1C,
.halfkay_version = 1,
.code_size = 130048,
Expand All @@ -209,6 +217,8 @@ const ty_board_model teensy_30_model = {
.mcu = "mk20dx128",
.desc = "Teensy 3.0",

.vtable = &teensy_model_vtable,

.usage = 0x1D,
.halfkay_version = 2,
.code_size = 131072,
Expand All @@ -226,6 +236,8 @@ const ty_board_model teensy_31_model = {
.mcu = "mk20dx256",
.desc = "Teensy 3.1",

.vtable = &teensy_model_vtable,

.usage = 0x1E,
.halfkay_version = 2,
.code_size = 262144,
Expand Down Expand Up @@ -427,11 +439,14 @@ static int teensy_reboot(ty_board *board)
return r;
}

static const struct _ty_board_mode_vtable teensy_vtable = {
static const struct _ty_board_mode_vtable teensy_mode_vtable = {
.identify = teensy_identify,
.read_serial = teensy_read_serial,
.write_serial = teensy_write_serial,
.upload = teensy_upload,
.reset = teensy_reset,
.reboot = teensy_reboot
};

static const struct _ty_board_model_vtable teensy_model_vtable = {
};

0 comments on commit 14dc9a6

Please sign in to comment.