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

Add FlashString abstract class#18

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

Open
kezorm wants to merge1 commit intoarduino:master
base:master
Choose a base branch
Loading
fromeClay:FlashString

Conversation

kezorm
Copy link

Add FlashString abstract class to support extension of String and Print methods to core specific program memory implementation. The FlashString abstract class completely eliminates the dependency on the file pgmspace.h. ArduinoCore-API should never include any references to a specific implementation (e.g. AVR).

An example implementation is shown below, tested on a SAMD21 core. I have not had a chance to implement / test on an AVR-based Arduino, but should be easily implemented at avr core level.

classFlashStringTest :publicFlashString{public:FlashStringTest(uintptr_t address): _address(address) {}        StringtoString()const;size_tprintTo(Print& p)const;protected:uintptr_t _address;};StringFlashStringTest::toString()const{returnString((constchar *)_address);}size_tFlashStringTest::printTo(Print& p)const{size_t n =0;constchar* str = (constchar*)_address;while (1) {char c = *str++;if (c ==0)break;if (p.print(c)) n++;elsebreak;  }return n;}#ifdef F#undef F#endif#defineF(string_literal) (FlashStringTest((uintptr_t)(string_literal)))

…nt methods to core specific program memory implementation.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign ourContributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let usrecheck it.

@PaulStoffregen
Copy link

Is your intention to break all libraries which have used __FlashStringHelper?

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
@kezorm@CLAassistant@PaulStoffregen

[8]ページ先頭

©2009-2025 Movatter.jp