/**********************************************************************************************
**Program Assignment: Driver for TM1638 digital tube
**Author : Wuwang
**Date : 2014.8.26 9:00
**Description : This is a driver for the board which is controled by thechip of tm1638.
The board has eight digital tubes which have eight segments and eight keys.
***********************************************************************************************/
#include "main.h" //#include "stm32f10x.h"
/*********************define and global variables*********************************************/
#define STB GPIO_Pin_0 //chip-select line
#define CLK GPIO_Pin_1 //clock line
#define DIO GPIO_Pin_2 //data line
#define Set(x) GPIO_SetBits(GPIOA,(x))//Sets the selected data port bits
#define Reset(x) GPIO_ResetBits(GPIOA,(x))//Resets the selected data port bits
#define Get(x) GPIO_ReadInputDataBit(GPIOA,(x))==SET //Read the specified input port pin
uint16_t const tm_dat[2][14]={ {'0','1','2','3','4','5',//the char and its segment code
'6','7','8','9','.','-','_',' '},
{0x3F,0x06,0x5B,0x4F,0x66,0x6D,
0x7D,0x07,0x7F,0x6F,0x80,0x40,
0x08,0x00}};
/****************************************************