Skip to content

Use templating for generated files#39

Merged
JamesH65 merged 8 commits intoraspberrypi:masterfrom
matiasilva:use-templates
Sep 2, 2021
Merged

Use templating for generated files#39
JamesH65 merged 8 commits intoraspberrypi:masterfrom
matiasilva:use-templates

Conversation

@matiasilva
Copy link
Copy Markdown

This PR adds templating for the various generated files, allowing us to separate logic from text formatting. It pulls out a considerable amount of strings and text into files. This makes the main code a lot cleaner and readable. It also means we can easily extend the project generator to do many more things if needed.

@JamesH65
Copy link
Copy Markdown
Contributor

JamesH65 commented Aug 2, 2021

That looks much better - nice one. The problem with this being my first Python program is you simply don't know what libraries exist to help you out!

// This example will use I2C0 on GPIO8 (SDA) and GPIO9 (SCL) running at 400KHz.
// Pins can be changed, see the GPIO function select table in the datasheet for information on GPIO assignments
#define I2C_PORT i2c0
#define I2C_SDA 8
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kilograham I think this project-generator was created before we added the "board headers" to the Raspberry Pi Pico SDK. Should we now update the pin-numbers used here (for the various interfaces) to match up with https://github.com/raspberrypi/pico-sdk/blob/master/src/boards/include/boards/pico.h ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be a separate issue.

@matiasilva matiasilva marked this pull request as ready for review August 3, 2021 14:51
@matiasilva
Copy link
Copy Markdown
Author

There's quite a large diff in the main Python file, mostly owing to large blocks of text being removed but also due to applying autopep8 (https://www.python.org/dev/peps/pep-0008/).

@JamesH65
Copy link
Copy Markdown
Contributor

JamesH65 commented Aug 3, 2021

Might be worth applying autopep8 first on a new branch, to keep whitespace and technical changes separate - makes doing a review diff difficult if they are mixed together.

@matiasilva
Copy link
Copy Markdown
Author

Might be worth applying autopep8 first on a new branch, to keep whitespace and technical changes separate - makes doing a review diff difficult if they are mixed together.

Yes, good idea. See #40.

@JamesH65 JamesH65 merged commit 4aefc2d into raspberrypi:master Sep 2, 2021
@lurch lurch mentioned this pull request Sep 2, 2021
@JamesH65
Copy link
Copy Markdown
Contributor

JamesH65 commented Sep 3, 2021

Going to have to revert this as found a load of problems.

JamesH65 added a commit that referenced this pull request Sep 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants