This library is push button or dipSw noise cancel and on/off edge recognition

Dependents:   led-sound_checker clockGenerator

Fork of DigitalSw by suu pen

Embed: (wiki syntax)

« Back to documentation index

DigitalSw Class Reference

DigitalSw Class Reference

digital switch. More...

#include <DigitalSw.h>

Public Member Functions

 DigitalSw (PinName sw, uint8_t pull=1)
 Create a DigitalSw port, connected to the specified sw pins.
void reset (void)
 Reset the edge and level.
int16_t getLevel (void)
 Get the number of level by the sw.
int16_t getOnEdge (void)
 Get the number of on edge by the sw.
int16_t getOffEdge (void)
 Get the number of off edge by the sw.

Detailed Description

digital switch.

nothine

Definition at line 70 of file DigitalSw.h.


Constructor & Destructor Documentation

DigitalSw ( PinName  sw,
uint8_t  pull = 1 
)

Create a DigitalSw port, connected to the specified sw pins.

digital Sw Library

Parameters:
swpin
(option)Register pull 1:PullUp(default), 0:PullDown
Note:
nothing

Definition at line 10 of file DigitalSw.cpp.


Member Function Documentation

int16_t getLevel ( void   )

Get the number of level by the sw.

Returns:
Number of sw level. 0:Low(off) 1:Hi(on)

Definition at line 39 of file DigitalSw.cpp.

int16_t getOffEdge ( void   )

Get the number of off edge by the sw.

Returns:
Number of sw off edge. 0:no edge, 1:edge

Definition at line 52 of file DigitalSw.cpp.

int16_t getOnEdge ( void   )

Get the number of on edge by the sw.

Returns:
Number of sw on edge. 0:no edge, 1:edge

Definition at line 44 of file DigitalSw.cpp.

void reset ( void   )

Reset the edge and level.

edge = off(0), level = off(0)

Definition at line 31 of file DigitalSw.cpp.