//======================================================
// LED
//======================================================
// File Name : common.h
// Function  : Common Header
//------------------------------------------------------
// Rev.01 2008.03.24 Takanaga Yamazaki
//------------------------------------------------------
// (C) Copyright 2008 Takanaga Yamazaki
//======================================================
// ---- License Information ----------------------------
// Anyone can FREELY use this code fully or partially
// under conditions shown below.
// 1. You should use this code under the GNU GPL.
// 2. You should remain this header text in your codes
//   including Copyright credit and License Information.
// 3. Your codes should inherit this license information.
//======================================================
// ---- Patent Notice ----------------------------------
// I have not cared whether this system (hw + sw) causes 
// infringement on the patent, copyright, trademark,
// or trade secret rights of others. You have all 
// responsibilities for determining if your designs
// and products infringe on the intellectual property
// rights of others, when you use technical information
// included in this system for your business.
//======================================================
// ---- Disclaimers ------------------------------------
// The function and reliability of this system are not 
// guaranteed. They may cause any damages to loss of
// properties, data, money, profits, life, or business.
// By adopting this sytem even partially, you assume
// all responsibility for its use.
//======================================================

#ifndef __COMMON_H__
#define __COMMON_H__

#define __DEBUG__

#include "stm32f10x_it.h"
#include "stm32f10x_lib.h"
#include "hw_config.h"

//----------------
// Define Type
//----------------
typedef unsigned char  UI08;
typedef unsigned short UI16;
typedef unsigned long  UI32;
typedef   signed char  SI08;
typedef   signed short SI16;
typedef   signed long  SI32;
typedef          int   SINT;
typedef double         FLOT;

//----------------
// Math Function
//----------------
#define _ACOS_  acos
#define _ASIN_  asin
#define _ATAN_  atan
#define _ATAN2_ atan2
#define _CEIL_  ceil
#define _COS_   cos
#define _COSH_  cosh
#define _EXP_   exp
#define _FABS_  fabs
#define _FLOOR_ floor
#define _FMOD_  fmod
#define _FREXP_ frexp
#define _FDEXP_ fdexp
#define _LOG_   log
#define _LOG10_ log10
#define _MODF_  modf
#define _POW_   pow
#define _SIN_   sin
#define _SINH_  sinh
#define _SQRT_  sqrt
#define _TAN_   tan
#define _TANH_  tanh

//---------------------
// Define Prototype
//---------------------
//
// main.c
//
void Handler_SysTick(void);
void Toggle_LED(void);

//
// hw_config.c
//
void Init_NVIC(void);
void Init_TIM4(void);
//
// message.c
//
void USB_Put_Str(UI08* str);
void USB_Put_CRLF(void);
void USB_Put_Int_UI32(UI32 num);
void USB_Put_Int_SI32(SI32 num);
void USB_Put_FLOT(FLOT fnum, UI32 digit_dec);

UI08* UI32toStr(UI32 value, UI08 *string, UI32 radix);
UI08* SI32toStr(SI32 value, UI08 *string, UI32 radix);
UI08* FLOTtoStr(FLOT fvalue, UI08 *string, UI32 digit_dec);

#endif

//======================================================
// End of Program
//======================================================
