Esempio n. 1
0
TestDisplay::TestDisplay(WhichDisplay which) : 
    _initStr(NULL),
    _lcdCfg(NULL),
    _lcdBoard(P0_27, P0_28),
    _touch(P0_27, P0_28, P2_25) {
    
    switch (which) {
        case TFT_5:
            _lcdCfg = new LcdController::Config(LCD_CONFIGURATION_50);
            _initStr = LCD_INIT_STRING_50;
            break;
        case TFT_4_3:
            _lcdCfg = new LcdController::Config(LCD_CONFIGURATION_43);
            _initStr = LCD_INIT_STRING_43;
            break;
        default:
            mbed_die();
    }
            
    if (sdram_init() == 1) {
        printf("Failed to initialize SDRAM\n");
        _framebuffer = 0;
    } else {
        _framebuffer = (uint32_t) malloc(_lcdCfg->width * _lcdCfg->height * 2 * 3); // 2 is for 16 bit color, 3 is the number of buffers
        if (_framebuffer != 0) {
            memset((uint8_t*)_framebuffer, 0, _lcdCfg->width * _lcdCfg->height * 2 * 3);
        }
    }
}
Esempio n. 2
0
void os_error (uint32_t err_code) {
  /* This function is called when a runtime error is detected. Parameter */
  /* 'err_code' holds the runtime error code (defined in RTL.H).         */
    mbed_die();

  /* HERE: include optional code to be executed on runtime error. */
  for (;;);
}
Esempio n. 3
0
 Httpd::Httpd(int i_port_number)
 {
     if(!NyLPC_cHttpd_initialize((NyLPC_TcHttpd_t*)(&this->_inst),(NyLPC_TUInt16)i_port_number)){
     	mbed_die();
     }
     this->_inst._parent=this;
     this->_inst.super.function.onRequest=onRequestHandler;
 }
Esempio n. 4
0
 UdpSocket::UdpSocket(unsigned short i_port,bool i_nobuffer)
 {
 	if(i_nobuffer){
     	this->_inst=NyLPC_cNet_createUdpSocketEx(i_port,NyLPC_TSocketType_UDP_NOBUF);
 	}else{
 		this->_inst=NyLPC_cNet_createUdpSocketEx(i_port,NyLPC_TSocketType_UDP_NORMAL);
 	}
 	if(this->_inst==NULL){
 		mbed_die();
 	}
 }
Esempio n. 5
0
WEAK void mbed_die_advanced(uint32_t err_code) {

#ifndef NRF51_H
	__disable_irq();	// dont allow interrupts to disturb the flash pattern
#endif
#if   (DEVICE_ERROR_RED == 1)
    mbed_die();
#elif (DEVICE_ERROR_PATTERN == 1)
    gpio_t led_1; gpio_init_out(&led_1, LED1);
    gpio_t led_2; gpio_init_out(&led_2, LED2);
    gpio_t led_3; gpio_init_out(&led_3, LED3);
    gpio_t led_4; gpio_init_out(&led_4, LED4);
	uint32_t i = 0;
	// Show this is advanced die
	for(i=0 ;i<4; i++) {
		gpio_write(&led_1, 1);
		gpio_write(&led_2, 0);
		gpio_write(&led_3, 1);
		gpio_write(&led_4, 0);
		wait_ms(150);
		gpio_write(&led_1, 0);
		gpio_write(&led_2, 1);
		gpio_write(&led_3, 0);
		gpio_write(&led_4, 1);
		wait_ms(150);
	}
	i = 0;
	while (1) {
		gpio_write(&led_1, i&0x01);
		gpio_write(&led_2, (i>>1)&0x01);
		gpio_write(&led_3, (i>>2)&0x01);
		gpio_write(&led_4, (i>>3)&0x01);
		i++;
		if(i>err_code)
			i = 0;
		wait_ms(150);
	}
#endif
}
Esempio n. 6
0
void sysThreadError(osStatus status) {
    if (status != osOK) {
        mbed_die();
    }
}
Esempio n. 7
0
void os_error (uint32_t err_code) {
    /* This function is called when a runtime error is detected. Parameter     */
    /* 'err_code' holds the runtime error code (defined in RTX_Conf.h).      */
    mbed_die();
}
Esempio n. 8
0
void exit(int status) {
  TDLOG("!!! EXIT !!! status(%d)\r\n\r\n", status);
  mbed_die();
  while(1);
}
Esempio n. 9
0
void sysThreadError(osStatus status) {
    if (status != osOK) {
		DiagPrintf("sysThreadError : 0x%x\n", status);
        mbed_die();
    }
}
Esempio n. 10
0
/*---------------------------------------------------------------------------*
 * Routine:  sys_sem_signal
 *---------------------------------------------------------------------------*
 * Description:
 *      Signals (releases) a semaphore
 * Inputs:
 *      sys_sem_t sem           -- Semaphore to signal
 *---------------------------------------------------------------------------*/
void sys_sem_signal(sys_sem_t *data) {
    if (osSemaphoreRelease(data->id) != osOK)
        mbed_die(); /* Can be called by ISR do not use printf */
}