Do you have a variable within your application class that refers to the Device class?
Yes, i defined it in the base screen init method, so the istance of the device is initiated and it is accesible from the screens related to it.
you can check if the 'hspi2' that you are using within the native code is the same that you are using in your C code.
The SPI_HandleTypeDef hspi2 is inserted in the inline code of the device block, in the application folder. it is a the bottom so in the Application. C is inserted right afer EW includes
/*******************************************************************************
*
* E M B E D D E D W I Z A R D P R O J E C T
*
* Copyright (c) TARA Systems GmbH
* written by Paul Banach and Manfred Schweyer
*
********************************************************************************
*
* This file was generated automatically by Embedded Wizard Studio.
*
* Please do not make any modifications of this file! The modifications are lost
* when the file is generated again by Embedded Wizard Studio!
*
* The template of this heading text can be found in the file 'head.ewt' in the
* directory 'Platforms' of your Embedded Wizard installation directory. If you
* wish to adapt this text, please copy the template file 'head.ewt' into your
* project directory and edit the copy only. Please avoid any modifications of
* the original template file!
*
* Version : 12.03
* Profile : Profile
* Platform : STM.STM32.RGB565
*
*******************************************************************************/
#include "ewlocale.h"
#include "_ApplicationBootScreen.h"
#include "_ApplicationDeviceClass.h"
#include "_ApplicationFullStackGui.h"
#include "_ApplicationHomeScreen.h"
#include "_ApplicationScreenBase.h"
#include "_ApplicationSettingScreen.h"
#include "_CoreGroup.h"
#include "_CoreView.h"
#include "_EffectsInt32Effect.h"
#include "_EffectsSlideTransition.h"
#include "_EffectsTransition.h"
#include "_ResourcesBitmap.h"
#include "_ResourcesFont.h"
#include "_ViewsImage.h"
#include "_ViewsRectangle.h"
#include "_ViewsText.h"
#include "_WidgetSetPushButton.h"
#include "_WidgetSetPushButtonConfig.h"
#include "_WidgetSetValueDisplay.h"
#include "_WidgetSetValueDisplayConfig.h"
#include "Application.h"
#include "Core.h"
#include "Resources.h"
#include "Views.h"
#include "WidgetSet.h"
/* Compressed strings for the language 'Default'. */
EW_CONST_STRING_PRAGMA static const unsigned int _StringsDefault0[] =
{
0x000000C4, /* ratio 69.39 % */
0xB8000F00, 0x80084452, 0x00C60030, 0x21A00358, 0x88458183, 0x0740041C, 0x2F001940,
0x90015000, 0x8B1B4006, 0x8038010D, 0x1B226438, 0x00C4008E, 0x62B13390, 0xDC0037C7,
0x9100AC84, 0x679944C9, 0x9899D400, 0x000822F3, 0xBC9E4053, 0x0025D0A8, 0x361B3298,
0x6611B880, 0x01439CCE, 0x9179B4FC, 0x1005C84C, 0x68AC5E83, 0x39802714, 0x2C401521,
0x4C2CB2B2, 0x36C51796, 0x22F10044, 0x4367964B, 0x00080DCA, 0x00000000
};
/* Constant values used in this 'C' module only. */
static const XRect _Const0000 = {{ 0, 0 }, { 800, 480 }};
static const XRect _Const0001 = {{ 481, 16 }, { 778, 48 }};
static const XColor _Const0002 = { 0x00, 0x00, 0x00, 0xFF };
static const XRect _Const0003 = {{ 252, 224 }, { 549, 256 }};
static const XRect _Const0004 = {{ 21, 78 }, { 171, 128 }};
static const XStringRes _Const0005 = { _StringsDefault0, 0x0002 };
static const XRect _Const0006 = {{ 198, 78 }, { 588, 128 }};
static const XStringRes _Const0007 = { _StringsDefault0, 0x0009 };
static const XRect _Const0008 = {{ 198, 128 }, { 588, 178 }};
static const XStringRes _Const0009 = { _StringsDefault0, 0x0015 };
static const XRect _Const000A = {{ 198, 178 }, { 588, 228 }};
static const XStringRes _Const000B = { _StringsDefault0, 0x0023 };
static const XRect _Const000C = {{ 460, 103 }, { 644, 203 }};
static const XColor _Const000D = { 0xFF, 0x3B, 0x2D, 0xFF };
static const XRect _Const000E = {{ 477, 128 }, { 627, 178 }};
static const XStringRes _Const000F = { _StringsDefault0, 0x0038 };
static const XRect _Const0010 = {{ 477, 279 }, { 627, 329 }};
static const XStringRes _Const0011 = { _StringsDefault0, 0x0045 };
static const XRect _Const0012 = {{ 100, 103 }, { 297, 220 }};
static const XStringRes _Const0013 = { _StringsDefault0, 0x0050 };
static const XRect _Const0014 = {{ 100, 204 }, { 300, 236 }};
static const XStringRes _Const0015 = { _StringsDefault0, 0x005A };
/* User defined inline code: 'Application::SINERGO_bsp' */
/*
TO DO:
Include external header files or add type and function declarations needed
in the implementation of Application::DeviceClass. For example:
#include "DeviceDriver.h"
#include "your_middleware_api.h"
void Your_Middleware_Some_Function( int aSomeArg );
*/
#include "SINERGO_bsp.h"
#include "stdbool.h"
SPI_HandleTypeDef hspi2; //<--------------------------here
So i'm sure it is defined and available.
I can share my project with you if needed.
Thanks