Skip to content

Commit f6a96b4

Browse files
committed
examples/fatfs: adding machine.Flash example
Signed-off-by: deadprogram <ron@hybridgroup.com>
1 parent acb50e5 commit f6a96b4

File tree

1 file changed

+25
-0
lines changed
  • examples/console/fatfs/machine

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//go:build tinygo
2+
// +build tinygo
3+
4+
package main
5+
6+
import (
7+
"machine"
8+
9+
"tinygo.org/x/tinyfs/examples/console"
10+
"tinygo.org/x/tinyfs/fatfs"
11+
)
12+
13+
var (
14+
blockDevice = machine.Flash
15+
filesystem = fatfs.New(blockDevice)
16+
)
17+
18+
func main() {
19+
// Configure FATFS with sector size (must match value in ff.h - use 512)
20+
filesystem.Configure(&fatfs.Config{
21+
SectorSize: 512,
22+
})
23+
24+
console.RunFor(blockDevice, filesystem)
25+
}

0 commit comments

Comments
 (0)