1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
diff --git a/movement/filesystem.c b/movement/filesystem.c
index 9df0a8d..ac117af 100644
--- a/movement/filesystem.c
+++ b/movement/filesystem.c
@@ -280,3 +280,13 @@ int filesystem_cmd_echo(int argc, char *argv[]) {
return 0;
}
+int filesystem_cmd_format(int argc, char *argv[]) {
+ (void) argc;
+ (void) argv;
+
+ lfs_unmount(&lfs);
+ lfs_format(&lfs, &cfg);
+ lfs_mount(&lfs, &cfg);
+
+ return 0;
+}
diff --git a/movement/filesystem.h b/movement/filesystem.h
index fa3d9d1..ee13cba 100644
--- a/movement/filesystem.h
+++ b/movement/filesystem.h
@@ -101,5 +101,6 @@ int filesystem_cmd_cat(int argc, char *argv[]);
int filesystem_cmd_df(int argc, char *argv[]);
int filesystem_cmd_rm(int argc, char *argv[]);
int filesystem_cmd_echo(int argc, char *argv[]);
+int filesystem_cmd_format(int argc, char *argv[]);
#endif // FILESYSTEM_H_
diff --git a/movement/shell_cmd_list.c b/movement/shell_cmd_list.c
index 0ea08a5..a5d2d01 100644
--- a/movement/shell_cmd_list.c
+++ b/movement/shell_cmd_list.c
@@ -92,6 +92,13 @@ shell_command_t g_shell_commands[] = {
.max_args = 3,
.cb = filesystem_cmd_echo,
},
+ {
+ .name = "format",
+ .help = "usage: format",
+ .min_args = 0,
+ .max_args = 0,
+ .cb = filesystem_cmd_format,
+ },
{
.name = "stress",
.help = "test CDC write; usage: stress [LEN] [DELAY_MS]",
diff --git a/watch-library/hardware/watch/watch_private_cdc.c b/watch-library/hardware/watch/watch_private_cdc.c
index a961b5e..31e354d 100644
--- a/watch-library/hardware/watch/watch_private_cdc.c
+++ b/watch-library/hardware/watch/watch_private_cdc.c
@@ -145,7 +145,11 @@ static void prv_handle_writes(void) {
prv_handle_reads();
}
if (tud_cdc_write_available()) {
- tud_cdc_write(&s_write_buf[idx], 1);
+ if (s_write_buf[idx]=='\n') {
+ tud_cdc_write("\r\n", 2);
+ } else {
+ tud_cdc_write(&s_write_buf[idx], 1);
+ }
}
s_write_buf[idx] = 0;
s_write_buf_len--;
|