/* Get interrupt vector priority level. 
Retrieves the priority level of the requested external interrupt or exception. */
enum system_interrupt_priority_level system_interrupt_get_priority(const enum system_interrupt_vector vector)
/* Get interrupt vector priority level. 
Retrieves the priority level of the requested external interrupt or exception. */
enum system_interrupt_priority_level system_interrupt_get_priority(const enum system_interrupt_vector vector)
{
	uint8_t register_num = vector / 4;
	uint8_t priority_pos = ((vector % 4) * 8) + (8 - __NVIC_PRIO_BITS);
	enum system_interrupt_priority_level priority = SYSTEM_INTERRUPT_PRIORITY_LEVEL_0;
	if (vector >= 0) {
		priority = (enum system_interrupt_priority_level)
				((NVIC->IP[register_num] >> priority_pos) & _SYSTEM_INTERRUPT_PRIORITY_MASK);
	} else if (vector == SYSTEM_INTERRUPT_SYSTICK) {
		priority = (enum system_interrupt_priority_level)
				((SCB->SHP[1] >> _SYSTEM_INTERRUPT_SYSTICK_PRI_POS) & _SYSTEM_INTERRUPT_PRIORITY_MASK);
	}
	return priority;
}