what is this STATIC BYTE be doing here?

Status
Not open for further replies.

sachinkp21587

Member level 2
Joined
Mar 15, 2010
Messages
51
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
india (U.P.)
Visit site
Activity points
1,703
i am working on keil IDE using realview mdk-arm for a project based on LPC1768

i made a header file as below
Code:
#ifndef _test_h
#define _test_h

#include "diskio.h"
#include "spi.h"
#include "type.h"
#include "LPC17xx.h"

#define rcvr_spi()		xchg_spi(0xFF)

static
BYTE xchg_spi (BYTE dat);

#endif

and a .c file as follows
Code:
#include "test.h"

static volatile
DSTATUS Stat = STA_NOINIT;	/* Disk status */

static volatile
UINT Timer1, Timer2;		/* 1000Hz decrement timer */

static
UINT CardType;

#define xmit_spi(dat) 	xchg_spi(dat)

//#define rcvr_spi_m(p)	SPI2BUF = 0xFF; while (!SPI2STATbits.SPIRBF); *(p) = (BYTE)SPI2BUF;
#define rcvr_spi_m(p)	*(p) = xchg_spi(0XFF);

static
BYTE xchg_spi (BYTE dat)
{
	return (BYTE)SPISend((uint8_t) dat);
}

now i made a main file in which i included this header file.
also by browsing added the c file to projects folder.

now when i make a call to xchg_spi there occurs an error saying

test.h(12): error: #114: function "xchg_spi" was referenced but not defined

the above compiles without any errors when the static is removed.
why so?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…