Skip to content

Commit db6dedd

Browse files
committed
Add alternate names for cape-universal usage
* cape-universal prefixes the names with 0 for single digit pin numbers * throw error on missing pinmux file
1 parent 941973d commit db6dedd

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/bone.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ var pinIndex = [
8787
"mux": "gpmc_ad6",
8888
"eeprom": 26,
8989
"key": "P8_3",
90+
"universalName": "P8_03",
9091
"muxRegOffset": "0x018",
9192
"options": [
9293
"gpmc_ad6",
@@ -105,6 +106,7 @@ var pinIndex = [
105106
"mux": "gpmc_ad7",
106107
"eeprom": 27,
107108
"key": "P8_4",
109+
"universalName": "P8_04",
108110
"muxRegOffset": "0x01c",
109111
"options": [
110112
"gpmc_ad7",
@@ -123,6 +125,7 @@ var pinIndex = [
123125
"mux": "gpmc_ad2",
124126
"eeprom": 22,
125127
"key": "P8_5",
128+
"universalName": "P8_05",
126129
"muxRegOffset": "0x008",
127130
"options": [
128131
"gpmc_ad2",
@@ -141,6 +144,7 @@ var pinIndex = [
141144
"mux": "gpmc_ad3",
142145
"eeprom": 23,
143146
"key": "P8_6",
147+
"universalName": "P8_06",
144148
"muxRegOffset": "0x00c",
145149
"options": [
146150
"gpmc_ad3",
@@ -159,6 +163,7 @@ var pinIndex = [
159163
"mux": "gpmc_advn_ale",
160164
"eeprom": 41,
161165
"key": "P8_7",
166+
"universalName": "P8_07",
162167
"muxRegOffset": "0x090",
163168
"options": [
164169
"gpmc_advn_ale",
@@ -177,6 +182,7 @@ var pinIndex = [
177182
"mux": "gpmc_oen_ren",
178183
"eeprom": 44,
179184
"key": "P8_8",
185+
"universalName": "P8_08",
180186
"muxRegOffset": "0x094",
181187
"options": [
182188
"gpmc_oen_ren",
@@ -195,6 +201,7 @@ var pinIndex = [
195201
"mux": "gpmc_ben0_cle",
196202
"eeprom": 42,
197203
"key": "P8_9",
204+
"universalName": "P8_09",
198205
"muxRegOffset": "0x09c",
199206
"options": [
200207
"gpmc_ben0_cle",

src/hw_universal.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ exports.readPinMux = function(pin, mode, callback) {
7171

7272
exports.setPinMode = function(pin, pinData, template, resp, callback) {
7373
if(debug) winston.debug('hw.setPinMode(' + [pin.key, pinData, template, JSON.stringify(resp)] + ');');
74-
var p = pin.key + "_pinmux"
74+
var p = pin.key + "_pinmux";
75+
if(pin.universalName) p = pin.universalName + "_pinmux";
7576
var pinmux = my.find_sysfsFile(p, my.is_ocp(), p + '.');
77+
if(!pinmux) { throw p + " was not found under " + my.is_ocp(); }
7678
if((pinData & 7) == 7) {
7779
gpioFile[pin.key] = '/sys/class/gpio/gpio' + pin.gpio + '/value';
7880
fs.writeFileSync(pinmux+"/state", 'gpio');

0 commit comments

Comments
 (0)