FTDI Community
General Category => Discussion - Software => Topic started by: AndersG 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:
#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:
/* 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:
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.
-
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
-
OK. Good to know. Yes, it compiles correctly, but it is confusing :)