General Category > Discussion - EVE

How to create a new Host Platform (e.g. Arduino) for EVE Screen Designer

<< < (3/3)

karst.drenth:
Here comes the HALimpl :)

It is based upon Rudolph's Arduino Library as an API to the Arduino.

The App_Generated.c file is output from ESD. It just needs commenting out the "main()" function and the Application definition.

like this:


--- Code: ---//static App application;
//static Esd_Context s_Esd;

void App__Start(App *context)
{
App__Initializer(context);
App_Start(context);
}

//int main(int argc, char *argv[])
//{
// Esd_Initialize();
//
// {
// Esd_Parameters ep;
// Esd_Defaults(&ep);
// ep.UserContext = &application;
// ep.Start = (Esd_Callback)App__Start;
// ep.Update = (Esd_Callback)App_Update;
// ep.Render = (Esd_Callback)App_Render;
// ep.Idle = (Esd_Callback)App_Idle;
// ep.End = (Esd_Callback)App_End;
// if (!Esd_Open(&s_Esd, &ep))
// return EXIT_FAILURE;
// }
// Esd_Loop(&s_Esd);
// Esd_Close(&s_Esd);
//
// Esd_Release();
// return EXIT_SUCCESS;
//}

--- End code ---

which is then replaced in the .ino by:


--- Code: ---void setup()
{
pinMode     (SWITCH,  INPUT);

pinMode (EVE_PDN, OUTPUT); // keep EVE in Reset (PD ==> PowerDown)
digitalWrite(EVE_PDN, LOW);

pinMode (PIN_SPI_SS, OUTPUT);
digitalWrite(PIN_SPI_SS, HIGH); // deselect EVE

pinMode (PIN_SPI1_SS, OUTPUT);
digitalWrite(PIN_SPI1_SS, HIGH); // deselect Flash

pinMode (PIN_SPI2_SS, OUTPUT);
digitalWrite(PIN_SPI2_SS, HIGH); // deselect FPC

pinMode     (LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);

SerialUSB.begin(115200); // USB
Serial1 .begin(  9600); // ES_Link
Serial2  .begin( 16667); // LocoNet

Flash.begin(SPI1, PIN_SPI1_SS); // SerialFlash does the SPI startup by itself

SPI2.begin(); // start the display SPI
init_ST7701_Display(); // configure and start the display

SPI.begin(); // startup EVE's SPI
SPI.beginTransaction(EVE_SPI_SETTINGS);

TFT_init(); // Make EVE start working
TFT_display();

  delay(500);
arduino_printf("hello, Display is up :)");

int times = 180;
while (times--) {
  delay(26);
  TFT_display();
rotate += 2;
}

if (digitalRead(SWITCH) == 0) {
TFT_calibrate();
while (digitalRead(SWITCH) != 0);
while (digitalRead(SWITCH) == 0);
}

arduino_printf("hello, EVE is up :)");

Esd_Initialize();

Esd_Parameters ep;
Esd_Defaults(&ep);

ep.UserContext = &application;
ep.Start = (Esd_Callback)App__Start;
ep.Update = (Esd_Callback)App_Update;
ep.Render = (Esd_Callback)App_Render;
ep.Idle = (Esd_Callback)App_Idle;
ep.End = (Esd_Callback)App_End;

if (Esd_Open(&s_Esd, &ep)) {
EVE_HalContext* phost = &s_Esd.HalContext;
Esd_SetCurrent(&s_Esd);
Esd_Start(&s_Esd);

Esd_Started = true;

application.App_Screen.Main_Page.DDC_Logo_Input    = DDC_Logo_Input;
application.App_Screen.Main_Page.DCC_Logo_Rotation = DDC_Logo_Rotation;
}
else {
TFT_display();
}

SerialUSB.println("setup() done");
}


--- End code ---

that's "setup()"

and in "loop()"


--- Code: --- display_delay++;

// refresh the display every 20ms or 5 ms when ESD is running
if (display_delay > 4) {
display_delay = 0;

micros_start = micros();

if (Esd_Started) {
if (toggle_state != 0)
if (++rotate == 360)
rotate = 0;

Esd_Update (&s_Esd);
Esd_Render (&s_Esd);
Esd_WaitSwap(&s_Esd);
}
else
TFT_display();

micros_end = micros();

num_profile_a = (micros_end - micros_start); // calculate the micro-seconds passed during the call to TFT_display
}

--- End code ---

Grettz,
Karst

fr3ud:
Many thanks Karst.drenth ! Can't wait to test it ! Hopefully this weekend  ;D

Kaetemi:
You can add an additional platform implementation to the HAL library that ESD uses directly, add the appropriate presets to EVE_Config.h, and then modify Toolchain.config to specify the build commands, and Programmer.config to specify a programmer.

For ESD emulation, an ESD_SIMULATION compile flag is always set, which overrides whatever platform flags are set to use the desktop target for the emulator instead. You can also use this flag to hide any C coded hardware behaviour from ESD.

fr3ud:
I tried poking around but being a beginner I haven't be able to make it work.
ESD side seems good, it's on the arduino side with the

--- Code: ---ep.UserContext = &application;
--- End code ---
and all the Callback not being defined
I see them in the App_Generated.c and I inluded App.h in the beginning of my arduino program. But no chance

I'm using RudolphRiedel PlatformIO example, I added as libraries :

* Esd_Core
* Esd_WebStyle_Widgets
* FT_Esd_Framework
* FT_Esd_Widgets
* FT_Eve_Hal
* And all the ESD project specific generated files (App ,AppScreen,...)

Navigation

[0] Message Index

[*] Previous page

Go to full version