Ejemplo n.º 1
0
uint8_t spiWrite(uint8_t reg, uint8_t val){
    
    spiTransmit(LPC_SPI0, (reg | RFM69_SPI_WRITE_MASK), 1); // Send the address with the write mask on
    spiReceive(LPC_SPI0);
    spiTransmit(LPC_SPI0, val, 0);
    spiReceive(LPC_SPI0);

}
Ejemplo n.º 2
0
uint8_t spiRead(uint8_t reg){
    
    uint16_t data;
    spiTransmit(LPC_SPI0, reg & ~RFM69_SPI_WRITE_MASK, 1);
    spiReceive(LPC_SPI0);
    
    spiTransmit(LPC_SPI0, 0x00, 0);
    
    data = spiReceive(LPC_SPI0);
    return data;
}
Ejemplo n.º 3
0
void spiBurstRead(uint8_t reg, uint8_t* dest, uint8_t len)
{
    spiTransmit(LPC_SPI0, (reg & ~RFM69_SPI_WRITE_MASK), len);
    spiReceive(LPC_SPI0);
    len--;
    
    while (len--){
        spiTransmit(LPC_SPI0, 0x00, len);
        *dest++ = spiReceive(LPC_SPI0);
    }
}
Ejemplo n.º 4
0
void spi(){
  
  uint8_t data;
  spiInit();
  uint8_t status = spiTransmit(data);
  status = spiReceive();
}
Ejemplo n.º 5
0
void RFM69_spiFifoWrite(const uint8_t* src, int len)
{
    
    spiTransmit(LPC_SPI0, (RFM69_REG_00_FIFO | RFM69_SPI_WRITE_MASK), 9);
    spiReceive(LPC_SPI0);
    
    spiTransmit(LPC_SPI0, len, 9);
    spiReceive(LPC_SPI0);
    
    len--;
    
    uint8_t i = 0;
    while (len >= 0){
        spiTransmit(LPC_SPI0, src[i], len);
        spiReceive(LPC_SPI0);
        
        len--;
        i++;
    }
}