Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Добавлены примеры применения и инклуды нужных библиотек
- Loading branch information
1 parent
daa03e7
commit ac4e20b
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "I2C.h" | ||
|
||
void main() | ||
{ | ||
uint8_t burst_data_write[5] = {0x24, 0x48, 0x52, 0x59, 0x73}, burst_data_read[6] = { 0 }; | ||
uint8_t single_data_read = 0; | ||
|
||
I2C_init(I2C1, 100000); | ||
delay(); | ||
|
||
I2C_single_write(I2C1, 0xA0, 0x20, 0x15); | ||
delay(); | ||
I2C_burst_write(I2C1, 0xA0, 0x11, 5, burst_data_write); | ||
delay(); | ||
|
||
single_data_read = I2C_single_read(I2C1, 0xA0, 0x020); | ||
delay(); | ||
I2C_burst_read(I2C1, 0xA0, 0x11, 5, burst_data_read); | ||
|
||
while(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#include "stm32f10x_rcc.h" | ||
#include "stm32f10x_gpio.h" | ||
#include "stm32f10x_i2c.h" | ||
#include "I2C.h" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include "I2C.h" | ||
|
||
void main() | ||
{ | ||
uint8_t MAC_Address[6] = { 0 }; | ||
|
||
I2C_init(I2C1, 100000); | ||
delay(); | ||
I2C_burst_read(I2C1, 0xA0, 0xFA, 6, MAC_Address); | ||
|
||
while(1); | ||
} |