#include "stm32f4_discovery.h"
#include "stm32f4xx_conf.h" // again, added because ST didn't put it here ?
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
#include "usart.h"
#include "delay.h"
#include "lcd.h"
#include "i2c.h"


//I2C 23017 expander



int main(void)
{
usart2_init(115200);

#define addr 0x20

print(USART2, "reset\n"); 
I2C_LowLevel_Init();
print(USART2, "i2c initialized\n");

uint8_t msg1[2] = {0x01,0xfe};
uint8_t msg2[2] = {0x13,0x1};
uint8_t msg3[2] = {0x13,0x0};

    I2C_WrBuf(addr,msg1,2);
        delay_ms(1000);

while (1)
  {
  print(USART2, "toggle bit\n");
        I2C_WrBuf(addr,msg2,2);
        delay_ms(1000);
        I2C_WrBuf(addr,msg3,2);
        delay_ms(1000);

  }


}

