![]() |
Linduino
1.3.0
Linear Technology Arduino-Compatible Demonstration Board
|
Go to the source code of this file.
Functions | |
static void | EnqueueSerialData () |
Enqueue serial data. More... | |
char | DequeueChar () |
Dequeue character. More... | |
char | get_char () |
Gets the character. More... | |
boolean | CheckSerialData () |
Determines if serial data is available and stores data in the queue. More... | |
boolean | DelayAndCheckSerialData (unsigned long ms) |
Delay and check serial data. More... | |
static void | byte_to_hex (byte value) |
convert a Byte to two hexadecimal characters. More... | |
byte | read_hex () |
Reads hexadecimal value from serial port read 2 hex characters from the serial buffer and convert them to a byte. More... | |
boolean | tinyDC590B (char command) |
process commands received via serial interface. More... | |
Macros | |
#define | MISO_TIMEOUT 1000 |
#define | QUEUE_ELEMENTS 250 |
max elements in the queue More... | |
#define | QUEUE_SIZE (QUEUE_ELEMENTS + 1) |
queue size. More... | |
Variables | |
unsigned char | pseudo_reset = 0 |
const byte | spi_mode = 0 |
const byte | i2c_mode = 1 |
const byte | i2c_auxiliary_mode = 2 |
byte | serial_mode = spi_mode |
boolean | dc590Busy = false |
DC590 busy flag. More... | |
char | hex_digits [16] |
hex conversion constants More... | |
char | hex_to_byte_buffer [5] |
buffer for ASCII hex to byte conversion More... | |
char | byte_to_hex_buffer [3] |
buffer for byte to ASCII hex conversion More... | |
static uint8_t | Queue [QUEUE_SIZE] |
The queue. More... | |
static uint8_t | QueueIn = 0 |
The queue in element. More... | |
static uint8_t | QueueOut = 0 |
The queue out element. More... | |
|
static |
convert a Byte to two hexadecimal characters.
Result stored to byte_to_hex_buffer
value | byte to be converted |
Definition at line 228 of file DC590_subset.ino.
boolean CheckSerialData | ( | ) |
Determines if serial data is available and stores data in the queue.
Definition at line 200 of file DC590_subset.ino.
boolean DelayAndCheckSerialData | ( | unsigned long | ms | ) |
Delay and check serial data.
(while delaying we periodically check for new serial data and store the data)
ms | delay in milliseconds. |
Definition at line 212 of file DC590_subset.ino.
char DequeueChar | ( | ) |
|
static |
Enqueue serial data.
Definition at line 153 of file DC590_subset.ino.
char get_char | ( | void | ) |
Gets the character.
get the next character either from the serial port or the internal queue
Read a command from the serial port
Definition at line 191 of file DC590_subset.ino.
char read_hex | ( | void | ) |
Reads hexadecimal value from serial port read 2 hex characters from the serial buffer and convert them to a byte.
Read 2 hex characters from the serial buffer and convert them to a byte
Definition at line 240 of file DC590_subset.ino.
boolean tinyDC590B | ( | char | command | ) |
process commands received via serial interface.
Those are the m,l commands and the basic DC590B commands used for DC590B compatibility mode that allows the GUI to communicate with this sketch. (basic set of DC590 commands to allow I2C communication to the LTC2947)
command | the command to be decoded |
Definition at line 255 of file DC590_subset.ino.
#define MISO_TIMEOUT 1000 |
tinyDC590 is used to give basic DC590B compatibility to e.g. DC2574A_KIT sketch so it can also be operated together with the LTC2947 GUI DC590B compatibility: tinyDC590 provides a subset of the DC590B commands. This way the e.g. the LTC2947 GUI is also able to communicate with the DC2574A_KIT sketch which enables the user to use the GUI to change LTC2947 configuration e.g. to set alarm thresholds etc. The main limitations of this compatibility mode are: - EEPROM read from the DC2334A demo board is faked (it will always report the right EEPROM string) - SPI operation is not supported, due to incompatibility with the optional LCD Keypad Shield Command Function Notes Q Receive Byte * I2C only, send ACK R Receive Byte * I2C only, sends NACK Sxx Send byte (2 hex chars) * SPI and I2C. Returns ‘N’ if slave NACKs. s Send start condition I2C only p Send stop condition I2C only Z Send line feed to host (0x0A) I Read demo board info. i Read contoller ID and firmware rev O Turn isolated power on o Turn isolated power off MI Switch to isolated I2C mode Kxy Bang pin, x argument is ‘0’ or ‘1’ for low or high, y is pin address, see below. jxy Set pin mode, x argument is ‘0’ or ‘1’ for INPUT or OUTPUT, y is pin address, see below. ky Read pin, answer is ‘0’ or ‘1’ for low or high, y is pin address, see below. Uxxy Write Port D bus, xx is ASCII Hex data, y is strobe pin address, strobed low. D Delay milliseconds P PingPause (echo P, wait 5 ms) g IO pin low G IO pin high H Wait for SDO=1 (SPI only) ‘T’ on timeout L Wait for SDO=0 (SPI only) ‘T’ on timeout 0x80 DC590B pseudo Reset the following DC590B commands are NOT implemented: r Receive 7 bits In SPI mode only. t Begin recording loop u Stop recording loop v Echo loop Txx Tranceive (send and receive) * (SPI only) w Loop until another command rec’d X CS=1 x CS=0 MS Switch to isolated SPI mode MX Switch to auxillary I2C mode
Copyright 2018(c) Analog Devices, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition at line 100 of file DC590_subset.ino.
#define QUEUE_ELEMENTS 250 |
max elements in the queue
Definition at line 137 of file DC590_subset.ino.
#define QUEUE_SIZE (QUEUE_ELEMENTS + 1) |
queue size.
Definition at line 140 of file DC590_subset.ino.
char byte_to_hex_buffer[3] |
buffer for byte to ASCII hex conversion
Definition at line 126 of file DC590_subset.ino.
boolean dc590Busy = false |
DC590 busy flag.
DC590 busy check.
Asserted while DC590B command is processed
Definition at line 110 of file DC590_subset.ino.
char hex_digits[16] |
hex conversion constants
Definition at line 113 of file DC590_subset.ino.
char hex_to_byte_buffer[5] |
buffer for ASCII hex to byte conversion
Definition at line 119 of file DC590_subset.ino.
const byte i2c_auxiliary_mode = 2 |
Definition at line 106 of file DC590_subset.ino.
const byte i2c_mode = 1 |
Definition at line 105 of file DC590_subset.ino.
unsigned char pseudo_reset = 0 |
Definition at line 102 of file DC590_subset.ino.
|
static |
The queue.
Definition at line 143 of file DC590_subset.ino.
|
static |
The queue in element.
Definition at line 146 of file DC590_subset.ino.
|
static |
The queue out element.
Definition at line 149 of file DC590_subset.ino.
byte serial_mode = spi_mode |
Definition at line 107 of file DC590_subset.ino.
const byte spi_mode = 0 |
Definition at line 104 of file DC590_subset.ino.