mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
Merge pull request #30811 from erikma/dev/erikma/pigpio120
Update pigpio types to include changes up to version 1.2.0
This commit is contained in:
Vendored
+26
-2
@@ -1,6 +1,6 @@
|
||||
// Type definitions for pigpio 0.4
|
||||
// Type definitions for pigpio 1.2
|
||||
// Project: https://github.com/fivdi/pigpio
|
||||
// Definitions by: ManerFan <https://github.com/manerfan>
|
||||
// Definitions by: ManerFan <https://github.com/manerfan>, erikma <https://github.com/erikma>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
@@ -424,3 +424,27 @@ export function configureClock(microseconds: number, peripheral: number): void;
|
||||
* @param port an unsigned integer specifying the pigpio socket port number
|
||||
*/
|
||||
export function configureSocketPort(port: number): void;
|
||||
|
||||
/**
|
||||
* Returns the Raspberry Pi hardware revision as an unsigned integer. Returns 0
|
||||
* if the hardware revision can not be determined.
|
||||
*/
|
||||
export function hardwareRevision(): number;
|
||||
|
||||
/**
|
||||
* Gets the current unsigned 32-bit integer value of the number of microseconds
|
||||
* since system boot. This value wraps around the 32-bit space in just over an hour.
|
||||
* Use tickDiff() to get the difference between two tick values, to
|
||||
* ensure the correct JavaScript operations are used to account for the possibility
|
||||
* of overflow.
|
||||
*/
|
||||
export function getTick(): number;
|
||||
|
||||
/**
|
||||
* Returns the difference in microseconds between the end and start tick counts.
|
||||
* The tick counts can be retrieved using getTick(), or may be passed
|
||||
* in a GPIO event callback.
|
||||
* @param startTick The start of the measured interval. An unsigned integer tick value.
|
||||
* @param endTick The end of the measured interval. An unsigned integer tick value.
|
||||
*/
|
||||
export function tickDiff(startTick: number, endTick: number): number;
|
||||
|
||||
@@ -880,6 +880,15 @@ import * as assert from 'assert';
|
||||
}, 2000);
|
||||
})();
|
||||
|
||||
(function tickAndTickDiff(): void {
|
||||
const startTick: number = pigpio.getTick();
|
||||
setTimeout(() => {
|
||||
const endTick: number = pigpio.getTick();
|
||||
const diff: number = pigpio.tickDiff(startTick, endTick);
|
||||
assert.ok(diff > 0, 'expected tick count to increase across a timer call');
|
||||
}, 50);
|
||||
})();
|
||||
|
||||
(function gpio_glitch_filter(): void {
|
||||
const Gpio = pigpio.Gpio;
|
||||
const input = new Gpio(7, {
|
||||
|
||||
Reference in New Issue
Block a user