function XFER(cmd) {
SPI1.send([cmd>>8,cmd], B8);
}
var C = {
RF_SLEEP_MODE : 0x8205,
RF_WAKEUP_MODE : 0x8207,
RF_TXREG_WRITE : 0xB800
};
function init() {
// setup spi
SPI1.setup({sck:B3,miso:B4,mosi:B5});
// then...
XFER(0x0000); // intitial SPI transfer added to avoid power-up problem
XFER(C.RF_SLEEP_MODE); // DC (disable clk pin), enable lbd
// wait until RFM12B is out of power-up reset, this takes several *seconds*
XFER(C.RF_TXREG_WRITE); // in case we're still in OOK mode
while (digitalRead(B9) === 0)
XFER(0x0000);
// ...
}
Okay so good progress.
If I load the above code then digitalRead(B9) the interpreter returns 0.
Run funtion init()
Checking digitalRead(B9) returns 1
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Progress...
Okay so good progress.
If I load the above code then
digitalRead(B9)
the interpreter returns0
.Run funtion
init()
Checking
digitalRead(B9)
returns1