|
#include <SPI.h>
#include "LT8920.h"
/* Connections:
Arduino -> LT8900
GND GND
3v3 VCC
8 PKT
9 CS
10 RST
11 MOSI
12 MISO
13 SCK
*/
uint8_t number = 0;
void setup()
{
//cool
uint16_t data1;
//----------------------------------
LT8920_init();
//delay(500); //
LT8920_begin();
LT8920_setCurrentControl(4,0); //
LT8920_setDataRate(LT8920_62KBPS); // LT8920_setChannel(0x00); //
LT8920_setChannel(0x00);
//for serial
Serial.begin(115200); //
Serial.println(F("COOL2"));
}
//!!!!!!!!!!!!,PIN_NRF_CS
void loop() //--------------------send
{
uint8_t data[4]={0xaa,0x55,0x66,0};
//
LT8920_writeRegister(7,0x0000); //设定模式
LT8920_writeRegister(52,0x8080); //清空接收 发送FIFO数据
LT8920_writeRegister(50,0x0712); //发送数据长度 SPI_WriteReg(50, 2,0);
LT8920_writeRegister(50,0x3450); //数据
LT8920_writeRegister(50,0x7890);
LT8920_writeRegister(50,0xA0A0);
LT8920_writeRegister(7,0x0100); //发送
delay(20); //
// Serial.println(F(""));
// Serial.print(F("Tx"));
while (digitalRead(8) == 0) //等待发送完成
{
delay(20);
Serial.print(F("Tx"));
break;
}
//if((LT8920_readRegister(52)>>8)&0x3F)==0)
} |
|