...
open
<mode> <events> <single> <pol> <cmp> <clrCmp> <capGate> <clrGate>
- opens the timerlptimer device. The device must be opened before enabling/disabling Arguments are:mode
- one of the modes external clock, count single edge, count both edges, or count while polarity (i.e. pulse width) defined indnmdn_lptimer.h
. External mode should be used for high frequency (> 16 KHz) clocks.events
- a bitmask of which events will generate notifications (compare, overflow, capture)single
- use as a one-shot timer (1) or normal recurring timer (0)pol
- set the polarity, i.e. clock on rising (1) edge / high level, or falling (0) edges / low level, depending onmode
cmp
- compare value - note . Note that in the 1.4.1 stack library, this the value passed in the open function is not used and must be set separatelyclrCmp
- if 1, clears the lptimer value when a compare value is reached, i.e. count up to the compare valuecapGate
- if 1, capture the counter when the corresponding gate event occursclrGate
- if 1, clears the counter when the corresponding gate event occurs
close
- closes the lptimer device. Closing and re-opening the lptimer device is required for configuration changes other than the compare value to take effect.enable
- enables the lptimer inputdisable
- disables the lptimer inputset
- sets the compare value. A notification will be generated if the corresponding event is enabled. Note Note that while the registers are 32-bits wide, the lptimer is a 16-bit timer - in . In revisions of the stack library >= 1.4.2, setting compare > 65535 will result in an error.getcap
- gets the value of the capture register when a gate event occurs (for pulse width timing when capGate=1).getcount
- gets the current value of the lptimer counter register
...
No Format |
---|
Low Power Timer app, ver 1.2.0.1 SmartMeshIP stack, ver 1.4.1.6 > open Usage: open <mode> <events> <single> <pol> <cmp> <clrCmp> <capGate> <clrGate> > open 0 0x7 0 0 12345 1 0 0 > set 12345 Compare: 12345 > enable >enable> disable >disable > >closeclose |
Once configured, the application will print notifications for each configured event, e.g.
...
Important points:
- Opening the lptimer device more than once will generate an error
- Closing the lptimer device more than once will generate an error
...
The 02-lptimer
sample application uses the Helper Modules to initialize the CLI Module and for interaction with the local interface. It passes JOIN_NO
in the fJoin
flag when initializing the local module in the loc_task_init()
to prevent the local module from attempting to join. It has one lptimerTask
application tasks task that installs event handlers for the various possible capture/compare events, and prints them on the CLI continuously as they occur. The application relies on CLI commands to otherwise drive the PWM application to demonstrate its features.
...
lptimer features.