uci-mcp/src/config.mjs

68 lines
2.0 KiB
JavaScript

export const CHIP = {
// The consifuration byte is ['NULL','INTPOL','ODR','HAEN','DISSLW','SEQOP','MIRROR','BANK']
// see page 18 of 23017 datasheet for 8 setting details
// MUST send '10000000' to 0x0B first to be sure you are in BANK=1 separate bank mode
// IOCON.BANK=0 (msb) at powerup so need to use 0x0A, if set to 1 then us
default: {
val: '10100010', // Split Banks port A + 0x10 = Port B,(ignored by 23008), Sequential operation disabled, active high=pulldown
fmt: 'STR'
},
oneint: {
val: '11100100', // same as default execpt interupt pins of port A and B are connected
fmt: 'STR'
}
}
export const PIN = {
setting: { // these are the mcp registers = command for each setting
dir: 0,
ivrt: 1,
pullup: 6,
intr: 2,
usedef: 4,
defval: 3,
},
cfgset:{
output: {
dir: 0, // 0 output,1 input
ivrt: 0,
pullup: 0,
intr: 0, // if intr = 0 usedef,deval not used
usedef: 0, // if usedef = 0 defval not used
defval: 0
},
toggle_switch: {
dir: 1, // 0 output,1 input
ivrt: 1, // for reading let 1 be zero and vice versa
pullup: 1,
intr: 1, // if intr = 0 usedef,deval not used
usedef: 0, // if usedef = 0 defval not used
defval: 0
},
toggle_switch_no_pullup: {
dir: 1, // 0 output,1 input
ivrt: 1, // for reading let 1 be zero and vice versa
pullup: 0, // use external pullup 5V with external resister!
intr: 1, // if intr = 0 usedef,deval not used
usedef: 0, // if usedef = 0 defval not used
defval: 0
},
momentary_switch: {
dir: 1, // 0 output,1 input
ivrt: 1, // for reading let 1 be zero and vice versa
pullup: 1,
intr: 1, // if intr = 0 usedef,deval not used
usedef: 1, // if usedef = 0 defval not used
defval: 1 // only throw interrupt when switch closes (1 becasue ivrt is 1)
}
},
cmd: {
intf: 7, // readonly
intcap: 8, // readonly
gpio: 9, // read/write
olat: 10 // read only
}
}