@@ -45,9 +45,9 @@ var targetsKnownToSkip = map[string]struct{}{"atmega1284p": {}, "attiny1616": {}
45
45
var targetsKnownToSkipAndShouldBeDocumented = map [string ]struct {}{"bluemicro840" : {}, "esp32-c3-devkit-rust-1" : {},
46
46
"feather-m0-express" : {}}
47
47
48
- // TODO: fix wrong matrix output
49
48
// TODO: revert unneeded adjustments in mcu pages (e.g. link text)
50
- func Execute (targets []string ) {
49
+ // TODO: support parameters: machine doc, pins table, interfaces table, hw matrix
50
+ func Execute (targets []string , createMachineDoc , updateBoardInterfaces , updateBoardPins , createHardwareMatrix bool ) {
51
51
// collect
52
52
collector := collectFiles (targets )
53
53
@@ -62,21 +62,24 @@ func Execute(targets []string) {
62
62
if co .docStatus == canProcessed {
63
63
fmt .Println (" Generating documentation..." )
64
64
machineDocPath := filepath .Join (controllerDocBaseDir , "machine" , target + ".md" )
65
- if err := updateMicrocontrollerDocumentation (target , machineDocPath , co .controllerDocPath ); err != nil {
65
+ if err := updateMicrocontrollerDocumentation (target , machineDocPath , co .controllerDocPath ,
66
+ createMachineDoc , updateBoardInterfaces , updateBoardPins ); err != nil {
66
67
fmt .Fprintln (os .Stderr , " skipping: because error\t \t " , err )
67
68
co .errors = append (co .errors , err )
68
69
}
69
70
}
70
71
71
- fmt .Println (" Prepare hardware matrix..." )
72
- matrixRow , err := hardwarematrix .ParseFeatureMap (co .controllerDocPath )
73
- if err != nil {
74
- fmt .Fprintln (os .Stderr , " skipping: because error\t \t " , err )
75
- co .errors = append (co .errors , err )
76
- continue
77
- }
72
+ if createHardwareMatrix {
73
+ fmt .Println (" Prepare hardware matrix..." )
74
+ matrixRow , err := hardwarematrix .ParseFeatureMap (co .controllerDocPath )
75
+ if err != nil {
76
+ fmt .Fprintln (os .Stderr , " skipping: because error\t \t " , err )
77
+ co .errors = append (co .errors , err )
78
+ continue
79
+ }
78
80
79
- co .matrixRow = matrixRow
81
+ co .matrixRow = matrixRow
82
+ }
80
83
81
84
if co .docStatus == documentFound {
82
85
co .docStatus = finishedWithoutTargetOk
@@ -85,10 +88,12 @@ func Execute(targets []string) {
85
88
co .docStatus = finishedOk
86
89
}
87
90
88
- fmt .Println ("\n Update hardware matrix..." )
89
- hwmatrixDocPath := filepath .Join (".." , "content" , "docs" , "reference" , "hardware-matrix.md" )
90
- if err := updateHardwareMatrix (hwmatrixDocPath , collector ); err != nil {
91
- fmt .Fprintln (os .Stderr , " skipping: because error\t \t " , err )
91
+ if createHardwareMatrix {
92
+ fmt .Println ("\n Update hardware matrix..." )
93
+ hwmatrixDocPath := filepath .Join (".." , "content" , "docs" , "reference" , "hardware-matrix.md" )
94
+ if err := updateHardwareMatrix (hwmatrixDocPath , collector ); err != nil {
95
+ fmt .Fprintln (os .Stderr , " skipping: because error\t \t " , err )
96
+ }
92
97
}
93
98
94
99
// summary
@@ -201,18 +206,21 @@ func collectFiles(targets []string) map[string]*collection {
201
206
return collector
202
207
}
203
208
204
- func updateMicrocontrollerDocumentation (target , machineDocPath , controllerDocPath string ) error {
209
+ func updateMicrocontrollerDocumentation (target , machineDocPath , controllerDocPath string ,
210
+ createMachineDoc , updateBoardInterfaces , updateBoardPins bool ) error {
205
211
ti , err := targetinfo .Create (target )
206
212
if err != nil {
207
213
return fmt .Errorf ("target info can not be created: %v" , err )
208
214
}
209
215
210
- err = machinepackagedoc .CreateNew (machineDocPath , target , ti .Pkg )
211
- if err != nil {
212
- return fmt .Errorf ("error on write machine package doc: %v" , err )
216
+ if createMachineDoc {
217
+ err = machinepackagedoc .CreateNew (machineDocPath , target , ti .Pkg )
218
+ if err != nil {
219
+ return fmt .Errorf ("error on write machine package doc: %v" , err )
220
+ }
213
221
}
214
222
215
- errors := boarddoc .Update (controllerDocPath , ti )
223
+ errors := boarddoc .Update (controllerDocPath , ti , updateBoardInterfaces , updateBoardPins )
216
224
if len (errors ) > 0 {
217
225
return fmt .Errorf ("error on update board documentation: %v" , errors )
218
226
}
0 commit comments