Skip to content

Commit

Permalink
Add docs for comparator event
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Nov 15, 2024
1 parent ad27875 commit 9ea61f0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/jswrap_espruino.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,17 @@ void jswrap_espruino_kickWatchdog() {
jshKickWatchDog();
}

/*JSON{
"type" : "event",
"#if" : "defined(NRF52) && !defined(SAVE_ON_FLASH)",
"class" : "E",
"name" : "comparator",
"params" : [
["dir","int","The direction of the pin's state change"]
]
}
Called when a bit rises or falls above a set level. See `E.setComparator` for setup.
*/
/*JSON{
"type" : "staticmethod",
"#if" : "defined(NRF52) && !defined(SAVE_ON_FLASH)",
Expand All @@ -696,7 +707,7 @@ void jswrap_espruino_kickWatchdog() {
]
}
(Added 2v25) Enable the nRF52 chip's `LPCOMP` hardware. When enabled, it creates an `E.on("comparator", ...)`
event whenever the pin supplied rises or falls past the setpoint given.
event whenever the pin supplied rises or falls past the setpoint given (with 50mv hysteresis).
```JS
E.setComparator(D28, 8/16); // compare with VDD/2
Expand Down

0 comments on commit 9ea61f0

Please sign in to comment.