Skip to content
This repository was archived by the owner on Oct 26, 2025. It is now read-only.

[SOFT-999] Completed Firmware 102 homework, request for code review - #488

Open
nehemiah-negussie wants to merge 2 commits into
masterfrom
soft_999_nehemiah_negussie_fw_102
Open

[SOFT-999] Completed Firmware 102 homework, request for code review#488
nehemiah-negussie wants to merge 2 commits into
masterfrom
soft_999_nehemiah_negussie_fw_102

Conversation

@nehemiah-negussie

Copy link
Copy Markdown

First test commit.

@nehemiah-negussie nehemiah-negussie changed the title Completed Firmware 102 homework, request for code review [SOFT-999] Completed Firmware 102 homework, request for code review Jan 22, 2022

@mitchellostler mitchellostler left a comment

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.

Looks really well done! There is a simpler design however, that uses only one timer callback function. See if you can figure it out, but if not feel free to ask for help

uint8_t counter_b;
} Counters;

void prv_timer_callback_2(SoftTimerId timer_id, void *context);

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.

Don't worry about forward declaring your functions, just declare them where you write the function bodies.
This line can go


void prv_timer_callback_2(SoftTimerId timer_id, void *context);

void prv_timer_callback(SoftTimerId timer_id, void *context) {

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.

You can (and should) do all the soft-timer functionality in one timer callback function instead of 2, see if you can figure it out, but if not feel free to ask for help 🙂

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.

Additionally, all private functions in a file should be declared as static, ie static void prv_*

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants