Port constants to JS
This commit is contained in:
parent
60c36c247c
commit
3cfa37e731
2 changed files with 48 additions and 1 deletions
44
constants.mjs
Normal file
44
constants.mjs
Normal file
|
@ -0,0 +1,44 @@
|
|||
export default {
|
||||
RESET: 8,
|
||||
NSS: 7,
|
||||
MOSI: 4,
|
||||
CLK: 3,
|
||||
MISO: 5,
|
||||
DIO0PIN: 31,
|
||||
|
||||
// RGB led pins acive high
|
||||
RLED: 17,
|
||||
GLED: 18,
|
||||
BLED: 19,
|
||||
|
||||
MAPLELED: 33,
|
||||
|
||||
// REGISTERS in RFM95
|
||||
REG_FIFO: 0x00,
|
||||
REG_MODE: 0x01,
|
||||
REG_FREQ_H: 0x06,
|
||||
REG_FREQ_M: 0x07,
|
||||
REG_FREQ_L: 0x08,
|
||||
REG_PACONFIG: 0x09,
|
||||
REG_FIFOADDRPTR: 0x0D,
|
||||
REG_FIFOTXBASEADDR: 0X0E,
|
||||
REG_FIFORXBASEADDR: 0x0F,
|
||||
REG_MODEMCONFIG: 0x1D,
|
||||
REG_MODEMCONFIG2: 0x1E,
|
||||
REG_SYMBTIMEOUT: 0x1F,
|
||||
REG_PREAMBLE_MSB: 0x20,
|
||||
REG_PREAMBLE_LSB: 0x21,
|
||||
REG_PAYLOADLENGTH: 0x22,
|
||||
REG_MODEMCONFIG3: 0x26,
|
||||
REG_NODEADR: 0x33,
|
||||
REG_SYNC: 0x39,
|
||||
REG_IMAGECAL: 0x3B,
|
||||
REG_DIOMAPPING1: 0x40,
|
||||
|
||||
// Mode constants
|
||||
MODE_SLEEP: 0x00,
|
||||
MODE_STANDBY: 0x01,
|
||||
MODE_LORA_SLEEP: 0x80,
|
||||
MODE_LORA_STANDBY: 0x81,
|
||||
MODE_LORA_TX: 0x83,
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env node
|
||||
const settings = {
|
||||
|
||||
spi_device: "/dev/spidev0.0"
|
||||
};
|
||||
|
||||
// Skip the first 2 items - they are node file.js
|
||||
|
@ -27,5 +27,8 @@ for(let i = 2; i < process.argv.length; i++) {
|
|||
console.log(" (none yet)");
|
||||
return;
|
||||
|
||||
case "--spi-device":
|
||||
settings.spi_device = process.argv[++i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue