sketch

package
v0.35.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckForPdeFiles

func CheckForPdeFiles(sketch *paths.Path) []*paths.Path

CheckForPdeFiles returns all files ending with .pde extension in sketch, this is mainly used to warn the user that these files must be changed to .ino extension. When .pde files won't be supported anymore this function must be removed.

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"`
	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

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
	DefaultProtocol 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) DefaultBuildPath

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

DefaultBuildPath generates the default build directory for a given sketch. The build path is in a temporary directory and is unique for each sketch.

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) GetProfile

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

GetProfile returns the requested profile or nil if the profile is 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.

Jump to

Keyboard shortcuts

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