123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- #include <stdarg.h>
- #include "yc11xx.h"
- #include "ycdef.h"
- #include "yc11xx_uart.h"
- #include "yc11xx_gpio.h"
- #include "iic.h"
- #include "systick.h"
- void LED_Run(void)
- {
- static uint32_t times = 0;
- times++;
- if(times>0x50000)
- {
- times = 0;
- GPIO_CONFIG(2) = (GPIO_CONFIG(2)==GPCFG_OUTPUT_HIGH)? GPCFG_OUTPUT_LOW: GPCFG_OUTPUT_HIGH;
- }
- }
- #define IIC_SCL_GPIO_NUM 25
- #define IIC_SDA_GPIO_NUM 6
- #define I2CBUFSIZE 256
- void debug_print(uint32_t data)
- {
- USART_SendData(UARTB,(data>>24) & 0xff);
- USART_SendData(UARTB,(data>>16) & 0xff);
- USART_SendData(UARTB,(data>>8 ) & 0xff);
- USART_SendData(UARTB,(data>>0 ) & 0xff);
- }
- int main(void)
- {
- systick_init();
- UartxInit(UARTB);
- delay_ms(1000);
- printf("\r\n *******This is IIC TEST********\n");
-
-
-
- uint8_t src_w[10]={0xa0,0x00,'a','b','c','d','e','f','g','h'};
-
-
-
- uint8_t src_r[3]={0xa0,0x00,0xa1};
- uint8_t data[9]={"None"};
- data[8]='\0';
-
- IIC_SendData(src_w,10);
- printf("Initial dest: %s\n", data);
- IIC_ReceiveData(src_r,3,data,8);
- printf("End dest:%s\n", data);
- while(1)
- {
-
- }
- }
|