Skip to content
Snippets Groups Projects
Commit 46e1f266 authored by Damien George's avatar Damien George
Browse files

stmhal, usrsw: Update comments for new switch API.

parent 6125ba4a
Branches
No related tags found
No related merge requests found
...@@ -14,19 +14,15 @@ ...@@ -14,19 +14,15 @@
// Usage Model: // Usage Model:
// //
// pyb.switch() returns True if the user switch is pressed, False otherwise. // sw = pyb.Switch() # create a switch object
// // sw() # get state (True if pressed, False otherwise)
// pyb.switch(callback) will register a callback to be called when the user // sw.callback(f) # register a callback to be called when the
// switch is pressed. // # switch is pressed down
// // sw.callback(None) # remove the callback
// pyb.switch(None) will remove the callback.
// //
// Example: // Example:
// //
// def switch_pressed(): // pyb.Switch().callback(lambda: pyb.LED(1).toggle())
// print("User Switch pressed")
//
// pyb.switch(switch_pressed)
// this function inits the switch GPIO so that it can be used // this function inits the switch GPIO so that it can be used
void switch_init0(void) { void switch_init0(void) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment