@@ -45,9 +45,9 @@ var targetsKnownToSkip = map[string]struct{}{"atmega1284p": {}, "attiny1616": {}
4545var targetsKnownToSkipAndShouldBeDocumented = map [string ]struct {}{"bluemicro840" : {}, "esp32-c3-devkit-rust-1" : {},
4646 "feather-m0-express" : {}}
4747
48- // TODO: fix wrong matrix output
4948// 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 ) {
5151 // collect
5252 collector := collectFiles (targets )
5353
@@ -62,21 +62,24 @@ func Execute(targets []string) {
6262 if co .docStatus == canProcessed {
6363 fmt .Println (" Generating documentation..." )
6464 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 {
6667 fmt .Fprintln (os .Stderr , " skipping: because error\t \t " , err )
6768 co .errors = append (co .errors , err )
6869 }
6970 }
7071
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+ }
7880
79- co .matrixRow = matrixRow
81+ co .matrixRow = matrixRow
82+ }
8083
8184 if co .docStatus == documentFound {
8285 co .docStatus = finishedWithoutTargetOk
@@ -85,10 +88,12 @@ func Execute(targets []string) {
8588 co .docStatus = finishedOk
8689 }
8790
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+ }
9297 }
9398
9499 // summary
@@ -201,18 +206,21 @@ func collectFiles(targets []string) map[string]*collection {
201206 return collector
202207}
203208
204- func updateMicrocontrollerDocumentation (target , machineDocPath , controllerDocPath string ) error {
209+ func updateMicrocontrollerDocumentation (target , machineDocPath , controllerDocPath string ,
210+ createMachineDoc , updateBoardInterfaces , updateBoardPins bool ) error {
205211 ti , err := targetinfo .Create (target )
206212 if err != nil {
207213 return fmt .Errorf ("target info can not be created: %v" , err )
208214 }
209215
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+ }
213221 }
214222
215- errors := boarddoc .Update (controllerDocPath , ti )
223+ errors := boarddoc .Update (controllerDocPath , ti , updateBoardInterfaces , updateBoardPins )
216224 if len (errors ) > 0 {
217225 return fmt .Errorf ("error on update board documentation: %v" , errors )
218226 }
0 commit comments