Fix: double strobe
This commit is contained in:
@ -152,8 +152,10 @@ func (d *mt12232a) readByte(cd, cs rpio.State) (byte, error) {
|
||||
|
||||
// Wait, checking status byte
|
||||
func (d *mt12232a) waitReady(cs rpio.State) error {
|
||||
d.pinCS.Write(cs) // Select cristals
|
||||
return d.dev.WaitReady()
|
||||
// d.pinCS.Write(cs) // Select cristals
|
||||
// return d.dev.WaitReady()
|
||||
time.Sleep(time.Microsecond)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *mt12232a) ReadStatus(cs rpio.State) byte {
|
||||
|
@ -9,10 +9,10 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
adressWriteTimeout = 5000 * time.Nanosecond // 40
|
||||
dataStrobeTimeout = 2000 * time.Nanosecond // (Data transfer) 160
|
||||
dataReadTimeout = 4000 * time.Nanosecond // 300
|
||||
gapTimeout = 20000 * time.Nanosecond // TIM // 2000
|
||||
adressWriteTimeout = 50 * time.Nanosecond // 40
|
||||
dataStrobeTimeout = 200 * time.Nanosecond // (Data transfer) 160
|
||||
dataReadTimeout = 400 * time.Nanosecond // 300
|
||||
gapTimeout = 2000 * time.Nanosecond // TIM // 2000
|
||||
maxWaitCycles = 100
|
||||
)
|
||||
|
||||
@ -102,8 +102,8 @@ func (d *device) WriteByte(b byte, cd rpio.State) {
|
||||
time.Sleep(dataStrobeTimeout)
|
||||
d.PinE.High() // Strobe end
|
||||
|
||||
// time.Sleep(time.Millisecond - dataStrobeTimeout - adressWriteTimeout)
|
||||
time.Sleep(time.Millisecond)
|
||||
time.Sleep(gapTimeout - dataStrobeTimeout - adressWriteTimeout)
|
||||
//time.Sleep(time.Millisecond)
|
||||
}
|
||||
|
||||
func (d *device) WriteBytes(b []byte, cd rpio.State) {
|
||||
@ -131,7 +131,6 @@ func (d *device) WriteBytes(b []byte, cd rpio.State) {
|
||||
d.PinE.High() // Strobe end
|
||||
|
||||
time.Sleep(gapTimeout - dataStrobeTimeout - adressWriteTimeout)
|
||||
//time.Sleep(time.Millisecond)
|
||||
}
|
||||
|
||||
func (d *device) ReadByte(cd rpio.State) byte {
|
||||
@ -204,9 +203,9 @@ func (d *device) WaitReady() error {
|
||||
|
||||
// Set bus Pins to output
|
||||
func (d *device) busOutput() {
|
||||
// if d.isBusOutput {
|
||||
// return
|
||||
// }
|
||||
if d.isBusOutput {
|
||||
return
|
||||
}
|
||||
d.PinDB0.Output()
|
||||
d.PinDB1.Output()
|
||||
d.PinDB2.Output()
|
||||
@ -219,9 +218,9 @@ func (d *device) busOutput() {
|
||||
}
|
||||
|
||||
func (d *device) busInput() {
|
||||
//if !d.isBusOutput {
|
||||
// return
|
||||
//}
|
||||
if !d.isBusOutput {
|
||||
return
|
||||
}
|
||||
d.PinDB0.Input()
|
||||
d.PinDB1.Input()
|
||||
d.PinDB2.Input()
|
||||
|
Reference in New Issue
Block a user