mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-18 13:43:58 +00:00
Error strings should not be capitalized (unless beginning with proper
nouns or acronyms) or end with punctuation, since they are usually printed following other context.
This commit is contained in:
committed by
Ron Evans
parent
8534e67c83
commit
cb49783f18
+2
-2
@@ -74,7 +74,7 @@ func (d *Device) Seek(offset int64, whence int) (int64, error) {
|
|||||||
case 2:
|
case 2:
|
||||||
whence = SRAMEndAddress
|
whence = SRAMEndAddress
|
||||||
default:
|
default:
|
||||||
return 0, errors.New("Invalid starting point")
|
return 0, errors.New("invalid starting point")
|
||||||
}
|
}
|
||||||
d.AddressSRAM = uint8(whence) + uint8(offset)
|
d.AddressSRAM = uint8(whence) + uint8(offset)
|
||||||
if d.AddressSRAM > SRAMEndAddress {
|
if d.AddressSRAM > SRAMEndAddress {
|
||||||
@@ -87,7 +87,7 @@ func (d *Device) Seek(offset int64, whence int) (int64, error) {
|
|||||||
// returns number of bytes written and error, if any
|
// returns number of bytes written and error, if any
|
||||||
func (d *Device) Write(data []byte) (n int, err error) {
|
func (d *Device) Write(data []byte) (n int, err error) {
|
||||||
if int(d.AddressSRAM)+len(data)-1 > SRAMEndAddress {
|
if int(d.AddressSRAM)+len(data)-1 > SRAMEndAddress {
|
||||||
return 0, errors.New("Writing outside of SRAM")
|
return 0, errors.New("writing outside of SRAM")
|
||||||
}
|
}
|
||||||
buffer := make([]byte, len(data)+1)
|
buffer := make([]byte, len(data)+1)
|
||||||
buffer[0] = d.AddressSRAM
|
buffer[0] = d.AddressSRAM
|
||||||
|
|||||||
+1
-1
@@ -49,5 +49,5 @@ func sendCommand(gpsDevice GPSDevice, command []byte) (err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return errors.New("No ACK to GPS command")
|
return errors.New("no ACK to GPS command")
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -87,7 +87,7 @@ func (g *GPIO) write4BitMode(data byte) {
|
|||||||
// Ram address can be changed by writing address in command mode
|
// Ram address can be changed by writing address in command mode
|
||||||
func (g *GPIO) Read(data []byte) (n int, err error) {
|
func (g *GPIO) Read(data []byte) (n int, err error) {
|
||||||
if len(data) == 0 {
|
if len(data) == 0 {
|
||||||
return 0, errors.New("Length greater than 0 is required")
|
return 0, errors.New("length greater than 0 is required")
|
||||||
}
|
}
|
||||||
g.rw.High()
|
g.rw.High()
|
||||||
g.reconfigureGPIOMode(machine.PinInput)
|
g.reconfigureGPIOMode(machine.PinInput)
|
||||||
|
|||||||
+1
-1
@@ -66,7 +66,7 @@ func (d *Device) Configure(cfg Config) error {
|
|||||||
d.width = uint8(cfg.Width)
|
d.width = uint8(cfg.Width)
|
||||||
d.height = uint8(cfg.Height)
|
d.height = uint8(cfg.Height)
|
||||||
if d.width == 0 || d.height == 0 {
|
if d.width == 0 || d.height == 0 {
|
||||||
return errors.New("Width and height must be set")
|
return errors.New("width and height must be set")
|
||||||
}
|
}
|
||||||
memoryMap := uint8(ONE_LINE)
|
memoryMap := uint8(ONE_LINE)
|
||||||
if d.height > 1 {
|
if d.height > 1 {
|
||||||
|
|||||||
+1
-1
@@ -127,7 +127,7 @@ func (d *Device) GetPixel(x int16, y int16) bool {
|
|||||||
func (d *Device) SetBuffer(buffer []byte) error {
|
func (d *Device) SetBuffer(buffer []byte) error {
|
||||||
if int16(len(buffer)) != d.bufferSize {
|
if int16(len(buffer)) != d.bufferSize {
|
||||||
//return ErrBuffer
|
//return ErrBuffer
|
||||||
return errors.New("Wrong size buffer")
|
return errors.New("wrong size buffer")
|
||||||
}
|
}
|
||||||
for i := int16(0); i < d.bufferSize; i++ {
|
for i := int16(0); i < d.bufferSize; i++ {
|
||||||
d.buffer[i] = buffer[i]
|
d.buffer[i] = buffer[i]
|
||||||
|
|||||||
+1
-1
@@ -219,7 +219,7 @@ func (d *Device) GetPixel(x int16, y int16) bool {
|
|||||||
func (d *Device) SetBuffer(buffer []byte) error {
|
func (d *Device) SetBuffer(buffer []byte) error {
|
||||||
if int16(len(buffer)) != d.bufferSize {
|
if int16(len(buffer)) != d.bufferSize {
|
||||||
//return ErrBuffer
|
//return ErrBuffer
|
||||||
return errors.New("Wrong size buffer")
|
return errors.New("wrong size buffer")
|
||||||
}
|
}
|
||||||
for i := int16(0); i < d.bufferSize; i++ {
|
for i := int16(0); i < d.bufferSize; i++ {
|
||||||
d.buffer[i] = buffer[i]
|
d.buffer[i] = buffer[i]
|
||||||
|
|||||||
Reference in New Issue
Block a user