Added product to preferences
This commit is contained in:
parent
0bc8e28ec1
commit
ab64ca7453
|
@ -33,6 +33,7 @@ void setup() {
|
|||
hid::setID(preferences::getVID(), preferences::getPID(), preferences::getVersion());
|
||||
hid::setSerial(preferences::getSerial());
|
||||
hid::setManufacturer(preferences::getManufacturer());
|
||||
hid::setProduct(preferences::getProduct());
|
||||
|
||||
// Read mode from selector switch
|
||||
selector::init();
|
||||
|
|
|
@ -100,6 +100,11 @@
|
|||
"title": "USB Manufacturer Descriptor",
|
||||
"default": "SpacehuhnTech"
|
||||
},
|
||||
"product": {
|
||||
"type": "string",
|
||||
"title": "USB Product Descriptor",
|
||||
"default": "USB Nova"
|
||||
},
|
||||
"default_layout": {
|
||||
"type": "string",
|
||||
"title": "Default Keyboard Layout",
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace hid {
|
|||
|
||||
std::string serial = "1337";
|
||||
std::string manufacturer = "SpacehuhnTech";
|
||||
std::string product = "USB Nova";
|
||||
|
||||
// HID report descriptor using TinyUSB's template
|
||||
// Single Report (no ID) descriptor
|
||||
|
@ -84,6 +85,11 @@ namespace hid {
|
|||
TinyUSBDevice.setManufacturerDescriptor(manufacturer.c_str());
|
||||
}
|
||||
|
||||
void setProduct(std::string productstr) {
|
||||
hid::product = productstr;
|
||||
TinyUSBDevice.setProductDescriptor(product.c_str());
|
||||
}
|
||||
|
||||
bool mounted() {
|
||||
return TinyUSBDevice.mounted();
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace hid {
|
|||
void setID(uint16_t vid, uint16_t pid, uint16_t version);
|
||||
void setSerial(std::string serialstr);
|
||||
void setManufacturer(std::string manufacturerstr);
|
||||
void setProduct(std::string productstr);
|
||||
|
||||
bool mounted();
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ namespace preferences {
|
|||
std::string version;
|
||||
std::string serial;
|
||||
std::string manufacturer;
|
||||
std::string product;
|
||||
|
||||
std::string default_layout;
|
||||
int default_delay;
|
||||
|
@ -69,6 +70,7 @@ namespace preferences {
|
|||
root["version"] = version;
|
||||
root["serial"] = serial;
|
||||
root["manufacturer"] = manufacturer;
|
||||
root["product"] = product;
|
||||
|
||||
root["default_layout"] = default_layout;
|
||||
root["default_delay"] = default_delay;
|
||||
|
@ -138,6 +140,7 @@ namespace preferences {
|
|||
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, "product", product);
|
||||
|
||||
read_item<std::string>(config_doc, "default_layout", default_layout);
|
||||
read_item<int>(config_doc, "default_delay", default_delay);
|
||||
|
@ -191,6 +194,7 @@ namespace preferences {
|
|||
version = "0100";
|
||||
serial = "1337";
|
||||
manufacturer = "SpacehuhnTech";
|
||||
product = "USB Nova";
|
||||
|
||||
default_layout = "US";
|
||||
default_delay = 5;
|
||||
|
@ -270,6 +274,10 @@ namespace preferences {
|
|||
return manufacturer;
|
||||
}
|
||||
|
||||
std::string getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
std::string getDefaultLayout() {
|
||||
return default_layout;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace preferences {
|
|||
|
||||
std::string getSerial();
|
||||
std::string getManufacturer();
|
||||
std::string getProduct();
|
||||
|
||||
std::string getDefaultLayout();
|
||||
int getDefaultDelay();
|
||||
|
|
Loading…
Reference in New Issue