I am attempting to compile some code, but am running into some problems that I cannot seem to figure out. Originally, I had three errors, but I have narrowed it down to one that I cannot seem to solve. There are three files I am working with right now: voltcon.c, mss_ace.c, and mss_ace.h. I have pasted the relevant code below:
Within mss_ace.c
void ACE_init( void )
{
/* Initialize driver's internal data. */
ace_init_flags();
/* Initialize the data structures used by conversion functions. */
ace_init_convert();
}
void ACE_configure_sdd
(
sdd_id_t sdd_id,
sdd_resolution_t resolution,
uint8_t mode,
sdd_update_method_t sync_update
)
{
...
}
Within mss_ace.h
typedef enum
{
SDD0_OUT = 0, /*!< Analog Module 0 Sigma Delta DAC */
SDD1_OUT = 1, /*!< Analog Module 1 Sigma Delta DAC */
SDD2_OUT = 2, /*!< Analog Module 2 Sigma Delta DAC */
NB_OF_SDD = 3
} sdd_id_t;
typedef enum
{
SDD_8_BITS = 0,
SDD_16_BITS = 4,
SDD_24_BITS = 8
} sdd_resolution_t;
#define SDD_CURRENT_MODE 1
#define SDD_VOLTAGE_MODE 0
#define SDD_RETURN_TO_ZERO 0
#define SDD_NON_RTZ 2
typedef enum
{
INDIVIDUAL_UPDATE = 0,
SYNC_UPDATE = 1
} sdd_update_method_t;
void ACE_init(void);
void ACE_configure_sdd(sdd_id_t sdd_id, sdd_resolution_t resolution, uint8_t mode, sdd_update_method_t sync_update);
Within voltcon.c
#include <stdint.h>
#include <math.h>
#include <string.h>
#include <stdio.h>
#include "../../N3V2_hardware/biarri/firmware/drivers/mss_ace/mss_ace.h"
sdd_id_t this_sdd_id = SDD0_OUT;
sdd_resolution_t this_sdd_resolution = SDD_16_BITS;
uint8_t this_mode = SDD_VOLTAGE_MODE;
sdd_update_method_t this_sdd_update_method = INDIVIDUAL_UPDATE;
void ACE_init();
void ACE_configure_sdd(this_sdd_id, this_sdd_resolution, this_mode, this_sdd_update_method);
The error I am getting is as follows:
voltcon.c: error: #92: identifier-list parameters may only be used in a function definition
What this error says to me is that it probably has to do with the third argument to my function.
—Update—
The error is caused by the last line in the code (the void ACE_configure_sdd one). My apologies on that. The #92 is just a code, it doesn’t refer to the actual lines of code.
Try deleting the declaration of
ACE_configure_sddfromvoltcon.c. As it is already there inmss_ace.h.It seems you are trying to call
ACE_configure_sddfromvoltcon.cbut incyou can only call a function from inside of another function.You can try doing this in
voltcon.c:now func1 can be called from some other function in your code or main() itself.
Hope this helps.