main.c
45 lines
| 985 B
| text/x-c
|
CLexer
jeandet@PC-DE-JEANDET.lab-lpp.local
|
r22 | #include <stdio.h> | ||
#include <fat32.h> | ||||
#include <gpio.h> | ||||
#include <uart.h> | ||||
#include <stm32f4xx.h> | ||||
#include <bsp.h> | ||||
#include <i2c.h> | ||||
extern streamdevice* __opnfiles__[]; | ||||
int main() | ||||
{ | ||||
//gpioset(PSU_DISABLE); | ||||
jeandet@PC-DE-JEANDET.lab-lpp.local
|
r24 | gpio_t dacRst=gpioopen(PD4); | ||
gpiosetspeed(&dacRst,gpiohighspeed); | ||||
gpiosetdir(&dacRst,gpiooutdir); | ||||
gpioset(dacRst); | ||||
jeandet@PC-DE-JEANDET.lab-lpp.local
|
r22 | printf("i2C Control register 1 (I2C_CR1) = %x\n\r",I2C1->CR1); | ||
printf("i2C Control register 2 (I2C_CR2) = %x\n\r",I2C1->CR2); | ||||
printf("i2C Status register 1 (I2C_SR1) = %x\n\r",I2C1->SR1); | ||||
printf("i2C Status register 2 (I2C_SR2) = %x\n\r",I2C1->SR2); | ||||
printf("i2C Clock control register (I2C_CCR) = %x\n\r",I2C1->CCR); | ||||
while(1) | ||||
{ | ||||
for(volatile int i=0;i<1024*2048;i++); | ||||
gpioset(LED1); | ||||
gpioclr(LED2); | ||||
for(volatile int i=0;i<1024*2048;i++); | ||||
gpioclr(LED1); | ||||
gpioset(LED2); | ||||
jeandet@PC-DE-JEANDET.lab-lpp.local
|
r24 | i2cwrite(i2c1,0x4a,"test",1); | ||
jeandet@PC-DE-JEANDET.lab-lpp.local
|
r22 | } | ||
printf("hello world\n\r"); | ||||
return 0; | ||||
} | ||||