Skip to content

Commit

Permalink
Added pulseIn to the list of functions that can be called via Hosted …
Browse files Browse the repository at this point in the history
…RPC. (#2338)
  • Loading branch information
slaff committed Sep 27, 2021
1 parent 383e8b5 commit 59252c3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
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

0 comments on commit 59252c3

Please sign in to comment.