Added manufacturer to preferences
This commit is contained in:
parent
113d8f9d1c
commit
0bc8e28ec1
|
@ -32,6 +32,7 @@ void setup() {
|
|||
preferences::load();
|
||||
hid::setID(preferences::getVID(), preferences::getPID(), preferences::getVersion());
|
||||
hid::setSerial(preferences::getSerial());
|
||||
hid::setManufacturer(preferences::getManufacturer());
|
||||
|
||||
// Read mode from selector switch
|
||||
selector::init();
|
||||
|
|
12
schema.json
12
schema.json
|
@ -83,13 +83,23 @@
|
|||
"minLength": 4,
|
||||
"maxLength": 4
|
||||
},
|
||||
"rev": {
|
||||
"version": {
|
||||
"type": "string",
|
||||
"title": "USB Product Revision (0100 => 1.0)",
|
||||
"default": "0100",
|
||||
"minLength": 4,
|
||||
"maxLength": 4
|
||||
},
|
||||
"serial": {
|
||||
"type": "string",
|
||||
"title": "USB Serial Number Descriptor",
|
||||
"default": "1337"
|
||||
},
|
||||
"manufacturer": {
|
||||
"type": "string",
|
||||
"title": "USB Manufacturer Descriptor",
|
||||
"default": "SpacehuhnTech"
|
||||
},
|
||||
"default_layout": {
|
||||
"type": "string",
|
||||
"title": "Default Keyboard Layout",
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace hid {
|
|||
bool indicator_read = false; // If initial indicator was read
|
||||
|
||||
std::string serial = "1337";
|
||||
std::string manufacturer = "SpacehuhnTech";
|
||||
|
||||
// HID report descriptor using TinyUSB's template
|
||||
// Single Report (no ID) descriptor
|
||||
|
@ -78,6 +79,11 @@ namespace hid {
|
|||
TinyUSBDevice.setSerialDescriptor(serial.c_str());
|
||||
}
|
||||
|
||||
void setManufacturer(std::string manufacturerstr) {
|
||||
hid::manufacturer = manufacturerstr;
|
||||
TinyUSBDevice.setManufacturerDescriptor(manufacturer.c_str());
|
||||
}
|
||||
|
||||
bool mounted() {
|
||||
return TinyUSBDevice.mounted();
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace hid {
|
|||
void init();
|
||||
void setID(uint16_t vid, uint16_t pid, uint16_t version);
|
||||
void setSerial(std::string serialstr);
|
||||
void setManufacturer(std::string manufacturerstr);
|
||||
|
||||
bool mounted();
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace preferences {
|
|||
std::string pid;
|
||||
std::string version;
|
||||
std::string serial;
|
||||
std::string manufacturer;
|
||||
|
||||
std::string default_layout;
|
||||
int default_delay;
|
||||
|
@ -63,10 +64,11 @@ namespace preferences {
|
|||
root["enable_led"] = enable_led;
|
||||
root["enable_hid"] = enable_hid;
|
||||
|
||||
root["vid"] = vid;
|
||||
root["pid"] = pid;
|
||||
root["version"] = version;
|
||||
root["vid"] = vid;
|
||||
root["pid"] = pid;
|
||||
root["version"] = version;
|
||||
root["serial"] = serial;
|
||||
root["manufacturer"] = manufacturer;
|
||||
|
||||
root["default_layout"] = default_layout;
|
||||
root["default_delay"] = default_delay;
|
||||
|
@ -135,6 +137,7 @@ namespace preferences {
|
|||
read_item<std::string>(config_doc, "pid", pid);
|
||||
read_item<std::string>(config_doc, "version", version);
|
||||
read_item<std::string>(config_doc, "serial", serial);
|
||||
read_item<std::string>(config_doc, "manufacturer", manufacturer);
|
||||
|
||||
read_item<std::string>(config_doc, "default_layout", default_layout);
|
||||
read_item<int>(config_doc, "default_delay", default_delay);
|
||||
|
@ -183,10 +186,11 @@ namespace preferences {
|
|||
enable_led = true;
|
||||
enable_hid = true;
|
||||
|
||||
vid = "16D0";
|
||||
pid = "11A4";
|
||||
version = "0100";
|
||||
vid = "16D0";
|
||||
pid = "11A4";
|
||||
version = "0100";
|
||||
serial = "1337";
|
||||
manufacturer = "SpacehuhnTech";
|
||||
|
||||
default_layout = "US";
|
||||
default_delay = 5;
|
||||
|
@ -262,6 +266,10 @@ namespace preferences {
|
|||
return serial;
|
||||
}
|
||||
|
||||
std::string getManufacturer() {
|
||||
return manufacturer;
|
||||
}
|
||||
|
||||
std::string getDefaultLayout() {
|
||||
return default_layout;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace preferences {
|
|||
uint16_t getVersion();
|
||||
|
||||
std::string getSerial();
|
||||
std::string getManufacturer();
|
||||
|
||||
std::string getDefaultLayout();
|
||||
int getDefaultDelay();
|
||||
|
|
Loading…
Reference in New Issue