/* Includes--------------------------------------------------------------*/
//#include "sysconfig.h"
#include "stm32f10x.h"
//#include "bsp_SIIC.h"
#include "bsp_RX8025.h"
/*
Private define-----------------------------------------------------------------------------*/
// 设备读写地址
#define RX8025_ADDR_READ 0x65
#define RX8025_ADDR_WRITE 0x64
// 设备寄存器地址
#define RX8025_ADDR_SECONDS 0x00
#define RX8025_ADDR_WEEK 0x30
#define RX8025_ADDR_DATES 0x40
#define RX8025_ADDR_MONTH 0x50
#define RX8025_ADDR_MINUTES 0x80
#define RX8025_ADDR_CONTROL1 0xE0
#define RX8025_ADDR_CONTROL2 0xF0
// 设备操作模式
#define RX8025_WRITE_MODE 0xF0
#define RX8025_READ_MODE 0xF0
#define RX8025_SIMP_READ_MODE 0x04
#define u8BAND(addr, u8num) ((addr & 0xF0000000)+0x2000000+((addr &0xFFFFF)<<5)+(u8num<<2))
#define MEM_ADDR(addr) *((volatile unsigned long *)(addr))
#define u8_ADDR(addr, u8num) MEM_ADDR(u8BAND(addr, u8num))
//IO口地址映射
#define GPIOA_ODR_Addr (GPIOA_BASE+12) //0x4001080C
#define GPIOB_ODR_Addr (GPIOB_BASE+12) //0x40010C0C
#define GPIOC_ODR_Addr (GPIOC_BASE+12) //0x4001100C
#define GPIOD_ODR_Addr (GPIOD_BASE+12) //0x4001140C
#define GPIOE_ODR_Addr (GPIOE_BASE+12) //0x4001180C
#define GPIOF_ODR_Addr (GPIOF_BASE+12) //0x40011A0C
#define GPIOG_ODR_Addr (GPIOG_BASE+12) //0x40011E0C
#define GPIOA_IDR_Addr (GPIOA_BASE+8) //0x40010808
#define GPIOB_IDR_Addr (GPIOB_BASE+8) //0x40010C08
#define GPIOC_IDR_Addr (GPIOC_BASE+8) //0x40011008
#define GPIOD_IDR_Addr (GPIOD_BASE+8) //0x40011408
#define GPIOE_IDR_Addr (GPIOE_BASE+8) //0x40011808
#define GPIOF_IDR_Addr (GPIOF_BASE+8) //0x40011A08
#define GPIOG_IDR_Addr (GPIOG_BASE+8) //0x40011E08
//IO口操作,只对单一的IO口!
//确保n的值小于16!
#define PAout(n) u8_ADDR(GPIOA_ODR_Addr,n) //输出
#define PAin(n) u8_ADDR(GPIOA_IDR_Addr,n) //输入
#define PBout(n) u8_ADDR(GPIOB_ODR_Addr,n) //输出
#define PBin(n) u8_ADDR(GPIOB_IDR_Addr,n) //输入