/* Parameters: irq irq number to be enabled (the irq number NOT the vector number)  */
void enable_irq(int irq)
/* Parameters: irq irq number to be enabled (the irq number NOT the vector number)  */
void enable_irq(int irq)
{
    int div;
    div = irq/32;
    switch (div)
    {
    	case 0x0:
              NVICICPR0 = 1 << (irq%32);
              NVICISER0 = 1 << (irq%32);
              break;
    	case 0x1:
              NVICICPR1 = 1 << (irq%32);
              NVICISER1 = 1 << (irq%32);
              break;
    	case 0x2:
              NVICICPR2 = 1 << (irq%32);
              NVICISER2 = 1 << (irq%32);
              break;
    }              
}