editor v2 + usb host tests

This commit is contained in:
Anthony 2023-11-07 22:49:41 +01:00
parent cb63b37f86
commit 3f3e589fde
26 changed files with 27603 additions and 12732 deletions

Binary file not shown.

View file

@ -0,0 +1,4 @@
(fp_lib_table
(version 7)
(lib (name "sdcard-libs")(type "KiCad")(uri "/mnt/work/git/open-story-teller/hardware/kicad/sdcard-libs.pretty")(options "")(descr ""))
)

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{ {
"board": { "board": {
"active_layer": 37, "active_layer": 0,
"active_layer_preset": "", "active_layer_preset": "",
"auto_track_width": true, "auto_track_width": true,
"hidden_netclasses": [], "hidden_netclasses": [],
@ -65,7 +65,7 @@
36 36
], ],
"visible_layers": "fffffff_ffffffff", "visible_layers": "fffffff_ffffffff",
"zone_display_mode": 1 "zone_display_mode": 0
}, },
"meta": { "meta": {
"filename": "ost-pico-addon.kicad_prl", "filename": "ost-pico-addon.kicad_prl",

View file

@ -34,9 +34,9 @@
"other_text_thickness": 0.15, "other_text_thickness": 0.15,
"other_text_upright": false, "other_text_upright": false,
"pads": { "pads": {
"drill": 2.2, "drill": 2.0,
"height": 3.5, "height": 2.0,
"width": 3.5 "width": 2.0
}, },
"silk_line_width": 0.15, "silk_line_width": 0.15,
"silk_text_italic": false, "silk_text_italic": false,
@ -413,7 +413,7 @@
"name": "Default", "name": "Default",
"pcb_color": "rgba(0, 0, 0, 0.000)", "pcb_color": "rgba(0, 0, 0, 0.000)",
"schematic_color": "rgba(0, 0, 0, 0.000)", "schematic_color": "rgba(0, 0, 0, 0.000)",
"track_width": 1.0, "track_width": 0.0,
"via_diameter": 0.8, "via_diameter": 0.8,
"via_drill": 0.4, "via_drill": 0.4,
"wire_width": 6 "wire_width": 6
@ -430,7 +430,7 @@
"name": "power", "name": "power",
"pcb_color": "rgba(0, 0, 0, 0.000)", "pcb_color": "rgba(0, 0, 0, 0.000)",
"schematic_color": "rgba(0, 0, 0, 0.000)", "schematic_color": "rgba(0, 0, 0, 0.000)",
"track_width": 2.0, "track_width": 0.5,
"via_diameter": 0.8, "via_diameter": 0.8,
"via_drill": 0.4, "via_drill": 0.4,
"wire_width": 6 "wire_width": 6
@ -488,7 +488,7 @@
"workbook_filename": "" "workbook_filename": ""
}, },
"page_layout_descr_file": "", "page_layout_descr_file": "",
"plot_directory": "", "plot_directory": "../",
"spice_adjust_passive_values": false, "spice_adjust_passive_values": false,
"spice_current_sheet_as_root": false, "spice_current_sheet_as_root": false,
"spice_external_command": "spice \"%I\"", "spice_external_command": "spice \"%I\"",

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,4 @@
(sym_lib_table
(version 7)
(lib (name "sdcard-libs")(type "KiCad")(uri "/mnt/work/git/open-story-teller/hardware/kicad/sdcard-libs.kicad_sym")(options "")(descr ""))
)

View file

@ -0,0 +1 @@
{"hostname":"anthony-desktop","username":"anthony"}

View file

@ -0,0 +1,100 @@
(kicad_symbol_lib (version 20220914) (generator kicad_symbol_editor)
(symbol "47219-2001" (pin_names (offset 1.016)) (in_bom yes) (on_board yes)
(property "Reference" "J" (at -12.7105 10.931 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
)
(property "Value" "47219-2001" (at -12.7125 -11.9498 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
)
(property "Footprint" "47219-2001:MOLEX_47219-2001" (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "Datasheet" "" (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "MF" "Molex" (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "Description" "\n1.1mm Pitch microSD Card Connector, Hinge Type, Lead Free | Molex Incorporated 47219-2001\n" (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "Package" "None" (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "Price" "None" (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "Check_prices" "https://www.snapeda.com/parts/47219-2001/Molex/view-part/?ref=eda" (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "SnapEDA_Link" "https://www.snapeda.com/parts/47219-2001/Molex/view-part/?ref=snap" (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "MP" "47219-2001" (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "Purchase-URL" "https://www.snapeda.com/api/url_track_click_mouser/?unipart_id=106506&manufacturer=Molex&part_name=47219-2001&search_term=47219" (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "Availability" "In Stock" (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "MANUFACTURER" "MOLEX" (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(symbol "47219-2001_0_0"
(rectangle (start -12.7 -10.16) (end 12.7 10.16)
(stroke (width 0.254) (type default))
(fill (type background))
)
(pin bidirectional line (at -17.78 -5.08 0) (length 5.08)
(name "DAT2" (effects (font (size 1.016 1.016))))
(number "1" (effects (font (size 1.016 1.016))))
)
(pin bidirectional line (at -17.78 -7.62 0) (length 5.08)
(name "CD/DAT3" (effects (font (size 1.016 1.016))))
(number "2" (effects (font (size 1.016 1.016))))
)
(pin bidirectional line (at -17.78 2.54 0) (length 5.08)
(name "CMD" (effects (font (size 1.016 1.016))))
(number "3" (effects (font (size 1.016 1.016))))
)
(pin power_in line (at 17.78 7.62 180) (length 5.08)
(name "VDD" (effects (font (size 1.016 1.016))))
(number "4" (effects (font (size 1.016 1.016))))
)
(pin input clock (at -17.78 7.62 0) (length 5.08)
(name "CLK" (effects (font (size 1.016 1.016))))
(number "5" (effects (font (size 1.016 1.016))))
)
(pin power_in line (at 17.78 -7.62 180) (length 5.08)
(name "VSS" (effects (font (size 1.016 1.016))))
(number "6" (effects (font (size 1.016 1.016))))
)
(pin bidirectional line (at -17.78 0 0) (length 5.08)
(name "DAT0" (effects (font (size 1.016 1.016))))
(number "7" (effects (font (size 1.016 1.016))))
)
(pin bidirectional line (at -17.78 -2.54 0) (length 5.08)
(name "DAT1" (effects (font (size 1.016 1.016))))
(number "8" (effects (font (size 1.016 1.016))))
)
(pin power_in line (at 17.78 2.54 180) (length 5.08)
(name "GND@1" (effects (font (size 1.016 1.016))))
(number "G1" (effects (font (size 1.016 1.016))))
)
(pin power_in line (at 17.78 0 180) (length 5.08)
(name "GND@2" (effects (font (size 1.016 1.016))))
(number "G2" (effects (font (size 1.016 1.016))))
)
(pin power_in line (at 17.78 -2.54 180) (length 5.08)
(name "GND@3" (effects (font (size 1.016 1.016))))
(number "G3" (effects (font (size 1.016 1.016))))
)
(pin power_in line (at 17.78 -5.08 180) (length 5.08)
(name "GND@4" (effects (font (size 1.016 1.016))))
(number "G4" (effects (font (size 1.016 1.016))))
)
)
)
)

View file

@ -0,0 +1,74 @@
(footprint "MOLEX_47219-2001" (version 20221018) (generator pcbnew)
(layer "F.Cu")
(attr smd)
(fp_text reference "REF**" (at -8.845525 2.928495 180) (layer "F.SilkS")
(effects (font (size 1.001189 1.001189) (thickness 0.15)))
(tstamp bbad2d20-6aae-4437-a45d-fe56caf7629d)
)
(fp_text value "MOLEX_47219-2001" (at 8.61729 -4.41119 180) (layer "F.Fab")
(effects (font (size 1.000268 1.000268) (thickness 0.15)))
(tstamp b5a131a2-4b6e-4ac3-8179-93e08ff11f10)
)
(fp_line (start -6.8 -7.25) (end 6.8 -7.25)
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp 91307f6c-4349-4ed7-b555-f2b50eeb5121))
(fp_line (start -6.8 -7.2) (end -6.8 -4.8)
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp e6b33c4d-3707-4eb8-9ca6-233e4657ea3c))
(fp_line (start -6.8 -4.8) (end 6.8 -4.8)
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp 8679bd83-ad93-43b7-9381-842a34bd2e23))
(fp_line (start -6.8 7.25) (end 6.8 7.25)
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp 4da87cab-90cc-469a-a644-b167cdd547dd))
(fp_line (start -6 6.5) (end -4.3 5.5)
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp b9e56507-fc7c-49d4-81c3-6f4d6945b16d))
(fp_line (start -6 7.2) (end -6 6.5)
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp e421845e-8a27-4955-a7a8-4151b48aa429))
(fp_line (start -4.3 5.5) (end -1.9 4.9)
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp aee0e4e0-bc7c-49db-b115-0cc06c3258fc))
(fp_line (start -1.9 4.9) (end 1.6 4.9)
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp bd825fd8-172b-4f37-85a1-67bf80ebdf82))
(fp_line (start 1.6 4.9) (end 4.2 5.5)
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp d63bcd3e-01ad-4019-878c-a8b1a7044fff))
(fp_line (start 4.2 5.5) (end 6 6.5)
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp ed3a080e-fa74-4280-8f9a-31c411354915))
(fp_line (start 6 7.2) (end 6 6.5)
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp bb97d86c-0b2b-4a06-b544-93707d11ad24))
(fp_line (start 6.8 -7.2) (end 6.8 -4.8)
(stroke (width 0.127) (type solid)) (layer "F.SilkS") (tstamp efc105f8-1cd6-4757-96ac-aea812590371))
(fp_line (start -7.9 -7.6) (end 7.9 -7.6)
(stroke (width 0.127) (type solid)) (layer "F.CrtYd") (tstamp 1fa594b0-b4b8-4d90-8bbe-35b5c35df6c1))
(fp_line (start -7.9 7.6) (end -7.9 -7.6)
(stroke (width 0.127) (type solid)) (layer "F.CrtYd") (tstamp 48a4255c-e4c5-4fdd-a9c5-ed6482eb27ca))
(fp_line (start 7.9 -7.6) (end 7.9 7.6)
(stroke (width 0.127) (type solid)) (layer "F.CrtYd") (tstamp e6511b8c-105e-450c-aa1b-a744903f8bdb))
(fp_line (start 7.9 7.6) (end -7.9 7.6)
(stroke (width 0.127) (type solid)) (layer "F.CrtYd") (tstamp ae88fd55-45da-4408-8c10-db24e14025da))
(fp_line (start -6.8 -2.3) (end -6.8 -4.8)
(stroke (width 0.127) (type solid)) (layer "F.Fab") (tstamp a0bfc8e2-888b-49b5-ae85-818abd1b2795))
(fp_line (start -6.8 5.9) (end -6.8 3.5)
(stroke (width 0.127) (type solid)) (layer "F.Fab") (tstamp ec891a71-30ff-42ef-bc74-b9491100ac2c))
(fp_line (start 6.8 -4.8) (end 6.8 5.9)
(stroke (width 0.127) (type solid)) (layer "F.Fab") (tstamp 573a399e-9586-48c0-aac2-8a6366946428))
(pad "1" smd rect (at 3.2 2.1) (size 0.8 1.5) (layers "F.Cu" "F.Paste" "F.Mask")
(solder_mask_margin 0.0762) (tstamp a101969d-999d-4eab-90e9-8e9baa36caa9))
(pad "2" smd rect (at 2.1 2.1) (size 0.8 1.5) (layers "F.Cu" "F.Paste" "F.Mask")
(solder_mask_margin 0.0762) (tstamp af60b1bb-16fb-4f30-bcc1-8aef81e45e48))
(pad "3" smd rect (at 1 2.1) (size 0.8 1.5) (layers "F.Cu" "F.Paste" "F.Mask")
(solder_mask_margin 0.0762) (tstamp 05fa632d-6eaa-40ab-ade9-3cbd1459981c))
(pad "4" smd rect (at -0.1 2.1) (size 0.8 1.5) (layers "F.Cu" "F.Paste" "F.Mask")
(solder_mask_margin 0.0762) (tstamp 1bfb1d08-5192-437b-a528-aa076699535f))
(pad "5" smd rect (at -1.2 2.1) (size 0.8 1.5) (layers "F.Cu" "F.Paste" "F.Mask")
(solder_mask_margin 0.0762) (tstamp e8966a6c-e20e-4fb4-93b6-ee263795ed33))
(pad "6" smd rect (at -2.3 2.1) (size 0.8 1.5) (layers "F.Cu" "F.Paste" "F.Mask")
(solder_mask_margin 0.0762) (tstamp e6c13a50-6cd4-4ff3-b279-02a0ba062899))
(pad "7" smd rect (at -3.4 2.1) (size 0.8 1.5) (layers "F.Cu" "F.Paste" "F.Mask")
(solder_mask_margin 0.0762) (tstamp 69c3f9d8-dc4a-4621-9cea-1ba23098e9a3))
(pad "8" smd rect (at -4.5 2.1) (size 0.8 1.5) (layers "F.Cu" "F.Paste" "F.Mask")
(solder_mask_margin 0.0762) (tstamp 96ef9341-177d-4bac-8626-539688835d59))
(pad "G1" smd rect (at 6.875 4.7) (size 1.5 2.05) (layers "F.Cu" "F.Paste" "F.Mask")
(solder_mask_margin 0.0762) (tstamp db748e6e-6078-4e89-bd04-78caca85bc07))
(pad "G2" smd rect (at 6.875 -3.6) (size 1.5 2.05) (layers "F.Cu" "F.Paste" "F.Mask")
(solder_mask_margin 0.0762) (tstamp 23980fb6-1bae-4eaf-9e7b-5f7a8298ec8a))
(pad "G3" smd rect (at -6.875 -3.6) (size 1.5 2.05) (layers "F.Cu" "F.Paste" "F.Mask")
(solder_mask_margin 0.0762) (tstamp 3ad3e908-12bf-40f3-953a-81c6e9740a27))
(pad "G4" smd rect (at -6.875 4.7) (size 1.5 2.05) (layers "F.Cu" "F.Paste" "F.Mask")
(solder_mask_margin 0.0762) (tstamp 654618ba-0443-4712-ad4b-797636986a20))
)

View file

@ -0,0 +1,145 @@
(kicad_symbol_lib (version 20211014) (generator kicad_symbol_editor)
(symbol "47219-2001" (pin_names (offset 1.016)) (in_bom yes) (on_board yes)
(property "Reference" "J" (id 0) (at -12.7105 10.931 0)
(effects (font (size 1.27 1.27)) (justify bottom left))
)
(property "Value" "47219-2001" (id 1) (at -12.7125 -11.9498 0)
(effects (font (size 1.27 1.27)) (justify bottom left))
)
(property "Footprint" "47219-2001:MOLEX_47219-2001" (id 2) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "MF" "Molex" (id 4) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "Description" "\n1.1mm Pitch microSD Card Connector, Hinge Type, Lead Free | Molex Incorporated 47219-2001\n" (id 5) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "Package" "None" (id 6) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "Price" "None" (id 7) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "Check_prices" "https://www.snapeda.com/parts/47219-2001/Molex/view-part/?ref=eda" (id 8) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "SnapEDA_Link" "https://www.snapeda.com/parts/47219-2001/Molex/view-part/?ref=snap" (id 9) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "MP" "47219-2001" (id 10) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "Purchase-URL" "https://www.snapeda.com/api/url_track_click_mouser/?unipart_id=106506&manufacturer=Molex&part_name=47219-2001&search_term=47219" (id 11) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "Availability" "In Stock" (id 12) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(property "MANUFACTURER" "MOLEX" (id 13) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify bottom) hide)
)
(symbol "47219-2001_0_0"
(rectangle (start -12.7 -10.16) (end 12.7 10.16)
(stroke (width 0.254)) (fill (type background))
)
(pin bidirectional line (at -17.78 -5.08 0) (length 5.08)
(name "DAT2"
(effects (font (size 1.016 1.016)))
)
(number "1"
(effects (font (size 1.016 1.016)))
)
)
(pin bidirectional line (at -17.78 -7.62 0) (length 5.08)
(name "CD/DAT3"
(effects (font (size 1.016 1.016)))
)
(number "2"
(effects (font (size 1.016 1.016)))
)
)
(pin bidirectional line (at -17.78 2.54 0) (length 5.08)
(name "CMD"
(effects (font (size 1.016 1.016)))
)
(number "3"
(effects (font (size 1.016 1.016)))
)
)
(pin power_in line (at 17.78 7.62 180.0) (length 5.08)
(name "VDD"
(effects (font (size 1.016 1.016)))
)
(number "4"
(effects (font (size 1.016 1.016)))
)
)
(pin input clock (at -17.78 7.62 0) (length 5.08)
(name "CLK"
(effects (font (size 1.016 1.016)))
)
(number "5"
(effects (font (size 1.016 1.016)))
)
)
(pin power_in line (at 17.78 -7.62 180.0) (length 5.08)
(name "VSS"
(effects (font (size 1.016 1.016)))
)
(number "6"
(effects (font (size 1.016 1.016)))
)
)
(pin bidirectional line (at -17.78 0.0 0) (length 5.08)
(name "DAT0"
(effects (font (size 1.016 1.016)))
)
(number "7"
(effects (font (size 1.016 1.016)))
)
)
(pin bidirectional line (at -17.78 -2.54 0) (length 5.08)
(name "DAT1"
(effects (font (size 1.016 1.016)))
)
(number "8"
(effects (font (size 1.016 1.016)))
)
)
(pin power_in line (at 17.78 2.54 180.0) (length 5.08)
(name "GND@1"
(effects (font (size 1.016 1.016)))
)
(number "G1"
(effects (font (size 1.016 1.016)))
)
)
(pin power_in line (at 17.78 0.0 180.0) (length 5.08)
(name "GND@2"
(effects (font (size 1.016 1.016)))
)
(number "G2"
(effects (font (size 1.016 1.016)))
)
)
(pin power_in line (at 17.78 -2.54 180.0) (length 5.08)
(name "GND@3"
(effects (font (size 1.016 1.016)))
)
(number "G3"
(effects (font (size 1.016 1.016)))
)
)
(pin power_in line (at 17.78 -5.08 180.0) (length 5.08)
(name "GND@4"
(effects (font (size 1.016 1.016)))
)
(number "G4"
(effects (font (size 1.016 1.016)))
)
)
)
)
)

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -0,0 +1,42 @@
(footprint MOLEX_47219-2001 (layer F.Cu) (tedit 651D38D3)
(descr "")
(attr smd)
(fp_text reference REF** (at -8.845525 2.928495 900) (layer F.SilkS)
(effects (font (size 1.00118897638 1.00118897638) (thickness 0.15)))
)
(fp_text value MOLEX_47219-2001 (at 8.61729 -4.41119 900) (layer F.Fab)
(effects (font (size 1.00026771654 1.00026771654) (thickness 0.15)))
)
(pad 1 smd rect (at 3.2 2.1) (size 0.8 1.5) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.0762))
(pad 2 smd rect (at 2.1 2.1) (size 0.8 1.5) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.0762))
(pad 3 smd rect (at 1.0 2.1) (size 0.8 1.5) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.0762))
(pad 4 smd rect (at -0.1 2.1) (size 0.8 1.5) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.0762))
(pad 5 smd rect (at -1.2 2.1) (size 0.8 1.5) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.0762))
(pad 6 smd rect (at -2.3 2.1) (size 0.8 1.5) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.0762))
(pad 7 smd rect (at -3.4 2.1) (size 0.8 1.5) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.0762))
(pad 8 smd rect (at -4.5 2.1) (size 0.8 1.5) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.0762))
(pad G1 smd rect (at 6.875 4.7) (size 1.5 2.05) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.0762))
(pad G2 smd rect (at 6.875 -3.6) (size 1.5 2.05) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.0762))
(pad G3 smd rect (at -6.875 -3.6) (size 1.5 2.05) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.0762))
(pad G4 smd rect (at -6.875 4.7) (size 1.5 2.05) (layers F.Cu F.Mask F.Paste) (solder_mask_margin 0.0762))
(fp_line (start -6.8 7.25) (end 6.8 7.25) (layer F.SilkS) (width 0.127))
(fp_line (start -6.8 -7.25) (end 6.8 -7.25) (layer F.SilkS) (width 0.127))
(fp_line (start -6.8 -7.2) (end -6.8 -4.8) (layer F.SilkS) (width 0.127))
(fp_line (start -6.8 5.9) (end -6.8 3.5) (layer F.Fab) (width 0.127))
(fp_line (start -6.8 -2.3) (end -6.8 -4.8) (layer F.Fab) (width 0.127))
(fp_line (start 6.8 -7.2) (end 6.8 -4.8) (layer F.SilkS) (width 0.127))
(fp_line (start 6.8 -4.8) (end 6.8 5.9) (layer F.Fab) (width 0.127))
(fp_line (start -6.0 7.2) (end -6.0 6.5) (layer F.SilkS) (width 0.127))
(fp_line (start 6.0 7.2) (end 6.0 6.5) (layer F.SilkS) (width 0.127))
(fp_line (start -6.0 6.5) (end -4.3 5.5) (layer F.SilkS) (width 0.127))
(fp_line (start -4.3 5.5) (end -1.9 4.9) (layer F.SilkS) (width 0.127))
(fp_line (start -1.9 4.9) (end 1.6 4.9) (layer F.SilkS) (width 0.127))
(fp_line (start 1.6 4.9) (end 4.2 5.5) (layer F.SilkS) (width 0.127))
(fp_line (start 4.2 5.5) (end 6.0 6.5) (layer F.SilkS) (width 0.127))
(fp_line (start -6.8 -4.8) (end 6.8 -4.8) (layer F.SilkS) (width 0.127))
(fp_line (start -7.9 -7.6) (end 7.9 -7.6) (layer F.CrtYd) (width 0.127))
(fp_line (start 7.9 -7.6) (end 7.9 7.6) (layer F.CrtYd) (width 0.127))
(fp_line (start 7.9 7.6) (end -7.9 7.6) (layer F.CrtYd) (width 0.127))
(fp_line (start -7.9 7.6) (end -7.9 -7.6) (layer F.CrtYd) (width 0.127))
)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View file

@ -118,7 +118,7 @@ int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void *buff
return 0; return 0;
} }
debug_printf("lba 0x%x, bufsize %d, offset %d\n", lba, bufsize, offset); // debug_printf("lba 0x%x, bufsize %d, offset %d\n", lba, bufsize, offset);
// uint8_t const *addr = msc_disk[lba] + offset; // uint8_t const *addr = msc_disk[lba] + offset;
uint8_t const *addr = blockBuf + offset; uint8_t const *addr = blockBuf + offset;

View file

@ -31,8 +31,6 @@
// =========================================================================================================== // ===========================================================================================================
// CONSTANTS / DEFINES // CONSTANTS / DEFINES
// =========================================================================================================== // ===========================================================================================================
const uint8_t DEBUG_PIN = 1;
const uint8_t LED_PIN = 14;
const uint8_t LCD_DC = 8; const uint8_t LCD_DC = 8;
const uint8_t LCD_CS = 9; const uint8_t LCD_CS = 9;
@ -41,7 +39,7 @@ const uint8_t LCD_BL = 13;
const uint8_t ROTARY_A = 6; const uint8_t ROTARY_A = 6;
const uint8_t ROTARY_B = 7; const uint8_t ROTARY_B = 7;
const uint8_t ROTARY_BUTTON = 3; const uint8_t ROTARY_BUTTON = 1;
#define SDCARD_SCK 18 #define SDCARD_SCK 18
#define SDCARD_MOSI 19 #define SDCARD_MOSI 19
@ -52,9 +50,6 @@ const uint8_t SD_CARD_PRESENCE = 24;
#define UART_ID uart0 #define UART_ID uart0
#define BAUD_RATE 115200 #define BAUD_RATE 115200
// We are using pins 0 and 1, but see the GPIO function select table in the
// datasheet for information on which other pins can be used.
#define UART_TX_PIN 0
#define UART_RX_PIN 1 #define UART_RX_PIN 1
// PICO alarm (RTOS uses Alarm 0 and IRQ 0) // PICO alarm (RTOS uses Alarm 0 and IRQ 0)

View file

@ -2,7 +2,8 @@
#define _TUSB_CONFIG_H_ #define _TUSB_CONFIG_H_
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C"
{
#endif #endif
//-------------------------------------------------------------------- //--------------------------------------------------------------------
@ -76,6 +77,9 @@
#define CFG_TUD_MIDI 0 #define CFG_TUD_MIDI 0
#define CFG_TUD_VENDOR 0 #define CFG_TUD_VENDOR 0
#define CFG_TUD_CDC_RX_BUFSIZE (256)
#define CFG_TUD_CDC_TX_BUFSIZE (256)
// HID buffer size Should be sufficient to hold ID (if any) + Data // HID buffer size Should be sufficient to hold ID (if any) + Data
#define CFG_TUD_HID_EP_BUFSIZE 16 #define CFG_TUD_HID_EP_BUFSIZE 16
#define CFG_TUD_MSC_EP_BUFSIZE 512 #define CFG_TUD_MSC_EP_BUFSIZE 512

View file

@ -130,7 +130,9 @@ set(SRCS
../software/library/miniaudio.h ../software/library/miniaudio.h
src/story_project.cpp src/story_project.cpp
src/story_project.h
src/media_converter.cpp src/media_converter.cpp
src/media_converter.h
) )
if(WIN32) if(WIN32)

View file

@ -16,6 +16,21 @@ BaseNode::BaseNode(const std::string &title)
// m_node->Outputs.emplace_back(GetNextId(), "False", PinType::Flow); // m_node->Outputs.emplace_back(GetNextId(), "False", PinType::Flow);
} }
void BaseNode::AddInput()
{
m_node->Inputs.emplace_back(GetNextId(), "", PinType::Flow);
}
void BaseNode::AddOutput()
{
m_node->Outputs.emplace_back(GetNextId(), "", PinType::Flow);
}
void BaseNode::DeleteOutput()
{
m_node->Outputs.pop_back();
}
void BaseNode::SetPosition(int x, int y) void BaseNode::SetPosition(int x, int y)
{ {
ed::SetNodePosition(m_node->ID, ImVec2(0, 0)); ed::SetNodePosition(m_node->ID, ImVec2(0, 0));
@ -52,20 +67,19 @@ void BaseNode::DrawPins()
static const char *str = "#1 >"; static const char *str = "#1 >";
static float textWidth = ImGui::CalcTextSize(str).x; static float textWidth = ImGui::CalcTextSize(str).x;
for (uint32_t i = 0; i < m_inputs; i++) for (auto& input : m_node->Inputs)
{ {
ed::BeginPin(GetNextId(), ed::PinKind::Input); ed::BeginPin(input.ID, ed::PinKind::Input);
ImGui::Text( ICON_MDI_OCTAGON_OUTLINE " In" ); ImGui::Text( ICON_MDI_OCTAGON_OUTLINE " In" );
ed::EndPin(); ed::EndPin();
ImGui::SameLine();
} }
for (uint32_t i = 0; i < m_outputs; i++) for (auto& output : m_node->Outputs)
{ {
ImGui::Dummy(ImVec2(320 - textWidth * 2, 0)); // Hacky magic number to space out the output pin. ImGui::Dummy(ImVec2(320 - textWidth * 2, 0)); // Hacky magic number to space out the output pin.
ImGui::SameLine(); ImGui::SameLine();
ed::BeginPin(GetNextId(), ed::PinKind::Output); ed::BeginPin(output.ID, ed::PinKind::Output);
ImGui::Text( "#1 " ICON_MDI_OCTAGON_OUTLINE ); ImGui::Text( "#1 " ICON_MDI_OCTAGON_OUTLINE );
ed::EndPin(); ed::EndPin();
} }

View file

@ -6,6 +6,8 @@
#include <random> #include <random>
#include <string> #include <string>
#include "story_project.h"
#include <imgui_node_editor.h> #include <imgui_node_editor.h>
namespace ed = ax::NodeEditor; namespace ed = ax::NodeEditor;
@ -89,54 +91,6 @@ struct Link
}; };
// Encaasulate the genaeration of a Version 4 UUID object
// A Version 4 UUID is a universally unique identifier that is generated using random numbers.
class UUID
{
public:
UUID() { New(); }
// Factory method for creating UUID object.
void New()
{
std::random_device rd;
std::mt19937 engine{rd()};
std::uniform_int_distribution<int> dist{0, 256}; //Limits of the interval
for (int index = 0; index < 16; ++index)
{
_data[index] = (unsigned char)dist(engine);
}
_data[6] = ((_data[6] & 0x0f) | 0x40); // Version 4
_data[8] = ((_data[8] & 0x3f) | 0x80); // Variant is 10
}
// Returns UUID as formatted string
std::string String()
{
// Formats to "0065e7d7-418c-4da4-b4d6-b54b6cf7466a"
char buffer[256] = {0};
std::snprintf(buffer, 255,
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
_data[0], _data[1], _data[2], _data[3],
_data[4], _data[5],
_data[6], _data[7],
_data[8], _data[9],
_data[10], _data[11], _data[12], _data[13], _data[14], _data[15]);
std::string uuid = buffer;
return uuid;
}
unsigned char _data[16] = {0};
};
class BaseNode class BaseNode
{ {
public: public:
@ -158,9 +112,7 @@ public:
void DrawPins(); void DrawPins();
uint32_t Outputs() const { return m_outputs; } uint32_t Outputs() const { return m_node->Outputs.size(); }
void SetOutputs(uint32_t outputs) { m_outputs = outputs; }
void SetId(const std::string &id) { m_id = id; } void SetId(const std::string &id) { m_id = id; }
std::string GetId() const { return m_id; } std::string GetId() const { return m_id; }
@ -180,6 +132,9 @@ public:
return s_nextId++; return s_nextId++;
} }
void AddInput();
void AddOutput();
void DeleteOutput();
private: private:
std::unique_ptr<Node> m_node; std::unique_ptr<Node> m_node;
@ -188,8 +143,6 @@ private:
std::string m_id; std::string m_id;
NodePosition m_pos; NodePosition m_pos;
uint32_t m_outputs{1};
uint32_t m_inputs{1};
static int s_nextId; static int s_nextId;

View file

@ -12,7 +12,8 @@
#pragma comment(lib, "ws2_32.lib") #pragma comment(lib, "ws2_32.lib")
#endif #endif
#include "IconsMaterialDesignIcons.h"
#include "ImGuiFileDialog.h"
MainWindow::MainWindow() MainWindow::MainWindow()
: m_resourcesWindow(m_project) : m_resourcesWindow(m_project)
@ -25,20 +26,31 @@ MainWindow::~MainWindow()
} }
void MainWindow::SetupMainMenuBar() void MainWindow::SetupMainMenuBar()
{ {
bool showAboutPopup = false; bool showAboutPopup = false;
bool showParameters = false; bool showParameters = false;
bool showNewProject = false;
if (ImGui::BeginMainMenuBar()) if (ImGui::BeginMainMenuBar())
{ {
if (ImGui::BeginMenu("File")) if (ImGui::BeginMenu("File"))
{ {
if (ImGui::MenuItem("New project"))
{
showNewProject = true;
}
if (ImGui::MenuItem("Close project"))
{
CloseProject();
}
if (ImGui::MenuItem("Paramètres")) if (ImGui::MenuItem("Paramètres"))
{ {
showParameters = true; showParameters = true;
} }
ImGui::EndMenu(); ImGui::EndMenu();
} }
@ -64,6 +76,11 @@ void MainWindow::SetupMainMenuBar()
ImGui::OpenPopup("Options"); ImGui::OpenPopup("Options");
} }
if (showNewProject)
{
ImGui::OpenPopup("NewProjectPopup");
}
// Always center this window when appearing // Always center this window when appearing
ImVec2 center = ImGui::GetMainViewport()->GetCenter(); ImVec2 center = ImGui::GetMainViewport()->GetCenter();
//ImVec2 parent_pos = ImGui::GetWindowPos(); //ImVec2 parent_pos = ImGui::GetWindowPos();
@ -73,7 +90,7 @@ void MainWindow::SetupMainMenuBar()
if (ImGui::BeginPopupModal("AboutPopup", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) if (ImGui::BeginPopupModal("AboutPopup", nullptr, ImGuiWindowFlags_AlwaysAutoResize))
{ {
ImGui::Text("Moniteo"); ImGui::Text("Story Editor V1");
ImGui::Separator(); ImGui::Separator();
ImGui::TextColored(ImVec4(1.0f, 0.0f, 1.0f, 1.0f), "Platform"); ImGui::TextColored(ImVec4(1.0f, 0.0f, 1.0f, 1.0f), "Platform");
// ImGui::Text("%s", SDL_GetPlatform()); // ImGui::Text("%s", SDL_GetPlatform());
@ -230,6 +247,227 @@ bool MainWindow::ShowQuitConfirm()
} }
void MainWindow::NewProjectPopup()
{
static std::string projdir;
// Always center this window when appearing
ImVec2 center = ImGui::GetMainViewport()->GetCenter();
ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));
if (ImGui::BeginPopupModal("NewProjectPopup", NULL, ImGuiWindowFlags_AlwaysAutoResize))
{
ImGui::Text("New project parameters (directory must be empty)");
ImGui::Separator();
ImGui::Text("Directory: "); ImGui::SameLine();
static char project_dir[256] = "";
ImGui::InputTextWithHint("##project_path", "Project path", project_dir, IM_ARRAYSIZE(project_dir));
if (ImGui::Button( ICON_MDI_FOLDER " ..."))
{
ImGuiFileDialog::Instance()->OpenDialog("ChooseDirDialog", "Choose File", nullptr, ".", 1, nullptr, ImGuiFileDialogFlags_Modal);
}
// display
if (ImGuiFileDialog::Instance()->Display("ChooseDirDialog"))
{
// action if OK
if (ImGuiFileDialog::Instance()->IsOk())
{
std::string filePathName = ImGuiFileDialog::Instance()->GetFilePathName();
projdir = ImGuiFileDialog::Instance()->GetCurrentPath();
}
// close
ImGuiFileDialog::Instance()->Close();
}
ImGui::Text("Project name: "); ImGui::SameLine();
static char project_name[256] = "";
ImGui::InputTextWithHint("##project_name", "Project name", project_name, IM_ARRAYSIZE(project_name));
ImGui::Text("Size of display screen: ");
ImGui::SameLine();
static ImGuiComboFlags flags = 0;
static int display_item_current_idx = 0; // Here we store our selection data as an index.
static int image_item_current_idx = 0; // Here we store our selection data as an index.
static int sound_item_current_idx = 0; // Here we store our selection data as an index.
{
// Using the generic BeginCombo() API, you have full control over how to display the combo contents.
// (your selection data could be an index, a pointer to the object, an id for the object, a flag intrusively
// stored in the object itself, etc.)
const char* display_items[] = { "320x240", "640x480" };
const char* combo_preview_value = display_items[display_item_current_idx]; // Pass in the preview value visible before opening the combo (it could be anything)
if (ImGui::BeginCombo("##ComboDisplay", combo_preview_value, flags))
{
for (int n = 0; n < IM_ARRAYSIZE(display_items); n++)
{
const bool is_selected = (display_item_current_idx == n);
if (ImGui::Selectable(display_items[n], is_selected))
display_item_current_idx = n;
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
if (is_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
}
}
ImGui::Text("Image format: ");
ImGui::SameLine();
{
// Using the generic BeginCombo() API, you have full control over how to display the combo contents.
// (your selection data could be an index, a pointer to the object, an id for the object, a flag intrusively
// stored in the object itself, etc.)
const char* image_items[] = { "BMP (compressed 4-bit palette)", "QOIF (Quite Ok Image Format" };
const char* image_combo_preview_value = image_items[image_item_current_idx]; // Pass in the preview value visible before opening the combo (it could be anything)
if (ImGui::BeginCombo("##ComboImage", image_combo_preview_value, flags))
{
for (int n = 0; n < IM_ARRAYSIZE(image_items); n++)
{
const bool is_selected = (image_item_current_idx == n);
if (ImGui::Selectable(image_items[n], is_selected))
image_item_current_idx = n;
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
if (is_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
}
}
ImGui::Text("Sound format: ");
ImGui::SameLine();
{
// Using the generic BeginCombo() API, you have full control over how to display the combo contents.
// (your selection data could be an index, a pointer to the object, an id for the object, a flag intrusively
// stored in the object itself, etc.)
const char* sound_items[] = { "WAV (16-bit stereo)", "QOAF (Quite Ok Audio Format" };
const char* sound_combo_preview_value = sound_items[sound_item_current_idx]; // Pass in the preview value visible before opening the combo (it could be anything)
if (ImGui::BeginCombo("##ComboSound", sound_combo_preview_value, flags))
{
for (int n = 0; n < IM_ARRAYSIZE(sound_items); n++)
{
const bool is_selected = (sound_item_current_idx == n);
if (ImGui::Selectable(sound_items[n], is_selected))
sound_item_current_idx = n;
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
if (is_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
}
}
auto GetImageFormat = [](int idx) -> StoryProject::ImageFormat
{
StoryProject::ImageFormat img{StoryProject::IMG_FORMAT_BMP_4BITS};
if (idx < StoryProject::IMG_FORMAT_COUNT) {
img = static_cast<StoryProject::ImageFormat>(idx);
}
return img;
};
auto GetSoundFormat = [](int idx) -> StoryProject::SoundFormat {
StoryProject::SoundFormat img{StoryProject::SND_FORMAT_WAV};
if (idx < StoryProject::IMG_FORMAT_COUNT) {
img = static_cast<StoryProject::SoundFormat>(idx);
}
return img;
};
if (ImGui::Button("OK", ImVec2(120, 0)))
{
bool valid{true};
if (!std::filesystem::is_directory(projdir))
{
valid = false;
}
if (valid)
{
m_project.Initialize(std::filesystem::path(projdir) / "project.json");
if (display_item_current_idx == 0)
{
m_project.SetDisplayFormat(320, 240);
}
else
{
m_project.SetDisplayFormat(640, 480);
}
m_project.SetImageFormat(GetImageFormat(image_item_current_idx));
m_project.SetSoundFormat(GetSoundFormat(sound_item_current_idx));
m_project.SetName(project_name);
m_project.SetUuid(UUID().String());
SaveProject();
EnableProject();
ImGui::CloseCurrentPopup();
}
}
ImGui::SetItemDefaultFocus();
ImGui::SameLine();
if (ImGui::Button("Cancel", ImVec2(120, 0)))
{
ImGui::CloseCurrentPopup();
}
ImGui::EndPopup();
}
else
{
projdir = "";
}
}
void MainWindow::SaveProject()
{
nlohmann::json model; // = m_model.Save();
m_project.Save(model);
}
void MainWindow::EnableProject()
{
// FIXME
}
void MainWindow::CloseProject()
{
m_project.Clear();
// m_model.Clear();
// m_ostHmiDock->Close();
// m_resourcesDock->Close();
// m_scriptEditorDock->Close();
// m_vmDock->Close();
// m_ramView->Close();
// m_romView->Close();
// m_logDock->Close();
// m_toolbar->SetActionsActive(false);
// m_view->setEnabled(false);
}
void MainWindow::Loop() void MainWindow::Loop()
{ {
// Main loop // Main loop
@ -252,6 +490,8 @@ void MainWindow::Loop()
m_nodeEditorWindow.Draw("Blueprint", nullptr); m_nodeEditorWindow.Draw("Blueprint", nullptr);
ShowOptionsWindow(); ShowOptionsWindow();
NewProjectPopup();
if (aboutToClose) if (aboutToClose)
{ {
ImGui::OpenPopup("QuitConfirm"); ImGui::OpenPopup("QuitConfirm");

View file

@ -92,6 +92,7 @@ private:
Chip32::Result m_result; Chip32::Result m_result;
// DebugContext m_dbg; // DebugContext m_dbg;
std::vector<std::string> m_recentProjects;
Gui gui; Gui gui;
EmulatorWindow m_emulatorWindow; EmulatorWindow m_emulatorWindow;
@ -121,6 +122,10 @@ private:
void ShowOptionsWindow(); void ShowOptionsWindow();
bool ShowQuitConfirm(); bool ShowQuitConfirm();
void NewProjectPopup();
void SaveProject();
void EnableProject();
void CloseProject();
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

View file

@ -8,6 +8,11 @@ MediaNode::MediaNode(const std::string &title)
: BaseNode(title) : BaseNode(title)
{ {
Gui::LoadRawImage("fairy.png", m_image); Gui::LoadRawImage("fairy.png", m_image);
// Create defaut one input and one output
AddInput();
AddOutput();
} }
void MediaNode::Draw() void MediaNode::Draw()
@ -95,9 +100,12 @@ void MediaNode::Draw()
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text("%d", counter); ImGui::Text("%d", counter);
if (counter != Outputs()) if (counter > Outputs())
{ {
SetOutputs(counter); for (int i = 0; i < (counter - Outputs()); i++)
{
AddOutput();
}
} }

View file

@ -71,28 +71,78 @@ void NodeEditorWindow::Draw(const char *title, bool *p_open)
n->Draw(); n->Draw();
} }
/* for (auto& linkInfo : m_Links)
for (auto& node : m_Nodes)
{ {
ed::BeginNode(node.ID); ed::Link(linkInfo.Id, linkInfo.InputId, linkInfo.OutputId);
ImGui::Text("Node A");
for (auto& input : node.Inputs)
{
ed::BeginPin(input.ID, ed::PinKind::Input);
ImGui::Text("-> In");
ed::EndPin();
} }
for (auto& output : node.Outputs) // Handle creation action, returns true if editor want to create new object (node or link)
if (ed::BeginCreate())
{ {
ed::BeginPin(output.ID, ed::PinKind::Output); ed::PinId inputPinId, outputPinId;
ImGui::Text("Out ->"); if (ed::QueryNewLink(&inputPinId, &outputPinId))
ed::EndPin(); {
// QueryNewLink returns true if editor want to create new link between pins.
//
// Link can be created only for two valid pins, it is up to you to
// validate if connection make sense. Editor is happy to make any.
//
// Link always goes from input to output. User may choose to drag
// link from output pin or input pin. This determine which pin ids
// are valid and which are not:
// * input valid, output invalid - user started to drag new ling from input pin
// * input invalid, output valid - user started to drag new ling from output pin
// * input valid, output valid - user dragged link over other pin, can be validated
if (inputPinId && outputPinId) // both are valid, let's accept link
{
// ed::AcceptNewItem() return true when user release mouse button.
if (ed::AcceptNewItem())
{
// Since we accepted new link, lets add one to our list of links.
m_Links.push_back({ ed::LinkId(m_NextLinkId++), inputPinId, outputPinId });
// Draw new link.
ed::Link(m_Links.back().Id, m_Links.back().InputId, m_Links.back().OutputId);
} }
ed::EndNode(); // You may choose to reject connection between these nodes
// by calling ed::RejectNewItem(). This will allow editor to give
// visual feedback by changing link thickness and color.
} }
*/ }
}
ed::EndCreate(); // Wraps up object creation action handling.
// Handle deletion action
if (ed::BeginDelete())
{
// There may be many links marked for deletion, let's loop over them.
ed::LinkId deletedLinkId;
while (ed::QueryDeletedLink(&deletedLinkId))
{
// If you agree that link can be deleted, accept deletion.
if (ed::AcceptDeletedItem())
{
// Then remove link from your data.
for (auto& link : m_Links)
{
if (link.Id == deletedLinkId)
{
m_Links.erase(&link);
break;
}
}
}
// You may reject link deletion by calling:
// ed::RejectDeletedItem();
}
}
ed::EndDelete(); // Wrap up deletion action
ed::End(); ed::End();
ed::SetCurrentEditor(nullptr); ed::SetCurrentEditor(nullptr);

View file

@ -8,6 +8,7 @@
#include <condition_variable> #include <condition_variable>
#include <queue> #include <queue>
#include <memory> #include <memory>
#include <random>
#include <thread> #include <thread>
#include <mutex> #include <mutex>
#include "json.hpp" #include "json.hpp"
@ -47,6 +48,54 @@ struct AudioCommand {
}; };
// Encaasulate the genaeration of a Version 4 UUID object
// A Version 4 UUID is a universally unique identifier that is generated using random numbers.
class UUID
{
public:
UUID() { New(); }
// Factory method for creating UUID object.
void New()
{
std::random_device rd;
std::mt19937 engine{rd()};
std::uniform_int_distribution<int> dist{0, 256}; //Limits of the interval
for (int index = 0; index < 16; ++index)
{
_data[index] = (unsigned char)dist(engine);
}
_data[6] = ((_data[6] & 0x0f) | 0x40); // Version 4
_data[8] = ((_data[8] & 0x3f) | 0x80); // Variant is 10
}
// Returns UUID as formatted string
std::string String()
{
// Formats to "0065e7d7-418c-4da4-b4d6-b54b6cf7466a"
char buffer[256] = {0};
std::snprintf(buffer, 255,
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
_data[0], _data[1], _data[2], _data[3],
_data[4], _data[5],
_data[6], _data[7],
_data[8], _data[9],
_data[10], _data[11], _data[12], _data[13], _data[14], _data[15]);
std::string uuid = buffer;
return uuid;
}
unsigned char _data[16] = {0};
};
// FIXME : Structure très Lunii style, à utiliser pour la conversion peut-être ... // FIXME : Structure très Lunii style, à utiliser pour la conversion peut-être ...
struct StoryNode struct StoryNode