Esempio n. 1
0
/*
 * Name         : GPIO_init - Initialize gpio assignemnt check 
 *
 * Scope        : PUBLIC
 *
 * Arguments    : none
 *
 * Description  : Initialize the GPIO assignemnt check variables
 *
 * Returns      : void
 *
 */
void GPIO_init( void )
{
#if DEVELOPMENT__NO_OTP
#warning "GPIO assignment checking is active! Deactivate before burning OTP..."
    
    int i, j;

    for (i = 0; i < NO_OF_PORTS; i++)
        for (j = 0; j < NO_OF_MAX_PINS_PER_PORT; j++)
            GPIO[i][j] = 0;
    
    GPIO_reservations();
    
    GPIO_status = 0;
    
    for (i = 0; i < NO_OF_PORTS; i++)
        for (j = 0; j < NO_OF_MAX_PINS_PER_PORT; j++) {
            uint16_t bitmask = (1 << j);
            
            if ( !(p_mask[i] & bitmask) ) // port pin does not exist! continue to next port...
                break;
            
            if (GPIO[i][j] == -1)
                __asm("BKPT #0\n"); // this pin has been previously reserved!
            
            if (GPIO[i][j] == 0)
                continue;
            
            GPIO_status |= ((uint64_t)GPIO[i][j] << j) << (i * 16);
        }
#endif    
}
Esempio n. 2
0
/**
 ****************************************************************************************
 * @brief Callback function, called when external wakeup function is triggered.
 *
 * @return void.
 ****************************************************************************************
 */
void ext_wakeup_cb(void)
{ 	
	if (GetBits16(SYS_STAT_REG, PER_IS_DOWN)) {
		// Return GPIO functionality from external wakeup GPIO
#if DEVELOPMENT_DEBUG
		GPIO_reservations();
#endif		
		set_pad_functions();
  } 
	
	SetBits32(GP_CONTROL_REG, BLE_WAKEUP_REQ, 1);
}