Skip to content

Commit 4715018

Browse files
committed
Merge Done :)
1 parent 83515b2 commit 4715018

File tree

12 files changed

+77
-323
lines changed

12 files changed

+77
-323
lines changed

Drone.X/I2C.c

Lines changed: 29 additions & 252 deletions
Large diffs are not rendered by default.

Drone.X/I2C.h

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,6 @@
1-
#ifndef __I2C_H
2-
#define __I2C_H
1+
#ifndef __GESTION_I2C_H
2+
#define __GESTION_I2C_H
33

4-
<<<<<<< HEAD
5-
//#define I2C_MASTER 1
6-
7-
8-
#if I2C_MASTER
9-
#define I2C_CMD_LIST_SIZE 5
10-
typedef struct{
11-
uint8_t i2c_addr;
12-
uint8_t nbr_byte_to_send;
13-
uint8_t nbr_byte_to_read;
14-
uint8_t *data_read;
15-
uint8_t *data_to_send;
16-
void *Done;
17-
}I2C_command;
18-
19-
void Init_I2C(void);
20-
void Add_I2C_command(uint8_t i2c_addr, uint8_t nbr_byte_to_send, uint8_t nbr_byte_to_read,uint8_t data_send[], uint8_t data_read[], void *Done);
21-
void Transmit_I2C_Loop(void);
22-
=======
234
#define I2C_MASTER
245

256

@@ -39,8 +20,7 @@ typedef struct{
3920

4021
void Init_I2C(void);
4122
void Add_I2C_command(uint8_t i2c_addr, uint8_t nbr_byte_to_send, uint8_t nbr_byte_to_read,uint8_t data_send[], uint8_t data_read[], void *Done);
42-
void Transmit_I2C_Loop(void);
43-
>>>>>>> master_test_martin
23+
void Gestion_I2C_Master_Loop(void);
4424

4525
#define I2C_SCL_PIN _RB8
4626
#define I2C_SCL_TRIS _TRISB8
@@ -55,21 +35,15 @@ uint8_t I2C_Stress_Cmd(void);
5535

5636
void I2C_Discover_Loop(void);
5737
uint8_t I2C_Discover_Cmd(void);
58-
38+
5939
#else
40+
41+
#define I2C_SLAVE_ADRR 0x20
6042
#define SIZE_BUFF_I2C 5
43+
6144
void Init_I2C(void);
6245
void Gestion_I2C_Slave_Loop(void);
6346

64-
void Init_I2C_int(void);
65-
void Gestion_I2C_Slave_int_Loop(void);
66-
67-
uint8_t I2C_Wr_Cmd(void);
68-
uint8_t I2C_Rd_Cmd(void);
69-
uint8_t I2C_Wr_Rd_Cmd(void);
70-
uint8_t I2C_Stress_Cmd(void);
71-
#endif
72-
73-
74-
#endif /* __GESTION_I2C_H */
7547

48+
#endif // I2C_MASTER
49+
#endif // __GESTION_I2C_H

Drone.X/I2C_Accel.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#include "main.h"
22

33

4-
#define Timer_ms1 Compteur_ms_1
5-
6-
#if I2C_MASTER
4+
#ifdef I2C_MASTER
75

86

97

Drone.X/I2C_Accel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66

7-
#if I2C_MASTER
7+
#ifdef I2C_MASTER
88

99
// accel add0 = gnd
1010
#define ACCEL_ADD 0x68 // x2 pour Write, x2+1 pour read

Drone.X/I2C_Alti.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44

5-
#if I2C_MASTER
5+
#ifdef I2C_MASTER
66

77
uint8_t crc4(uint16_t n_prom[]);
88

Drone.X/I2C_Alti.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66

7-
#if I2C_MASTER
7+
#ifdef I2C_MASTER
88

99

1010
// csb = gnd

Drone.X/Interpreteur.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ const Command Command_List[] = {
2020

2121
//{ "ALTI" ,Alti_Cmd},
2222

23-
23+
#ifdef I2C_MASTER
2424
{ "IWR" ,I2C_Wr_Cmd},
2525
{ "IRD" ,I2C_Rd_Cmd},
2626
{ "IWRD" ,I2C_Wr_Rd_Cmd},
2727

2828
{ "IST" ,I2C_Stress_Cmd},
29-
//{ "I2CDISC" ,I2C_Discover_Cmd},
30-
29+
{ "I2CDISC" ,I2C_Discover_Cmd},
30+
#endif
3131

3232

3333
{ "GPSON" ,GPS_Send_On_Pin_Cmd},

Drone.X/Timer_ms.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44
#include "main.h"
55

66

7-
<<<<<<< HEAD
7+
88
volatile u16 Timer_ms1 = 0;
9-
=======
10-
volatile u16 Compteur_ms_1 = 0;
11-
>>>>>>> master_test_martin
129

1310
void Timer_Ms_Init(void)
1411
{
@@ -21,13 +18,8 @@ void Timer_Ms_Init(void)
2118

2219
void Delay_ms (u16 Delay_Time)
2320
{
24-
<<<<<<< HEAD
2521
u16 Delay_Var = Timer_ms1;
2622
while ((Delay_Var - Timer_ms1) < Delay_Time);
27-
=======
28-
u16 Start_Time = Compteur_ms_1;
29-
while ((Compteur_ms_1 - Start_Time) < Delay_Time);
30-
>>>>>>> master_test_martin
3123
}
3224

3325
void __attribute__((interrupt,auto_psv)) _T1Interrupt(void)
@@ -38,11 +30,6 @@ void __attribute__((interrupt,auto_psv)) _T1Interrupt(void)
3830
LED2 = !LED2;
3931
i = 0;
4032
}
41-
<<<<<<< HEAD
42-
43-
=======
44-
>>>>>>> master_test_martin
45-
4633
Timer_ms1 ++;
4734

4835

Drone.X/Timer_ms.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,5 @@ void Timer_Ms_Init(void);
66

77
void Delay_ms (u16 Delay_Time);
88

9-
<<<<<<< HEAD
109
extern volatile u16 Timer_ms1;
11-
=======
12-
extern volatile u16 Compteur_ms_1;
13-
>>>>>>> master_test_martin
14-
1510
#endif

Drone.X/main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,10 @@ int main(void) {
5151
}
5252
/*if (Mode_Urgence) {
5353
GPS_Send_Off_Cmd();
54-
}
55-
Accel_Loop();*/
54+
}*/
5655

5756
#ifdef I2C_MASTER
58-
Transmit_I2C_Loop();
57+
Gestion_I2C_Master_Loop();
5958
I2C_Stress_Loop();
6059
I2C_Discover_Loop();
6160
Accel_Loop();

0 commit comments

Comments
 (0)