mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 12:11:47 +00:00
Added part of the Raspi IO ecosystem
This commit is contained in:
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// Type definitions for raspi-board 5.0
|
||||
// Project: https://github.com/nebrius/raspi-board
|
||||
// Definitions by: Bryan Hughes <https://github.com/nebrius>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
export const VERSION_1_MODEL_A = "rpi1_a";
|
||||
export const VERSION_1_MODEL_B_REV_1 = "rpi1_b1";
|
||||
export const VERSION_1_MODEL_B_REV_2 = "rpi1_b2";
|
||||
export const VERSION_1_MODEL_B_PLUS = "rpi1_bplus";
|
||||
export const VERSION_1_MODEL_A_PLUS = "rpi1_aplus";
|
||||
export const VERSION_1_MODEL_ZERO = "rpi1_zero";
|
||||
export const VERSION_1_MODEL_ZERO_W = "rpi1_zerow";
|
||||
export const VERSION_2_MODEL_B = "rpi2_b";
|
||||
export const VERSION_3_MODEL_B = "rpi3_b";
|
||||
export const VERSION_UNKNOWN = "unknown";
|
||||
export interface PinInfo {
|
||||
pins: string[];
|
||||
peripherals: string[];
|
||||
gpio: number;
|
||||
}
|
||||
export function getBoardRevision(): string;
|
||||
export function getPins(): {
|
||||
[wiringpi: number]: PinInfo;
|
||||
};
|
||||
export function getPinNumber(alias: string | number): number | null;
|
||||
export function getGpioNumber(alias: string | number): number | null;
|
||||
@@ -0,0 +1,6 @@
|
||||
import { getBoardRevision, getPins, getPinNumber, getGpioNumber } from 'raspi-board';
|
||||
|
||||
getBoardRevision();
|
||||
getPins();
|
||||
getPinNumber('GPIO18');
|
||||
getGpioNumber('GPIO18');
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"raspi-board-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for raspi-peripheral 2.0
|
||||
// Project: https://github.com/nebrius/raspi-peripheral
|
||||
// Definitions by: Bryan Hughes <https://github.com/nebrius>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
/// <reference types="node" />
|
||||
import { EventEmitter } from 'events';
|
||||
export class Peripheral extends EventEmitter {
|
||||
private _alive;
|
||||
readonly alive: boolean;
|
||||
private _pins;
|
||||
readonly pins: number[];
|
||||
constructor(pins: string | number | Array<string | number>);
|
||||
destroy(): void;
|
||||
validateAlive(): void;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { Peripheral } from 'raspi-peripheral';
|
||||
|
||||
const myPeripheral = new Peripheral('GPIO2');
|
||||
myPeripheral.alive;
|
||||
myPeripheral.pins.filter((pin) => true);
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"raspi-peripheral-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// Type definitions for raspi 5.0
|
||||
// Project: https://github.com/nebrius/raspi
|
||||
// Definitions by: Bryan Hughes <https://github.com/nebrius>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
export function init(cb: () => void): void;
|
||||
@@ -0,0 +1,3 @@
|
||||
import { init } from 'raspi';
|
||||
|
||||
init(() => {});
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"raspi-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user