pirev

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: MPL-2.0 Imports: 2 Imported by: 0

README

go-pirev

godoc-badge release-badge license-badge goreport-badge

Raspberry Pi revision code parser in Go

A Go library for parsing and extracting hardware information from a Raspberry Pi revision code as structured data or raw bit values.

Also includes a basic CLI tool that uses this library to display the details of a Raspberry Pi revision code.

Installation

Library

In the directory of your module run:

go get github.com/antichris/go-pirev@latest
CLI tool
go install github.com/antichris/go-pirev/cmd/pirev@latest

License

The source code of this project is released under Mozilla Public License Version 2.0. See LICENSE.

Documentation

Overview

Package pirev parses Raspberry Pi new-style revision codes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Code

type Code uint32

Code is a Raspberry Pi revision code.

type Info

type Info struct {
	Revision        uint8 // 1.#
	Model           Model
	Processor       Processor
	Manufacturer    Manufacturer
	MemSize         uint // In megabytes
	NewStyleRev     bool // New-style revision code
	WarrantyVoid    bool // Warranty has been voided by overclocking
	NoOTPReading    bool // OTP reading disallowed
	NoOTPPrograming bool // OTP programming disallowed
	NoOvervoltage   bool // Overvoltage disallowed
}

Info describes Raspberry Pi hardware as identified by revision code.

func Identify

func Identify(r Code) Info

Identify hardware from a revision code.

type Manufacturer

type Manufacturer uint8

Manufacturer is a 4-bit value.

const (
	SonyUK Manufacturer = iota // Sony UK
	Egoman
	Embest
	SonyJapan // Sony Japan
	// Embest2 is the same as Embest, if the docs can be believed.
	Embest2 // Embest
	Stadium
)

Manufacturer constants.

func (Manufacturer) String

func (i Manufacturer) String() string

type Model

type Model uint8

Model is an 8-bit value.

const (
	A Model = iota
	B
	APlus // A+
	BPlus // B+
	TwoB  // 2B
	Alpha // Alpha (early prototype)
	CM1

	ThreeB // 3B
	Zero
	CM3

	ZeroW       // Zero W
	ThreeBPlus  // 3B+
	ThreeAPlus  // 3A+
	Internal    // Internal use only
	CM3Plus     // CM3+
	FourB       // 4B
	Zero2W      // Zero 2 W
	FourHundred // 400
	CM4
	CM4S
)

Model constants.

func (Model) String

func (i Model) String() string

type Processor

type Processor uint8

Processor is a 4-bit value.

const (
	BCM2835 Processor = iota
	BCM2836
	BCM2837
	BCM2711
)

Processor type constants.

func (Processor) String

func (i Processor) String() string

Directories

Path Synopsis
Package bits does the low (bit-)level parsing and assembly of new-style Raspberry Pi revision codes.
Package bits does the low (bit-)level parsing and assembly of new-style Raspberry Pi revision codes.
cmd
internal
print
Package print implements utilities to pretty-print Raspberry Pi revision code info structures.
Package print implements utilities to pretty-print Raspberry Pi revision code info structures.
Package legacy describes Raspberry Pi old-style revision codes.
Package legacy describes Raspberry Pi old-style revision codes.

Jump to

Keyboard shortcuts

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