Bar Logo 3.8/7.6 kw Totem pole Demonstration Application (Part-No. (not specified))
 
Content
     
Loading...
Searching...
No Matches
i2c2.h
1
25/*
26 (c) 2022 Microchip Technology Inc. and its subsidiaries. You may use this
27 software and any derivatives exclusively with Microchip products.
28
29 THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
30 EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
31 WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
32 PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
33 WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
34
35 IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
36 INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
37 WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
38 BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
39 FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
40 ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
41 THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
42
43 MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
44 TERMS.
45*/
46
47#ifndef _I2C2_H
48#define _I2C2_H
49
50#include <stdint.h>
51#include <stdbool.h>
52#include <stddef.h>
53#include <xc.h>
54
55#ifdef __cplusplus // Provide C++ Compatibility
56
57 extern "C" {
58
59#endif
60
61
80typedef enum
81{
82 /* This state indicates that the slave driver has detected a transmit request from the master.
83 The next transaction will be a read transaction. Application should prime the transmit
84 buffer with the valid data to be sent to the master using the: I2C2_ReadPointerSet()
85
86 */
87 I2C2_SLAVE_TRANSMIT_REQUEST_DETECTED,
88
89 /* This state indicates that the slave driver has detected a reception request from the master.
90 The next transaction will be a write transaction. Application should set up the receive
91 buffer by setting the location of the receive buffer using the: I2C2_WritePointerSet()
92 */
93 I2C2_SLAVE_RECEIVE_REQUEST_DETECTED,
94
95 /* This state indicates that the slave driver has received data from the master.
96 Application can use this status to process the received data set up the receive
97 buffer in anticipation of next reception in case the master sends more data.
98 See I2C2_SLAVE_RECEIVE_REQUEST_DETECTED.
99 */
100 I2C2_SLAVE_RECEIVED_DATA_DETECTED,
101
102 /* This state indicates that the slave driver has detected the most significant
103 byte of the 10-bit slave address. Another transaction with the least
104 significant byte of the 10-bit address with a read/write request will
105 be detected next. This second detection is automatically done by the
106 driver which may return one of the following:
107 a. I2C2_SLAVE_RECEIVE_REQUEST_DETECTED
108 b. I2C2_SLAVE_TRANSMIT_REQUEST_DETECTED
109 c. I2C2_SLAVE_10BIT_RECEIVE_REQUEST_DETECTED
110 a or b is detected depending on the read/write bit of the received
111 control data. If c is detected next, the master decided to resend
112 the most significant address.
113 */
114 I2C2_SLAVE_10BIT_RECEIVE_REQUEST_DETECTED,
115
116 /*
117 * This state indicates that an stop bit was detected, so execute
118 * CRC check
119 * This was added by Cormac on 19-Jan-2021
120 */
121 I2C2_SLAVE_STOP_BIT_DETECTED,
122
123
124} I2C2_SLAVE_DRIVER_STATUS;
125
126#define I2C2_SLAVE_DEFAULT_ADDRESS 99
127
164void I2C2_Initialize(void);
165
166
193void I2C2_SlaveAddressMaskSet(
194 uint16_t mask);
195
236void I2C2_SlaveAddressSet(
237 uint16_t address);
238
239
266void I2C2_ReadPointerSet(uint8_t *p);
267
294void I2C2_WritePointerSet(uint8_t *p);
295
326uint8_t *I2C2_ReadPointerGet(void);
327
359uint8_t *I2C2_WritePointerGet(void);
360
489void I2C2_SlaveTasks ( void );
490
491//#pragma message "I2C2_StatusCallback() is an Application implemented function. If this function is already implemented, you can turn off this message by deleting or commenting out this message."
492bool I2C2_StatusCallback(I2C2_SLAVE_DRIVER_STATUS status);
493
494#ifdef __cplusplus // Provide C++ Compatibility
495
496 }
497
498#endif
499
500#endif // _I2C2_H
bool I2C2_StatusCallback(I2C2_SLAVE_DRIVER_STATUS status)
Definition drv_i2c.c:82
size_t status
Definition uart1.c:99