Debian Codegraph @

thirdparty/analogdevicesinc/no-OS/common_drivers/communication/generic/Communication.c

raw symbols SCIP
1 /***************************************************************************//**
2 * @file Communication.c
3 * @brief Implementation of Communication Driver.
4 * @author DBogdan ([email protected])
5 ********************************************************************************
6 * Copyright 2012-2015(c) Analog Devices, Inc.
7 *
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are met:
12 * - Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * - Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * - Neither the name of Analog Devices, Inc. nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 * - The use of this software may or may not infringe the patent rights
22 * of one or more patent holders. This license does not release you
23 * from the requirement that you obtain separate licenses from these
24 * patent holders to use this software.
25 * - Use of the software either in source or binary form, must be run
26 * on or directly connected to an Analog Devices Inc. component.
27 *
28 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
29 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
30 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
31 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
34 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 *
39 *******************************************************************************/
40
41 /******************************************************************************/
42 /* Include Files */
43 /******************************************************************************/
44 #include "Communication.h"
45
46 /***************************************************************************//**
47 * @brief Initializes the I2C communication peripheral.
48 *
49 * @param clockFreq - I2C clock frequency (Hz).
50 * Example: 100000 - I2C clock frequency is 100 kHz.
51 * @return status - Result of the initialization procedure.
52 * Example: 1 - if initialization was successful;
53 * 0 - if initialization was unsuccessful.
54 *******************************************************************************/
55 unsigned char I2C_Init(unsigned long clockFreq)
56 {
57 /* Add your code here. */
58 }
59
60 /***************************************************************************//**
61 * @brief Writes data to a slave device.
62 *
63 * @param slaveAddress - Address of the slave device.
64 * @param dataBuffer - Pointer to a buffer storing the transmission data.
65 * @param bytesNumber - Number of bytes to write.
66 * @param stopBit - Stop condition control.
67 * Example: 0 - A stop condition will not be sent;
68 * 1 - A stop condition will be sent.
69 *
70 * @return status - Number of written bytes.
71 *******************************************************************************/
72 unsigned char I2C_Write(unsigned char slaveAddress,
73 unsigned char* dataBuffer,
74 unsigned char bytesNumber,
75 unsigned char stopBit)
76 {
77 /* Add your code here. */
78 }
79
80 /***************************************************************************//**
81 * @brief Reads data from a slave device.
82 *
83 * @param slaveAddress - Address of the slave device.
84 * @param dataBuffer - Pointer to a buffer that will store the received data.
85 * @param bytesNumber - Number of bytes to read.
86 * @param stopBit - Stop condition control.
87 * Example: 0 - A stop condition will not be sent;
88 * 1 - A stop condition will be sent.
89 *
90 * @return status - Number of read bytes.
91 *******************************************************************************/
92 unsigned char I2C_Read(unsigned char slaveAddress,
93 unsigned char* dataBuffer,
94 unsigned char bytesNumber,
95 unsigned char stopBit)
96 {
97 /* Add your code here. */
98 }
99
100 /***************************************************************************//**
101 * @brief Initializes the SPI communication peripheral.
102 *
103 * @param lsbFirst - Transfer format (0 or 1).
104 * Example: 0x0 - MSB first.
105 * 0x1 - LSB first.
106 * @param clockFreq - SPI clock frequency (Hz).
107 * Example: 1000 - SPI clock frequency is 1 kHz.
108 * @param clockPol - SPI clock polarity (0 or 1).
109 * Example: 0x0 - Idle state for clock is a low level; active
110 * state is a high level;
111 * 0x1 - Idle state for clock is a high level; active
112 * state is a low level.
113 * @param clockEdg - SPI clock edge (0 or 1).
114 * Example: 0x0 - Serial output data changes on transition
115 * from idle clock state to active clock state;
116 * 0x1 - Serial output data changes on transition
117 * from active clock state to idle clock state.
118 *
119 * @return status - Result of the initialization procedure.
120 * Example: 1 - if initialization was successful;
121 * 0 - if initialization was unsuccessful.
122 *******************************************************************************/
123 unsigned char SPI_Init(unsigned char lsbFirst,
124 unsigned long clockFreq,
125 unsigned char clockPol,
126 unsigned char clockEdg)
127 {
128 /* Add your code here. */
129 }
130
131 /***************************************************************************//**
132 * @brief Reads data from SPI.
133 *
134 * @param slaveDeviceId - The ID of the selected slave device.
135 * @param data - Data represents the write buffer as an input parameter and the
136 * read buffer as an output parameter.
137 * @param bytesNumber - Number of bytes to read.
138 *
139 * @return Number of read bytes.
140 *******************************************************************************/
141 unsigned char SPI_Read(unsigned char slaveDeviceId,
142 unsigned char* data,
143 unsigned char bytesNumber)
144 {
145 /* Add your code here. */
146 }
147
148 /***************************************************************************//**
149 * @brief Writes data to SPI.
150 *
151 * @param slaveDeviceId - The ID of the selected slave device.
152 * @param data - Data represents the write buffer.
153 * @param bytesNumber - Number of bytes to write.
154 *
155 * @return Number of written bytes.
156 *******************************************************************************/
157 unsigned char SPI_Write(unsigned char slaveDeviceId,
158 unsigned char* data,
159 unsigned char bytesNumber)
160 {
161 /* Add your code here. */
162 }