-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBSP_I2C.h
67 lines (61 loc) · 2.1 KB
/
BSP_I2C.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* PARIKSHIT STUDENT SATELLITE TEAM
* MANIPAL INSTITUTE OF TECHNOLOGY
* FILE: BSP_I2C.h
* TYPE: BOARD SUPPORT PACKAGE (HEADER)
* MCU: STM32L431CC
* DEVELOPING SUB-SYSTEM: ON-BOARD DATA HANDLING SUB-SYSTEM
* DEVELOPER: KRISHNA BIRLA
*/
#ifndef TERTPCB_BSP_I2C_H
#define TERTPCB_BSP_I2C_H
#include "BSP_GENERAL.h"
#include "BSP_GLOBAL.h"
#define INCOMING_SIZE_BUS1 (uint8_t)0x0A
#define OUTGOING_SIZE_BUS1 (uint8_t)0x0A
#define INCOMING_SIZE_BUS2 (uint8_t)0x0A
#define OUTGOING_SIZE_BUS2 (uint8_t)0x0A
#define OWN_ADDRESS_1_WRITE (uint8_t)0xD0
#define OWN_ADDRESS_1_READ (uint8_t)0xD1
#define OWN_ADDRESS_2 (uint8_t)0x00
#define TIMING (uint32_t)0x00000E14
#define TIMEOUT (uint32_t)0x00002710
#define I2C1_PREEMPT_PRIORITY (uint8_t)0x03
#define I2C1_SUB_PRIORITY (uint8_t)0x03
#define I2C2_PREEMPT_PRIORITY (uint8_t)0x04
#define I2C2_SUB_PRIORITY (uint8_t)0x04
uint8_t pBuf_RX_I2C1[INCOMING_SIZE_BUS1];
uint8_t pBuf_TX_I2C1[OUTGOING_SIZE_BUS1];
uint8_t pBuf_RX_I2C2[INCOMING_SIZE_BUS2];
uint8_t pBuf_TX_I2C2[OUTGOING_SIZE_BUS2];
void InitializeI2Cx(I2C_TypeDef* I2Cx,
I2C_InitTypeDef *I2C_Struct,
I2C_HandleTypeDef *I2C_Handle,
uint32_t I2C_ADDRESSINGMODE_x,
uint32_t I2C_DUALADDRESS_x,
uint32_t OWN_ADDRESS_1_x,
uint32_t OWN_ADDRESS_2_x,
uint32_t I2C_GENERALCALL_x,
uint32_t I2C_NOSTRETCH_x,
uint32_t Timing);
void Enable_NVIC_I2C(I2C_HandleTypeDef *I2C_Handle,
IRQn_Type IRQn,
uint32_t PreemptPriority,
uint32_t SubPriority);
void Disable_NVIC_I2C(I2C_HandleTypeDef *I2C_Handle,
IRQn_Type IRQn);
uint8_t I2Cx_Run_MSP(I2C_HandleTypeDef *I2C_Handle,
uint8_t *pBuf_RX,
uint8_t *pBuf_TX);
uint8_t I2Cx_Run_ARM(I2C_HandleTypeDef *I2C_Handle,
uint8_t *pBuf_RX,
uint8_t *pBuf_TX);
void I2Cx_Write_Master(I2C_HandleTypeDef* I2C_Handle,
uint8_t SlaveAddr,
uint8_t* pBuf_TX,
uint32_t BufSize);
void I2Cx_Read_Master(I2C_HandleTypeDef* I2C_Handle,
uint8_t SlaveAddr,
uint8_t* pBuf_TX,
uint32_t BufSize);
#endif /* TERTPCB_BSP_I2C_H */