Fix issues found by misspell, gofmt -s -w, golint and go vet; add badges

- There were several typos
- Simplified a few simplified statements
- Added doc for a few exported symbols
- Fix incorrect printf usage
pull/1/head
Marc-Antoine Ruel 9 years ago
parent 9031234a9b
commit c9298db3b0

@ -2,6 +2,10 @@
Documentation is at https://periph.io Documentation is at https://periph.io
[![GoDoc](https://godoc.org/periph.io/x/periph?status.svg)](https://godoc.org/periph.io/x/periph)
[![Go Report
Card](https://goreportcard.com/badge/periph.io/x/periph)](https://goreportcard.com/report/periph.io/x/periph)
## Sample ## Sample

@ -306,7 +306,7 @@ func (d *Dev) writeCommands(b []byte) error {
// 0xE0 Reset by writing 0xB6 to it // 0xE0 Reset by writing 0xB6 to it
// 0xE1..0xF0 Calibration data // 0xE1..0xF0 Calibration data
// 0xF1 -- // 0xF1 --
// 0xF2 ctrl_hum; ctrl_meas must be writen to after for change to this register to take effect // 0xF2 ctrl_hum; ctrl_meas must be written to after for change to this register to take effect
// 0xF3 status // 0xF3 status
// 0xF4 ctrl_meas // 0xF4 ctrl_meas
// 0xF5 config // 0xF5 config

@ -35,7 +35,7 @@ func New() (*Conn, error) {
return nil, err return nil, err
} }
c := &Conn{w: w, c: make(chan ir.Message), list: map[string][]string{}} c := &Conn{w: w, c: make(chan ir.Message), list: map[string][]string{}}
// Inconditionally retrieve the list of all known keys at start. // Unconditionally retrieve the list of all known keys at start.
if _, err := w.Write([]byte("LIST\n")); err != nil { if _, err := w.Write([]byte("LIST\n")); err != nil {
w.Close() w.Close()
return nil, err return nil, err

@ -20,7 +20,7 @@ import (
"periph.io/x/periph/host/cpu" "periph.io/x/periph/host/cpu"
) )
// Use SkipAddr to skip the address from being sent. // SkipAddr can be used to skip the address from being sent.
const SkipAddr uint16 = 0xFFFF const SkipAddr uint16 = 0xFFFF
// I2C represents an I²C master implemented as bit-banging on 2 GPIO pins. // I2C represents an I²C master implemented as bit-banging on 2 GPIO pins.
@ -53,7 +53,7 @@ func (i *I2C) Tx(addr uint16, w, r []byte) error {
if addr != SkipAddr { if addr != SkipAddr {
if addr > 0xFF { if addr > 0xFF {
// Page 15, section 3.1.11 10-bit addressing // Page 15, section 3.1.11 10-bit addressing
// TOOD(maruel): Implement if desired; prefix 0b11110xx. // TODO(maruel): Implement if desired; prefix 0b11110xx.
return errors.New("bitbang-i2c: invalid address") return errors.New("bitbang-i2c: invalid address")
} }
// Page 13, section 3.1.10 The slave address and R/W bit // Page 13, section 3.1.10 The slave address and R/W bit

@ -72,7 +72,7 @@ func (d *Dev) Tx(w, r []byte, power onewire.Pullup) error {
} }
// Read bytes from one-wire bus. // Read bytes from one-wire bus.
for i, _ := range r { for i := range r {
if power == onewire.StrongPullup && i == len(r)-1 { if power == onewire.StrongPullup && i == len(r)-1 {
// This is the last byte, need to activate strong-pull-up // This is the last byte, need to activate strong-pull-up
d.i2cTx([]byte{cmdWriteConfig, d.confReg&0xbf | 0x4}, nil) d.i2cTx([]byte{cmdWriteConfig, d.confReg&0xbf | 0x4}, nil)

@ -24,8 +24,10 @@ import (
type PupOhm uint8 type PupOhm uint8
const ( const (
R500Ω = 4 // 500Ω passive pull-up resistor // R500Ω passive pull-up resistor.
R1000Ω = 6 // 1000Ω passive pull-up resistor R500Ω = 4
// R1000Ω passive pull-up resistor.
R1000Ω = 6
) )
// Opts contains options to pass to the constructor. // Opts contains options to pass to the constructor.

Loading…
Cancel
Save