diff --git a/peripheral/devices/cdash_display.go b/peripheral/devices/cdash_display.go index 20a0622..741662a 100644 --- a/peripheral/devices/cdash_display.go +++ b/peripheral/devices/cdash_display.go @@ -13,6 +13,43 @@ const ( destroyWindowCMDID types.Command = 4 ) +var ( + defaultDecorations = UIDecorations{ + HasBorder: 1, + BGColour: 0x1041, // Look in the eslabsCurses library for these colours + FGColour: 0xffff, + TitleColour: 0xffff, + BorderColour: 0xf800, + TitleSize: 2, + TextSize: 4, + Padding: 0x00, + } +) + +type UIDimensions struct { + X0 uint16 + Y0 uint16 + Width uint16 + Height uint16 +} + +type UIDecorations struct { + BGColour uint16 + FGColour uint16 + TitleColour uint16 + BorderColour uint16 + TitleSize uint8 + TextSize uint8 + HasBorder uint8 + Padding uint8 +} + +type UIWindow struct { + Dims UIDimensions + Decor UIDecorations + Title [32]byte +} + var CDashDisplay = Device{ ID: CDashDisplayDevID, Name: helper.B32("ESLabs CDashDisplay"), @@ -48,14 +85,6 @@ func createWindow(dCMD *DeviceCMD, args []string) (types.Command, []byte, error) // x0, y0, width, height, title # add other decorations later on // fmt.Printf("%s command called: %+v\n", dCMD.GetName(), args) - type UIWindow struct { - X0 uint16 - Y0 uint16 - Width uint16 - Height uint16 - Title [32]byte - } - x0, err := strconv.ParseInt(args[0], 10, 0) if err != nil { return 0, []byte{}, err @@ -74,11 +103,14 @@ func createWindow(dCMD *DeviceCMD, args []string) (types.Command, []byte, error) } data := UIWindow{ - X0: uint16(x0), - Y0: uint16(y0), - Width: uint16(width), - Height: uint16(height), - Title: helper.B32(args[4]), + Dims: UIDimensions{ + X0: uint16(x0), + Y0: uint16(y0), + Width: uint16(width), + Height: uint16(height), + }, + Decor: defaultDecorations, + Title: helper.B32(args[4]), } bytes, err := helper.StructToBytes(data)