Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Prototyped user type function returning error (Read 1320 times)
ChristIQ
Newbies
*
Offline


Posts: 2
Joined: Jul 13th, 2018
Prototyped user type function returning error
Jul 13th, 2018 at 7:03pm
Print Post  
I am having a problem where these functions of user type are prototypes by returning a error.

Code (C++)
Select All

/*
* Status codes, return from functions with datatype defined below
*/
typedef unsigned int STATUS;
#define SUCCESS              0
#define ERR_POWER_UP         1
#define ERR_SET_LED_MOD_FREQ 2
#define ERR_SET_INT_TIME     3
#define ERR_START_MEAS       4
#define ERR_FACTORY_SETTINGS 5
#define ERR_SPI_RECOVERY_SEQUENCE 6
#define ERR_UNKNOWN          7


//function prototypes that include user types////////////////////////////////////////////////////////////////////


STATUS setIntegrationTime(word);

STATUS startMeasurement();



STATUS setIntegrationTime(word t_int) {
	word rcv = 0;
	rcv = sendEPC(t_int);
	if (rcv == READ_IDLE) {
		rcv = sendEPC(WRITE_NOP);
		if (rcv == t_int) {
			//sendEPC(WRITE_NOP);   ////////////////////////////// in logic capture of eval sw
			return SUCCESS;
		}
	}

	return ERR_SET_INT_TIME;
}


STATUS startMeasurement() {
	if (sendEPC(WRITE_TRIGGER) == READ_IDLE) {
		if (sendEPC(WRITE_NOP) == WRITE_TRIGGER) { //required
												   //WAIT_AFTER_START_MEASUREMENT;
			return SUCCESS;
		}
	}
	return ERR_START_MEAS;
}
 




What I get is this:

Code
Select All
telo_940.ino: 65:1: error: 'STATUS' does not name a type
   #define ERR_SET_INT_TIME     3

telo_940.ino: 66:1: error: 'STATUS' does not name a type
   #define ERR_START_MEAS       4 



Any help would be greatly appreciated.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Prototyped user type function returning error
Reply #1 - Jul 13th, 2018 at 7:20pm
Print Post  
Hi,

Thanks for the clear report.

The prototypes have to exactly match the method signature.

I also found that the white space between each define and its value contained strange unicode chars. For example #define ERR_POWER_UP ??????? 1. I have changed the white space to tabs.



Code
Select All
typedef unsigned int STATUS;

#define SUCCESS					0
#define ERR_POWER_UP				1
#define ERR_SET_LED_MOD_FREQ		2
#define ERR_SET_INT_TIME			3
#define ERR_START_MEAS				4
#define ERR_FACTORY_SETTINGS		5
#define ERR_SPI_RECOVERY_SEQUENCE	6
#define ERR_UNKNOWN				7


STATUS setIntegrationTime(word t_int);
STATUS startMeasurement();


STATUS setIntegrationTime(word t_int) {
	word rcv = 0;
	rcv = sendEPC(t_int);
	if (rcv == READ_IDLE) {
		rcv = sendEPC(WRITE_NOP);
		if (rcv == t_int) {
			//sendEPC(WRITE_NOP);   ////////////////////////////// in logic capture of eval sw
			return SUCCESS;
		}
	}
	return ERR_SET_INT_TIME;
}


STATUS startMeasurement() {
	if (sendEPC(WRITE_TRIGGER) == READ_IDLE) {
		if (sendEPC(WRITE_NOP) == WRITE_TRIGGER) { //required
												   //WAIT_AFTER_START_MEASUREMENT;
			return SUCCESS;
		}
	}
	return ERR_START_MEAS;
}
 

« Last Edit: Jul 13th, 2018 at 7:22pm by Tim@Visual Micro »  
Back to top
IP Logged
 
ChristIQ
Newbies
*
Offline


Posts: 2
Joined: Jul 13th, 2018
Re: Prototyped user type function returning error
Reply #2 - Jul 13th, 2018 at 7:40pm
Print Post  
Thank you so very much!

I was hoping that VS would have caught those white space problems. It turned out that when I went to reopen the project VS prompt me to change the white space. 

Put the prototype was a clear oversight for me. 

Thank you!!

Chris
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint