sketch

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InvalidSketchFolderNameError

type InvalidSketchFolderNameError struct {
	SketchFolder *paths.Path
	SketchFile   *paths.Path
}

InvalidSketchFolderNameError is returned when the sketch directory doesn't match the sketch name

func (*InvalidSketchFolderNameError) Error

type Profile

type Profile struct {
	Name       string
	Notes      string                   `yaml:"notes"`
	FQBN       string                   `yaml:"fqbn"`
	Port       string                   `yaml:"port"`
	PortConfig map[string]string        `yaml:"port_config"`
	Protocol   string                   `yaml:"protocol"`
	Programmer string                   `yaml:"programmer"`
	Platforms  ProfileRequiredPlatforms `yaml:"platforms"`
	Libraries  ProfileRequiredLibraries `yaml:"libraries"`
}

UnmarshalYAML decodes a Profiles section from YAML source. Profile is a sketch profile, it contains a reference to all the resources needed to build and upload a sketch

func (*Profile) AsYaml

func (p *Profile) AsYaml() string

AsYaml outputs the profile as Yaml

func (*Profile) ToRpc

func (p *Profile) ToRpc() *rpc.SketchProfile

ToRpc converts this Profile to an rpc.SketchProfile

type ProfileLibraryReference

type ProfileLibraryReference struct {
	Library string
	Version *semver.Version
}

ProfileLibraryReference is a reference to a library

func (*ProfileLibraryReference) AsYaml

func (l *ProfileLibraryReference) AsYaml() string

AsYaml outputs the required library as Yaml

func (*ProfileLibraryReference) InternalUniqueIdentifier

func (l *ProfileLibraryReference) InternalUniqueIdentifier() string

InternalUniqueIdentifier returns the unique identifier for this object

func (*ProfileLibraryReference) String

func (l *ProfileLibraryReference) String() string

func (*ProfileLibraryReference) UnmarshalYAML

func (l *ProfileLibraryReference) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML decodes a ProfileLibraryReference from YAML source.

type ProfilePlatformReference

type ProfilePlatformReference struct {
	Packager         string
	Architecture     string
	Version          *semver.Version
	PlatformIndexURL *url.URL
}

ProfilePlatformReference is a reference to a platform

func (*ProfilePlatformReference) AsYaml

func (p *ProfilePlatformReference) AsYaml() string

AsYaml outputs the platform reference as Yaml

func (*ProfilePlatformReference) InternalUniqueIdentifier

func (p *ProfilePlatformReference) InternalUniqueIdentifier() string

InternalUniqueIdentifier returns the unique identifier for this object

func (*ProfilePlatformReference) String

func (p *ProfilePlatformReference) String() string

func (*ProfilePlatformReference) UnmarshalYAML

func (p *ProfilePlatformReference) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML decodes a ProfilePlatformReference from YAML source.

type ProfileRequiredLibraries

type ProfileRequiredLibraries []*ProfileLibraryReference

ProfileRequiredLibraries is a list of ProfileLibraryReference (libraries required to build the sketch using this profile)

func (*ProfileRequiredLibraries) AsYaml

func (p *ProfileRequiredLibraries) AsYaml() string

AsYaml outputs the required libraries as Yaml

type ProfileRequiredPlatforms

type ProfileRequiredPlatforms []*ProfilePlatformReference

ProfileRequiredPlatforms is a list of ProfilePlatformReference (platforms required to build the sketch using this profile)

func (*ProfileRequiredPlatforms) AsYaml

func (p *ProfileRequiredPlatforms) AsYaml() string

AsYaml outputs the required platforms as Yaml

type Project

type Project struct {
	Profiles          []*Profile
	DefaultProfile    string
	DefaultFqbn       string
	DefaultPort       string
	DefaultPortConfig map[string]string
	DefaultProtocol   string
	DefaultProgrammer string
}

Project represents the sketch project file

func LoadProjectFile

func LoadProjectFile(file *paths.Path) (*Project, error)

LoadProjectFile reads a sketch project file

func (*Project) AsYaml

func (p *Project) AsYaml() string

AsYaml outputs the sketch project file as YAML

type Sketch

type Sketch struct {
	Name             string
	MainFile         *paths.Path
	FullPath         *paths.Path    // FullPath is the path to the Sketch folder
	OtherSketchFiles paths.PathList // Sketch files that end in .ino other than main file
	AdditionalFiles  paths.PathList
	RootFolderFiles  paths.PathList // All files that are in the Sketch root
	Project          *Project
}

Sketch holds all the files composing a sketch

func New

func New(path *paths.Path) (*Sketch, error)

New creates an Sketch instance by reading all the files composing a sketch and grouping them by file type.

func (*Sketch) GetDefaultFQBN

func (s *Sketch) GetDefaultFQBN() string

GetDefaultFQBN returns the default FQBN for the sketch (from the sketch.yaml project file), or the empty string if not set.

func (*Sketch) GetDefaultPortAddressAndProtocol

func (s *Sketch) GetDefaultPortAddressAndProtocol() (string, string)

GetDefaultPortAddressAndProtocol returns the default port address and port protocol for the sketch (from the sketch.yaml project file), or empty strings if not set.

func (*Sketch) GetDefaultProgrammer

func (s *Sketch) GetDefaultProgrammer() string

GetDefaultProgrammer return the default Programmer for the sketch (from the sketch.yaml project file), ore the empty string if not set.

func (*Sketch) GetProfile

func (s *Sketch) GetProfile(profileName string) (*Profile, error)

GetProfile returns the requested profile or an error if not found

func (*Sketch) GetProjectPath

func (s *Sketch) GetProjectPath() *paths.Path

GetProjectPath returns the path to the sketch project file (sketch.yaml or sketch.yml)

func (*Sketch) Hash

func (s *Sketch) Hash() string

Hash generate a unique hash for the given sketch.

func (*Sketch) SetDefaultFQBN

func (s *Sketch) SetDefaultFQBN(fqbn string) error

SetDefaultFQBN sets the default FQBN for the sketch and saves it in the sketch.yaml project file.

func (*Sketch) SetDefaultPort

func (s *Sketch) SetDefaultPort(address, protocol string) error

SetDefaultPort sets the default port address and port protocol for the sketch and saves it in the sketch.yaml project file.

func (*Sketch) SetDefaultProgrammer

func (s *Sketch) SetDefaultProgrammer(programmer string) error

SetDefaultFQBN sets the default programmer for the sketch and saves it in the sketch.yaml project file.

func (*Sketch) ToRpc

func (s *Sketch) ToRpc() *rpc.Sketch

ToRpc converts this Sketch into a rpc.LoadSketchResponse

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL