Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix including "Arduino.h" from C files#163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

guberti
Copy link
Contributor

Consider the following sketch, to be run on the Portenta H7. We have aproject.ino file with the following:

#include"extra.c"voidsetup() {}voidloop() {blink();}

We also have anextra.c file in the sketch folder with the following:

#include"Arduino.h"voidblink() {digitalWrite(LED_BUILTIN,HIGH);delay(250);digitalWrite(LED_BUILTIN,LOW);delay(250);}

You candownload the zipped sketch here.


This is a valid sketch, and it compiles on most boards (the Arduino Uno, the Nano 33 BLE, the Arduino Due, etc). On the Portenta, however, we get the following error:

In file included from /home/guberti/.arduino15/packages/arduino/hardware/mbed_portenta/3.1.1/variants/PORTENTA_H7_M7/pinmode_arduino.h:30:0,                 from /home/guberti/.arduino15/packages/arduino/hardware/mbed_portenta/3.1.1/cores/arduino/Arduino.h:26,                 from /home/guberti/Arduino/demo-portenta-issue/extra.c:1:/home/guberti/.arduino15/packages/arduino/hardware/mbed_portenta/3.1.1/cores/arduino/api/Common.h:76:9: error: unknown type name 'bool' typedef bool      boolean;         ^~~~exit status 1Error compiling for board Arduino Portenta H7 (M7 core).

This occurs because we do not includestdbool.h. We could fix the issue by removing thetypedef bool boolean; (it is not used, and the comment suggests someone has been considering it for a while), but just adding the include seems safer.

This PR fixes the issue by adding#include <stdbool.h> at the top ofapi/Common.h.

@codecov-commenter
Copy link

Codecov Report

Merging#163 (3a6537e) intomaster (e03b653) willnot change coverage.
The diff coverage isn/a.

@@           Coverage Diff           @@##           master     #163   +/-   ##=======================================  Coverage   96.00%   96.00%           =======================================  Files          13       13             Lines         827      827           =======================================  Hits          794      794             Misses         33       33
Impacted FilesCoverage Δ
api/Common.h100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last updatee03b653...3a6537e. Read thecomment docs.

@guberti
Copy link
ContributorAuthor

Would love a look from@facchinm!

@facchinm
Copy link
Member

LGTM! Thanks for the patch 😉

guberti reacted with thumbs up emoji

@facchinmfacchinm merged commit5f107eb intoarduino:masterJun 15, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@guberti@codecov-commenter@facchinm

[8]ページ先頭

©2009-2025 Movatter.jp