#include "compiler.h"
/*#include "mb90495.h"
#include "vectors.h"
#include "can.h"
#include "hardware.h"
#include "timer.h"
#include "eeprom.h"
#include "pcantools.h"
#include "uart1.h"
#include "main.h"
#include "mcan.h"
#include "adi.h"
#include "hardware.h"
#include "I2C_2.h"
#include "I2C_3.h"
#include "I2C.h" */
#include "convert_number.h"

#define __MAX_INT_CHARS 7
static const char tab[16]={0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46};
static u8_t a[__MAX_INT_CHARS];
/****************************************************************/

u8_t* itoa(s16_t i)
{
   
   u8_t* b = a + sizeof(a) - 1;
   s16_t   sign = (i < 0);

   if (sign)
      i = -i;
   *b = 0;
   do
   {
      *--b = '0' + (i % 10);
      i /= 10;
   }
   while (i);
   if (sign)
      *--b = '-';

   return b;
} 

u8_t* uitoa(u16_t i)
{
//   static char a[__MAX_INT_CHARS];
   u8_t *b = a + sizeof(a) - 1;
   *b = 0;
   do
   {
      *--b = '0' + (i % 10);
      i /= 10;
   }
   while (i);

   return b;
} 


u8_t* itoa_hex(u16_t i)
{
   //static char a[__MAX_INT_CHARS];
   u8_t *b = a + sizeof(a) - 1;
   *b = 0;
   do
   {
//      *--b = '0' + (i % 10);
	  *--b = tab[i % 16];
      i /= 16;
   }
   while (i);
   return b;
} 
