FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  

News:

Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support


New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Author Topic: IDE buglet? Does not display #ifdef/#endif stuff correctly  (Read 7127 times)

AndersG

  • Newbie
  • *
  • Posts: 13
    • View Profile
IDE buglet? Does not display #ifdef/#endif stuff correctly
« on: November 09, 2020, 05:40:38 PM »

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: [Select]
#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

and in the *.c file:

Code: [Select]
/* 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


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: [Select]
message("Starting...\r\n");
#ifdef USE_SPI
message("With SPI...\r\n");
vos_dev_write(hSPI_MASTER, "With SPI...\r\n", 13, NULL);
#endif

This is the latest tooldchain downloaded from your website.
Logged
/AndersG

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 891
    • View Profile
Re: IDE buglet? Does not display #ifdef/#endif stuff correctly
« Reply #1 on: November 11, 2020, 04:36:46 PM »

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
Logged

AndersG

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: IDE buglet? Does not display #ifdef/#endif stuff correctly
« Reply #2 on: November 15, 2020, 04:00:40 PM »

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