5 years, 2 months ago.

Keil compiler error.

I can compile my program without errors when I use the MBED on-line compiler. I exported it to Keil (after numerous problems doing so). When I compile using either Keil V5 or Keil V4 I receive the following message: -

ADXL345.cpp (14) : error : #29: expected an expression The code is : -

  • 014 ADXL345::ADXL345(PinName mosi, PinName miso, PinName sck, PinName cs) : spi_(mosi, miso, sck,), nCS_(cs)
  • 015 {
  • 016 spi_.frequency(2000000);
  • 017 spi_.format(8,3);
  • 018 nCS_ = 1;
  • 019 wait_us(500);
  • 020 }

The following is in the include file: -

class ADXL345 {

public:

  • Constructor.
  • @param mosi mbed pin to use for MOSI line of SPI interface.
  • @param miso mbed pin to use for MISO line of SPI interface.
  • @param sck mbed pin to use for SCK line of SPI interface.
  • @param cs mbed pin to use for not chip select line of SPI interface.

ADXL345(PinName mosi, PinName miso, PinName sck, PinName cs);

Can somebody please help before I lose what little hair I have left!

Sorry to waste everybody,s time. There was a comma after sck and so the compiler was looking for another expression. Everything is fine now.

posted by Julian Cox 12 Nov 2014
Be the first to answer this question.