forked from Fr0stbyteR/jspatcher
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from CorvusPrudens/dev
Improved Daisy error recovery
- Loading branch information
Showing
6 changed files
with
140 additions
and
78 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { IInletsMeta, IOutletsMeta } from "../../../objects/base/AbstractObject"; | ||
import type { IIosMeta, IPropsMeta, THardwareMetaType } from "../base/AbstractHardwareObject"; | ||
import DefaultObject from "../base/DefaultHardwareObject"; | ||
|
||
export default class Mpr121 extends DefaultObject<{}, {}, any[], any[], []> { | ||
static author = "Corvus Prudens"; | ||
static version = "v1.0.0"; | ||
static description = "MPR121 Capacitive Touch Sensor"; | ||
static ios: IIosMeta = [ | ||
{ | ||
pin: { | ||
pinName: "sda", | ||
busCapabilities: { I2C: { i2c: true, sda: true, scl: false } }, | ||
}, | ||
type: "anything", | ||
description: "I2C Data Pin", | ||
}, | ||
{ | ||
pin: { | ||
pinName: "scl", | ||
busCapabilities: { I2C: { i2c: true, sda: false, scl: true } }, | ||
}, | ||
type: "anything", | ||
description: "I2C Clock Pin", | ||
}, | ||
]; | ||
|
||
static patcherOutlets: IOutletsMeta = [ | ||
{ | ||
type: "anything", | ||
description: "Button index and state pair (0 = no touch, 1 = touch)", | ||
}, | ||
]; | ||
|
||
static props: IPropsMeta = { | ||
address: { | ||
type: "number", | ||
default: 90, | ||
description: "The I2C address of the device", | ||
alwaysSerialize: true, | ||
}, | ||
touchThreshold: { | ||
type: "number", | ||
default: 12, | ||
description: "sets the touch detection threshold (0-255)", | ||
alwaysSerialize: true, | ||
}, | ||
releaseThreshold: { | ||
type: "number", | ||
default: 6, | ||
description: "sets the release detection threshold (0-255)", | ||
alwaysSerialize: true, | ||
}, | ||
}; | ||
|
||
subscribe() { | ||
super.subscribe(); | ||
|
||
this.on("preInit", () => { | ||
this.ios = [ | ||
{ | ||
edge: "T", | ||
position: 0.25, | ||
}, | ||
{ | ||
edge: "T", | ||
position: 0.75, | ||
}, | ||
]; | ||
}); | ||
} | ||
} |