73 #define READ_TIMEOUT 20 74 #define MISO_TIMEOUT 1000 77 #define RECORDING_SIZE 50 89 '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'A',
'B',
'C',
'D',
'E',
'F' 101 char id_string[51]=
"USBSPI,PIC,02,01,DC,DC590,----------------------\n\0";
104 '0',
'x',
'0',
'0',
'\0' 145 while (Serial.available() <= 0);
146 return(Serial.read());
155 if (command ==
'w') command=
'\1';
156 if (command ==
't') command=
'\1';
157 if (command ==
'v') command=
'\1';
158 if (command ==
'u') command=
'\1';
178 digitalWrite(2, LOW);
179 digitalWrite(3, LOW);
180 digitalWrite(4, LOW);
181 digitalWrite(5, LOW);
182 digitalWrite(6, LOW);
183 digitalWrite(7, LOW);
193 Serial.begin(115200);
199 Serial.print(
"hello\n");
235 if (
input(MISO)==1)
break;
252 #ifdef spoof_board_id 253 Serial.print(spoof_board_id);
264 Serial.print(
"\n\0");
284 digitalWrite(pin-0x30+2, pin_value ==
'0' ? LOW : HIGH);
296 Serial.print(digitalRead(pin-0x30+2));
302 val = digitalRead(12);
308 int val = analogRead(pin -
'6');
329 pinMode(pin-0x30+2, pin_value ==
'0' ? INPUT : OUTPUT);
336 if (
input(MISO)==0)
break;
368 SPI.setDataMode(SPI_MODE0);
371 SPI.setDataMode(SPI_MODE1);
374 SPI.setDataMode(SPI_MODE2);
377 SPI.setDataMode(SPI_MODE3);
380 SPI.setClockDivider(SPI_CLOCK_DIV2);
383 SPI.setClockDivider(SPI_CLOCK_DIV4);
386 SPI.setClockDivider(SPI_CLOCK_DIV8);
389 SPI.setClockDivider(SPI_CLOCK_DIV16);
392 SPI.setClockDivider(SPI_CLOCK_DIV32);
395 SPI.setClockDivider(SPI_CLOCK_DIV64);
398 SPI.setClockDivider(SPI_CLOCK_DIV128);
470 if (
i2c_write(tx_data)==1) Serial.print(
'N');
473 if (
i2c_write(tx_data)==1) Serial.print(
'N');
524 Serial.print(
"hello\n");
char recording_buffer[RECORDING_SIZE]
const byte i2c_auxiliary_mode
#define output_high(pin)
Set "pin" high.
static void byte_to_hex(byte value)
Header File for Linduino Libraries and Demo Code.
void spi_write(int8_t data)
Write a data byte using the SPI hardware.
void i2c_stop()
Write stop bit to the hardware I2C port.
int8_t i2c_start()
Write start bit to the hardware I2C port.
char byte_to_hex_buffer[3]
union LT_union_int32_4bytes data
#define WITH_NACK
Use with i2c_read(WITH_NACK) to read without an acknowledge.
unsigned char pseudo_reset
#define QUIKEVAL_GPIO
Linduino QuikEval GPIO pin (QuikEval connector pin 14) connects to Arduino pin 9. ...
int8_t i2c_write(uint8_t data)
Send a data byte to hardware I2C port.
#define output_low(pin)
Set "pin" low.
#define input(pin)
Return the state of pin "pin".
void quikeval_SPI_init(void)
Configure the SPI port for 4Mhz SCK.
LT_SPI: Routines to communicate with ATmega328P's hardware SPI port.
char hex_to_byte_buffer[5]
LT_I2C: Routines to communicate with ATmega328P's hardware I2C port.
void quikeval_SPI_connect()
Connect SPI pins to QuikEval connector through the Linduino MUX. This will disconnect I2C...
int8_t spi_read(int8_t data)
The data byte to be written.
uint8_t i2c_read(int8_t ack)
Read a data byte from the hardware I2C port.
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
void quikeval_I2C_connect(void)
Switch MUX to connect I2C pins to QuikEval connector.
#define WITH_ACK
Use with i2c_read(WITH_ACK) to read with an acknowledge.
#define QUIKEVAL_CS
QuikEval CS pin (SPI chip select on QuikEval connector pin 6) connects to Arduino SS pin...
uint8_t read_quikeval_id_string(char *buffer)
Read the id string from the EEPROM, then parse the product name, demo board name, and demo board opti...
char ui_buffer[UI_BUFFER_SIZE]