mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-16 04:43:25 +00:00
fix examples/sd/main.go
This commit is contained in:
+1
-2
@@ -48,8 +48,7 @@ func main() {
|
|||||||
cid := sdcard.CID()
|
cid := sdcard.CID()
|
||||||
fmt.Printf("name=%s\ncsd=\n%s\n", cid.ProductName(), csd.String())
|
fmt.Printf("name=%s\ncsd=\n%s\n", cid.ProductName(), csd.String())
|
||||||
|
|
||||||
const placeholderEraseSectorSize = 512
|
bd, err := sd.NewBlockDevice(sdcard, csd.ReadBlockLen(), csd.NumberOfBlocks())
|
||||||
bd, err := sd.NewBlockDevice(sdcard, int(csd.ReadBlockLen()), csd.NumberOfBlocks(), placeholderEraseSectorSize)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic("block device creation:" + err.Error())
|
panic("block device creation:" + err.Error())
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -154,7 +154,7 @@ func (c *CSD) CommandClasses() CommandClasses {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ReadBlockLen returns the Max Read Data Block Length in bytes.
|
// ReadBlockLen returns the Max Read Data Block Length in bytes.
|
||||||
func (c *CSD) ReadBlockLen() int64 { return 1 << c.ReadBlockLenShift() }
|
func (c *CSD) ReadBlockLen() int { return 1 << c.ReadBlockLenShift() }
|
||||||
func (c *CSD) ReadBlockLenShift() uint8 { return c.data[5] & 0x0F }
|
func (c *CSD) ReadBlockLenShift() uint8 { return c.data[5] & 0x0F }
|
||||||
|
|
||||||
// AllowsReadBlockPartial should always return true. Indicates that
|
// AllowsReadBlockPartial should always return true. Indicates that
|
||||||
|
|||||||
Reference in New Issue
Block a user