uci-mcp/src/config.js

92 lines
3.1 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'
},
intPullup: {
val: '10100000', // same as default execpt interupt pins active=low means pullup (high and go low on trip)
fmt: 'STR'
},
intPullupOneInt: {
val: '10100000', // same as intPullup and oneInt combined
fmt: 'STR'
}
}
export const PIN = {
setting: { // these are the mcp registers = command for each setting
dir: 0, // IODIR 0=output 1=input
ivrt: 1, // IPOL will report the opposite state if set
intr: 2, //GPITEN 1= pin will throw interrupt (following registers are for interrupt)
pullup: 6, // GPPU 1=internal pullup 0=none
usedef: 4, // INTCON - 0= interrupt on any change, 1= interrupt on change of value from defval
defval: 3, // DEFVAL default value for interrupt comparison - usedef must be set
},
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
},
input: {
dir: 1, // 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
},
input_interrupt: { // includes pullup by default
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
},
input_interrupt_ext_up: {
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
},
input_interrupt_ext_down: {
dir: 1, // 0 output,1 input
ivrt: 0, // for reading let 1 be zero and vice versa
pullup: 0, // use external pulldown
intr: 1, // if intr = 0 usedef,deval not used
usedef: 0, // if usedef = 0 defval not used
defval: 0
},
momentary_interrupt: {
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
}
}