Added part of the Raspi IO ecosystem

This commit is contained in:
Bryan Hughes
2017-11-18 15:31:32 -08:00
parent 51208357b1
commit ceb5223a75
12 changed files with 137 additions and 0 deletions
+27
View File
@@ -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;
+6
View File
@@ -0,0 +1,6 @@
import { getBoardRevision, getPins, getPinNumber, getGpioNumber } from 'raspi-board';
getBoardRevision();
getPins();
getPinNumber('GPIO18');
getGpioNumber('GPIO18');
+23
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+17
View File
@@ -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);
+23
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+7
View File
@@ -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;
+3
View File
@@ -0,0 +1,3 @@
import { init } from 'raspi';
init(() => {});
+23
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }