Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added pulseIn to the list of functions … #2338

Merged
merged 1 commit into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Sming/Components/Hosted-Lib/src/Digital.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@ uint8_t digitalRead(uint16_t pin)
hostedClient->send(__func__, pin);
return hostedClient->wait<uint8_t>();
}

unsigned long pulseIn(uint16_t pin, uint8_t state, unsigned long timeout)
{
hostedClient->send(__func__, pin, state, timeout);
return hostedClient->wait<unsigned long>();
}
4 changes: 3 additions & 1 deletion Sming/Components/Hosted/samples/serial/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ void init()
* - pinMode
* - digitalRead
* - digitalWrite
* - pulseIn
* You can add more commands here. For every command you should specify command and text description in the format below.
* For more information read the SimpleRPC interface API: https://simplerpc.readthedocs.io/en/latest/api/interface.html
*/
pinMode, F("pinMode: Sets mode of digital pin. @pin: Pin number, @mode: Mode type."),
digitalRead, F("digitalRead: Read digital pin. @pin: Pin number. @return: Pin value."),
digitalWrite, F("digitalWrite: Write to a digital pin. @pin: Pin number. @value: Pin value.")
digitalWrite, F("digitalWrite: Write to a digital pin. @pin: Pin number. @value: Pin value."),
pulseIn, F("pulseIn: Measure duration of pulse on pin. @pin: Pin number. @state: State of pulse to measure. @timeout: Maximum duration of pulse. @return: Pulse duration in microseconds)")
);
// clang-format on

Expand Down
4 changes: 3 additions & 1 deletion Sming/Components/Hosted/samples/tcp/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ void connectOk(IpAddress ip, IpAddress mask, IpAddress gateway)
* - pinMode
* - digitalRead
* - digitalWrite
* - pulseIn
* You can add more commands here. For every command you should specify command and text description in the format below.
* For more information read the SimpleRPC interface API: https://simplerpc.readthedocs.io/en/latest/api/interface.html
*/
pinMode, F("pinMode: Sets mode of digital pin. @pin: Pin number, @mode: Mode type."),
digitalRead, F("digitalRead: Read digital pin. @pin: Pin number. @return: Pin value."),
digitalWrite, F("digitalWrite: Write to a digital pin. @pin: Pin number. @value: Pin value.")
digitalWrite, F("digitalWrite: Write to a digital pin. @pin: Pin number. @value: Pin value."),
pulseIn, F("pulseIn: Measure duration of pulse on pin. @pin: Pin number. @state: State of pulse to measure. @timeout: Maximum duration of pulse. @return: Pulse duration in microseconds)")
);
// clang-format on

Expand Down