Skip to content

Commit

Permalink
Добавлены примеры применения и инклуды нужных библиотек
Browse files Browse the repository at this point in the history
  • Loading branch information
Catethysis committed Jun 30, 2014
1 parent daa03e7 commit ac4e20b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
21 changes: 21 additions & 0 deletions EEPROM.c
@@ -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);
}
2 changes: 2 additions & 0 deletions I2C.c
@@ -1,3 +1,5 @@
#include "stm32f10x_rcc.h"
#include "stm32f10x_gpio.h"
#include "stm32f10x_i2c.h"
#include "I2C.h"

Expand Down
12 changes: 12 additions & 0 deletions MAC_EEPROM.c
@@ -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);
}

0 comments on commit ac4e20b

Please sign in to comment.