static LPC_GPIO_TypeDef (* const LPC_GPIO[4]) = { LPC_GPIO0, LPC_GPIO1, LPC_GPIO2, LPC_GPIO3 }; |
void GPIOSetDir( uint32_t portNum, uint32_t bitPosi, uint32_t dir ) |
int main(void){
uint8_t continuar=1,depurar=0;
struct sEventoTecla ev;
uint8_t continuar_a_calibracion;
SystemInit();
LED_init(); // Here is the hard fault
inicializarLedsEstadoCarga();
... (continues)
|
void LED_init(void){
uint8_t k;
leds[0].port=0;
leds[0].bit=3;
leds[1].port=0;
//leds[1].bit=5;
leds[1].bit=4;
leds[2].port=0;
//leds[2].bit=4;
leds[2].bit=5;
#if CONFIG_ENABLE_EXTRA_LEDS==1
leds[3].port=2;
leds[3].bit=7;
leds[4].port=2;
leds[4].bit=8;
leds[5].port=2;
leds[5].bit=9;
leds[6].port=2;
leds[6].bit=10;
leds[7].port=3;
leds[7].bit=3;
LPC_IOCON->R_PIO1_1=0x01|0<<3;
LPC_IOCON->PIO1_4=1<<3;
#endif
for (k=0;k smaller than NLED;k++){
GPIOSetDir(leds[k].port,leds[k].bit,1);// HERE is where hard fault happens. Pointer should be poiting 0x500n 0000, n:0,1,2,3
GPIOSetValue(leds[k].port,leds[k].bit,0);
leds[k].value=0;
leds[k].blink=0;
leds[k].nblink=0;
}
}
|