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

Modification of ArduinoCore-avr to use API#329

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
giulcioffi wants to merge7 commits intoarduino:master
base:master
Choose a base branch
Loading
fromgiulcioffi:namespaced_api_rebased_master

Conversation

@giulcioffi
Copy link

@giulcioffigiulcioffi commentedApr 10, 2020
edited
Loading

The following proposed modifications are intended to port the API to the AVR boards:

  1. rename the "HardwareSerial" classes (from the API) with "UART" (from ArduinoCore-avr);
  2. remove functions/definitions from several files in ArduinoCore-avr, since they are already implemented/defined by the API.
    Files modified:
    • "Arduino.h" : it now includes "api/ArduinoAPI.h" and "api/Common.h"
    • "WMath.cpp": few functionalities are already implemented by "api/Common*"
      Files deleted, because included in the API:
    • "Client.h"
    • "IPAddress*"
    • "Print"
    • "Server.h"
    • "Stream*"
    • "Udp.h"
    • "WCharacter.h"
    • "WString*"
    • "binary.h"
  3. port USB, SPI and Wire into API: for all of them types u8/u32 have been replaced with standard types;
  4. the digital* APIs have been adapted;
  5. modification of compile recipes (in "platform.txt") to add the API folder.

Copy link
Contributor

@bxparksbxparks left a comment

Choose a reason for hiding this comment

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

Some drive-by comments, because I was curious to see what this was about...

// Public Methods //////////////////////////////////////////////////////////////

voidHardwareSerial::begin(unsignedlong baud,byte config)
voidUartClass::begin(unsignedlong baud,uint16_t config)
Copy link
Contributor

Choose a reason for hiding this comment

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

Theconfig is later assigned to a*_ucsrc which is declared as auint8_t in UART.h. Was this change intentional?

Copy link
Member

Choose a reason for hiding this comment

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

This is due tohttps://github.com/arduino/ArduinoCore-API/blob/master/api/HardwareSerial.h#L91 , so the signature must beuint16_t .
Said that, I'll push a commit to fix this by casting the assignment
*_ucsrc = (uint8_t)config; (since we are assured that config fits an uint8_t)


#include"Stream.h"
#if ARDUINO_API_VERSION > 10000
usingnamespacearduino;
Copy link
Contributor

@bxparksbxparksApr 11, 2020
edited
Loading

Choose a reason for hiding this comment

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

Maybe add a comment to explain why thisusing namespace statement is needed. It us contrary to the usual recommendation of avoidingusing namespace in a C++ header file:https://stackoverflow.com/questions/5849457/using-namespace-in-c-headers

volatileuint8_t *ucsrc,volatileuint8_t *udr);
voidbegin(unsignedlong baud) {begin(baud, SERIAL_8N1); }
voidbegin(unsignedlong,uint8_t);
voidbegin(unsignedlong,uint16_t);
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to above, it's not clear why this was changed to auint16_t, when theconfig is later assigned only to auint8_t.

@Tnthr
Copy link

Has there been any further discussion on this? Or generally bringing the AVR core into the API? forum or mailing list perhaps?

Thanks

davidkennedydev reacted with thumbs up emoji

@davidkennedydev
Copy link

Will Arduino eventually have a standard API for different boards? What is the status in 2025?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@facchinmfacchinmfacchinm left review comments

+1 more reviewer

@bxparksbxparksbxparks left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

6 participants

@giulcioffi@Tnthr@davidkennedydev@facchinm@bxparks@per1234

[8]ページ先頭

©2009-2025 Movatter.jp