Skip to content

Commit

Permalink
Fix code style problems
Browse files Browse the repository at this point in the history
  • Loading branch information
mishamyrt committed Jul 19, 2023
1 parent a778172 commit ca1ebe5
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/internal/nuga/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (a *App) GetPath() string {
return a.dev.Path
}

// GetModes returns keyboard modes
// GetLightDomains returns keyboard light domains
func (a *App) GetLightDomains() []effect.Domain {
return a.dev.LightDomains
}
Expand Down
2 changes: 1 addition & 1 deletion lib/examples/describe/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func describe(d *device.Device) {
}

func openSimulation(tplPath string) (*device.Device, error) {
content, err := os.ReadFile(os.Args[1])
content, err := os.ReadFile(tplPath)
if err != nil {
panic(err)
}
Expand Down
1 change: 1 addition & 0 deletions lib/pkg/bit/mask.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package bit contains utils for bit masks
package bit

// Mask represents bit mask entity
Expand Down
7 changes: 7 additions & 0 deletions lib/pkg/device/device.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package device is the entrypoint for keyboard device control
package device

import (
Expand All @@ -6,6 +7,7 @@ import (
"nuga/pkg/light/effect"
)

// Device represents keyboard with its controls
type Device struct {
Name string
Layout int
Expand All @@ -14,22 +16,27 @@ type Device struct {
LightDomains []effect.Domain
}

// GetEffects returns keyboard effects.
func (d *Device) GetEffects() (*light.Effects, error) {
return d.Light.GetEffects()
}

// SetEffects sets keyboard effects.
func (d *Device) SetEffects(p *light.Effects) error {
return d.Light.SetEffects(p)
}

// GetColors returns keyboard colors state.
func (d *Device) GetColors() (*light.ColorState, error) {
return d.Light.GetColors()
}

// SetColors sets keyboard color state.
func (d *Device) SetColors(c *light.ColorState) error {
return d.Light.SetColors(c)
}

// Open real keyboard USB handle
func Open() (*Device, error) {
handle, err := hid.OpenHandle()
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions lib/pkg/device/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package device

import "errors"

// ErrNotSupported is returned when you try to open a keyboard that is not supported by the application
var ErrNotSupported = errors.New("device is not supported")

// ErrWrongVendor is returned when you try to open a keyboard not from NuPhy
var ErrWrongVendor = errors.New("device vendor is not NuPhy")
1 change: 1 addition & 0 deletions lib/pkg/device/simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package device

import "nuga/pkg/light"

// OpenSimulation opens not real keyboard from template (for testing)
func OpenSimulation(t light.SimulationTemplate) (*Device, error) {
d, err := getDevice(t.Name)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions lib/pkg/device/supported.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"strings"
)

// SupportedDevices contains nuga supported keyboard list with its features
var SupportedDevices = []Device{
{
Name: "Halo75",
Expand Down
1 change: 1 addition & 0 deletions lib/pkg/light/controller-k916.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func (d *K916Controller) SetEffects(p *Effects) error {
return d.Handle.SendWithRetries(paramsRequest)
}

// OpenK916 opens BYK916 NuPhy keyboard lights.
func OpenK916(handle *hid.Handle) Controller {
var lights Controller = &K916Controller{
Handle: handle,
Expand Down
2 changes: 1 addition & 1 deletion lib/pkg/light/effect/domain.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package effect

// Modes is a list of keyboard mode
// Domain is a type of keyboard lights with its mode
type Domain struct {
Name string
Modes []Mode
Expand Down
2 changes: 1 addition & 1 deletion lib/pkg/light/effect/halolight.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var (
}
)

// Backlight is a list of backlight effects.
// Halo is a domain for halolight effects.
var Halo = Domain{
Name: "Halo",
Modes: []Mode{
Expand Down
1 change: 1 addition & 0 deletions lib/pkg/light/effect/sidelight.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var (
}
)

// Sidelight is a domain for sidelight effects.
var Sidelight = Domain{
Name: "Sidelight",
Modes: []Mode{
Expand Down

0 comments on commit ca1ebe5

Please sign in to comment.