Hello! Trying compile my KL25z program but still getting this kind of errors. What I was able to find is that I need chip-specific header (.h). Which exactly for my board? Also, do I need any extra libraries?
Edit: is it mkl25z4.h? If yes, how to add this from github to mbed compiler?
#include <mbed.h>
#include <stdint.h>
#include <stdlib.h>
void Delay(unsigned long counter); // used to add delay
int main(void)
{
SYSCTL->RCGCGPIO |= 0x20; /* enable clock to GPIOF */
GPIOF->DIR |= 0x0E; //set PF1, PF2 and PF3 as digital output pin
GPIOF->DEN |= 0x0E; // CON PF1, PF2 and PF3 as digital GPIO pins
Delay(10);
while(1)
{
char c = Sensor_Read(); //Sensor Value read
if( sensor1_1==1 || sensor1_2==1 || sensor1_3==1 || sensor1_4==1 ){//Pedestrain Sensor
GPIOF->DATA |=(1<<1);//Output Red Light Lights
}
else if(sensor2_1==1 || sensor2_2==1 || sensor2_3==1 || sensor2_4==1){//Car count Sensor
GPIOF->DATA &=~(1<<1);//Output Green Lights
}
else if( sensor3==1){
GPIOF->DATA |=(1<<2);//Output Red and Amber Lights
}
}
}
void Traffic_Light(void)
{
SYSCTL->RCGCUART |= 0x20; /* enable clock to UART5 /
SYSCTL->RCGCGPIO |= 0x10; / enable clock to PORTE for PE4/Rx and RE5/Tx /
Delay(1);
/ UART5 TX5 and RX5 use PE4 and PE5. Configure them digital and enable alternate function /
GPIOE->DEN = 0x30; / set PE4 and PE5 as digital /
GPIOE->AFSEL = 0x30; / Use PE4,PE5 alternate function /
GPIOE->AMSEL = 0; / Turn off analg function*/
GPIOE->PCTL = 0x00110000; /* configure PE4 and PE5 /
}
char Operation(void)
{
while(1)
{
if(p2.b0==1 || p2.b1==1 ||p2.b2==1 || p2.b3==1)//Sensor Values Count
p3.b0=1;//Traffic light Glow
delay(60000);//60sec delay
p3.b0=1;
p3.b1=1;
delay(20000);//20 sec delay
p3.b2=1;
if(p2.b4==1 || p2.b5==1 ||p2.b6==1 || p2.b7==1)
p3.b2=1;
delay(60000);//60 sec delay
p3.b1=1;
delay(20000);//20 sec delay
p3.b0=1;
if(p3.b3==1)
p3.b0=1;
p3.b1=1;
}
}
##Initialiae the Dealy Factor
void Delay(unsigned long counter)
{
unsigned long i = 0;
for(i=0; i< counter; i++);
}