Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
Linduino.h
Go to the documentation of this file.
1 //! @todo Review this file.
2 /*
3 Linduino.h
4 
5 This file contains the hardware definitions for the Linduino.
6 
7 
8 Copyright 2018(c) Analog Devices, Inc.
9 
10 All rights reserved.
11 
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions are met:
14  - Redistributions of source code must retain the above copyright
15  notice, this list of conditions and the following disclaimer.
16  - Redistributions in binary form must reproduce the above copyright
17  notice, this list of conditions and the following disclaimer in
18  the documentation and/or other materials provided with the
19  distribution.
20  - Neither the name of Analog Devices, Inc. nor the names of its
21  contributors may be used to endorse or promote products derived
22  from this software without specific prior written permission.
23  - The use of this software may or may not infringe the patent rights
24  of one or more patent holders. This license does not release you
25  from the requirement that you obtain separate licenses from these
26  patent holders to use this software.
27  - Use of the software either in source or binary form, must be run
28  on or directly connected to an Analog Devices Inc. component.
29 
30 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
31 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
32 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
33 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
34 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
36 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
37 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
38 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 */
41 
42 /*! @file
43  @ingroup Linduino
44  @ingroup QuikEval
45  Header File for Linduino Libraries and Demo Code
46 */
47 
48 #ifndef LINDUINO_H
49 #define LINDUINO_H
50 
51 #include <Arduino.h> // typedefs use types defined in this header file.
52 
53 //! @name LINDUINO PIN ASSIGNMENTS
54 //! @{
55 
56 #define QUIKEVAL_GPIO 9 //!< Linduino QuikEval GPIO pin (QuikEval connector pin 14) connects to Arduino pin 9
57 #define QUIKEVAL_CS SS //!< QuikEval CS pin (SPI chip select on QuikEval connector pin 6) connects to Arduino SS pin.
58 #define QUIKEVAL_MUX_MODE_PIN 8 /*!< QUIKEVAL_MUX_MODE_PIN defines the control pin for the QuikEval MUX.
59 The I2C port's SCL and the SPI port's SCK signals share the same pin on the Linduino's QuikEval connector.
60 Additionally, the I2C port's SDA and the SPI port's MOSI signals share the same pin on the Linduino's QuikEval connector.
61 The pair of pins connected to the QuikEval connector is switched using a MUX on the Linduino board.
62 The control pin to switch the MUX is defined as QUIKEVAL_MUX_MODE_PIN (Arduino pin 8). */
63 //! @}
64 
65 // Macros
66 //! Set "pin" low
67 //! @param pin pin to be driven LOW
68 #define output_low(pin) digitalWrite(pin, LOW)
69 //! Set "pin" high
70 //! @param pin pin to be driven HIGH
71 #define output_high(pin) digitalWrite(pin, HIGH)
72 //! Return the state of pin "pin"
73 //! @param pin pin to be read (HIGH or LOW).
74 //! @return the state of pin "pin"
75 #define input(pin) digitalRead(pin)
76 
77 //! @name ENDIAN DEPENDENT BYTE INDEXES
78 //! @{
79 //! Arduino/Linduino is a Little Endian Device, where the least significant byte is stored in the first byte of larger data types.
80 #ifdef BIG_ENDIAN
81 #define LSB 1 //!< Location of Least Signficant Byte when Word is accessed as Byte Array
82 #define MSB 0 //!< Location of Most Signficant Byte when Word is accessed as Byte Array
83 #define LSW 1 //!< Location of Least Signficant Word when Long Word is accessed as Byte Array
84 #define MSW 0 //!< Location of most Signficant Word when Long Word is accessed as Byte Array
85 #else
86 #define LSB 0 //!< Location of Least Signficant Byte when Word is accessed as Byte Array
87 #define MSB 1 //!< Location of Most Signficant Byte when Word is accessed as Byte Array
88 #define LSW 0 //!< Location of Least Signficant Word when Long Word is accessed as Byte Array
89 #define MSW 1 //!< Location of most Signficant Word when Long Word is accessed as Byte Array
90 #endif
91 //! @}
92 
93 //! This union splits one int16_t (16-bit signed integer) or uint16_t (16-bit unsigned integer)
94 //! into two uint8_t's (8-bit unsigned integers) and vice versa.
96  {
97  int16_t LT_int16; //!< 16-bit signed integer to be converted to two bytes
98  uint16_t LT_uint16; //!< 16-bit unsigned integer to be converted to two bytes
99  uint8_t LT_byte[2]; //!< 2 bytes (unsigned 8-bit integers) to be converted to a 16-bit signed or unsigned integer
100  };
102 //! This union splits one int32_t (32-bit signed integer) or uint32_t (32-bit unsigned integer)
103 //! four uint8_t's (8-bit unsigned integers) and vice versa.
105 {
106  int32_t LT_int32; //!< 32-bit signed integer to be converted to four bytes
107  uint32_t LT_uint32; //!< 32-bit unsigned integer to be converted to four bytes
108  uint8_t LT_byte[4]; //!< 4 bytes (unsigned 8-bit integers) to be converted to a 32-bit signed or unsigned integer
109 };
111 //! This union splits one int32_t (32-bit signed integer) or uint32_t (32-bit unsigned integer)
112 //! into two uint16_t's (16-bit unsigned integers) and vice versa.
114 {
115  int32_t LT_int32; //!< 32-bit signed integer to be converted to four bytes
116  uint32_t LT_uint32; //!< 32-bit unsigned integer to be converted to four bytes
117  uint16_t LT_uint16[2]; //!< 2 words (unsigned 16-bit integers) to be converted to a 32-bit signed or unsigned integer
118 };
120 //! This union splits one float into four uint8_t's (8-bit unsigned integers) and vice versa.
122 {
123  float LT_float; //!< float to be converted to four bytes
124  uint8_t LT_byte[4]; //!< 4 bytes (unsigned 8-bit integers) to be converted to a float
125 };
126 
128 #endif // LINDUINO_H
int16_t LT_int16
16-bit signed integer to be converted to two bytes
Definition: Linduino.h:101
uint16_t LT_uint16
16-bit unsigned integer to be converted to two bytes
Definition: Linduino.h:102
This union splits one int32_t (32-bit signed integer) or uint32_t (32-bit unsigned integer) into two ...
Definition: Linduino.h:117
This union splits one int32_t (32-bit signed integer) or uint32_t (32-bit unsigned integer) four uint...
Definition: Linduino.h:108
This union splits one int16_t (16-bit signed integer) or uint16_t (16-bit unsigned integer) into two ...
Definition: Linduino.h:99
This union splits one float into four uint8_t&#39;s (8-bit unsigned integers) and vice versa...
Definition: Linduino.h:125
uint8_t LT_byte[2]
2 bytes (unsigned 8-bit integers) to be converted to a 16-bit signed or unsigned integer ...
Definition: Linduino.h:103