void PCF8563Init(void) { uint8_t len; uint8_t falarm=0; IICReadByte(PCF8563ADDR, Alarm, &falarm); if (falarm != 0x07) { Pcf8563SetTime(C8563store); IICWriteByte(PCF8563ADDR,0x00, 0x00); IICWriteByte(PCF8563ADDR,0x0a, 0x07);//alarm 8:00 IICWriteByte(PCF8563ADDR,0x01,0x12);//alarm enable #ifdef Debug sprintf(pcf, "%s","pcf set..\r\n"); len = strlen(pcf); UartDMAQueue(qUartLink,(uint8_t*)pcf,len); //printf("pcf seting"); #endif } else { //Pcf8563ReadTime(g853); #ifdef Debug //printf("pcf reading"); sprintf(pcf, "%s","pcf on..\r\n"); len = strlen(pcf); UartDMAQueue(qUartLink,(uint8_t*)pcf,len); #endif Pcf8536RT(); //printf("%d:%d:%d",g853[2],g853[1],g853[0]); } }
int HwMTV335Initialize(unsigned int video_system) { int i; unsigned char val; int reg_template_num; switch (video_system) { case NTSC: reg_template_num = sizeof (mtv335_init_ntsc) /sizeof (mtv335_init_ntsc[0] ); for (i = 0; i < reg_template_num; i += 2) { //write the values to the registers if (IICWriteByte(MTV335_IIC_ADDR, mtv335_init_ntsc[i], mtv335_init_ntsc[i + 1], 0) == IIC_ERROR) { return FAILED; } } /* for (i = 0; i < reg_template_num; i += 2) { //read the registers if (IICReadByte(MTV335_IIC_ADDR, mtv335_init_ntsc[i], &val, 0) == IIC_ERROR) { return FAILED; } } */ break; case PAL: reg_template_num = sizeof (mtv335_init_pal) /sizeof (mtv335_init_pal[0] ); for (i = 0; i < reg_template_num; i += 2) { //write the values to the registers if (IICWriteByte(MTV335_IIC_ADDR, mtv335_init_pal[i], mtv335_init_pal[i + 1], 0) == IIC_ERROR) { return FAILED; } } /* for (i = 0; i < reg_template_num; i += 2) { //read the registers if (IICReadByte(MTV335_IIC_ADDR, mtv335_init_pal[i], &val, 0) == IIC_ERROR) { return FAILED; } } */ break; case LCD: reg_template_num = sizeof (mtv335_init_480x240) /sizeof (mtv335_init_480x240[0] ); for (i = 0; i < reg_template_num; i += 2) { //write the values to the registers if (IICWriteByte(MTV335_IIC_ADDR, mtv335_init_480x240[i], mtv335_init_480x240[i + 1], 0) == IIC_ERROR) { return FAILED; } } /* for (i = 0; i < reg_template_num; i += 2) { //read the registers if (IICReadByte(MTV335_IIC_ADDR, mtv335_init_480x240[i], &val, 0) == IIC_ERROR) { return FAILED; } } */ break; default: reg_template_num = sizeof (mtv335_init_480x240) /sizeof (mtv335_init_480x240[0] ); for (i = 0; i < reg_template_num; i += 2) { //write the values to the registers if (IICWriteByte(MTV335_IIC_ADDR, mtv335_init_480x240[i], mtv335_init_480x240[i + 1], 0) == IIC_ERROR) { return FAILED; } } /* for (i = 0; i < reg_template_num; i += 2) { //read the registers if (IICReadByte(MTV335_IIC_ADDR, mtv335_init_480x240[i], &val, 0) == IIC_ERROR) { return FAILED; } } */ break; } return SUCCESSFUL; }