General Category > Discussion - Software

IDE buglet? Does not display #ifdef/#endif stuff correctly

(1/1)

AndersG:
Noted this: I am playing with the USBHostHID2 sample as it will probably do exctly what we need if we adapt it to SPI. Now, having USART as well is handy for troubleshooting, so I did this in the USBHostHID2.h file:


--- Code: ---#ifndef _USBHostHID2_H_
#define _USBHostHID2_H_

#include "vos.h"

#define USE_SPI 1

/* FTDI:SHF Header Files */
#include "USB.h"
#include "USBHost.h"
#include "ioctl.h"
#include "UART.h"
#include "string.h"
#include "errno.h"
/* FTDI:EHF */

/* FTDI:SDC Driver Constants */
#define VOS_DEV_USBHOST_1 0
#define VOS_DEV_USBHOST_2 1
#define VOS_DEV_UART 2



#ifdef USE_SPI
#include "SPIMaster.h"
#define VOS_DEV_SPI_MASTER 3
#define VOS_NUMBER_DEVICES 4
#else
#define VOS_NUMBER_DEVICES 3
#endif
/* FTDI:EDC */

/* FTDI:SXH Externs */
/* FTDI:EXH */

#endif
--- End code ---

and in the *.c file:


--- Code: ---/* FTDI:SDH Driver Handles */
VOS_HANDLE hUSBHOST_1; // USB Host Port 1
VOS_HANDLE hUSBHOST_2; // USB Host Port 2
VOS_HANDLE hUART; // UART Interface Driver
#ifdef USE_SPI
VOS_HANDLE hSPI_MASTER; // SPIMaster Interface Driver
#endif
--- End code ---


etc. Problem is that the IDE grays out the "VOS_HANDLE hSPI_MASTER" even if USE_SPI is defined. The code is clearly included though, ie:


--- Code: --- message("Starting...\r\n");
#ifdef USE_SPI
message("With SPI...\r\n");
vos_dev_write(hSPI_MASTER, "With SPI...\r\n", 13, NULL);
#endif
--- End code ---

This is the latest tooldchain downloaded from your website.

FTDI Community:
Hello,

The graying out only works on a single file. It won't ever look in included files or in settings.

It will compile properly though.

Best Regards,
FTDI Community

AndersG:
OK. Good to know. Yes, it compiles correctly, but it is confusing :)

Navigation

[0] Message Index

Go to full version