image/svg+xml
Brteve's API for EveApps
Version 0.0.1
The reference document for common folder of EveApps project.
 
Loading...
Searching...
No Matches
bt8xxemu.h File Reference

BT8XX Emulator Library. More...

Go to the source code of this file.

Data Structures

struct  BT8XXEMU_EmulatorParameters
 
struct  BT8XXEMU_FlashParameters
 

Macros

#define EVE_TCHAR_DEFINED
 
#define BT8XXEMU_VERSION_API   12
 
#define BT8XXEMU_API
 

Typedefs

typedef char eve_tchar_t
 
typedef void BT8XXEMU_Emulator
 
typedef void BT8XXEMU_Flash
 

Enumerations

enum  BT8XXEMU_LogType { BT8XXEMU_LogError = 0 , BT8XXEMU_LogWarning = 1 , BT8XXEMU_LogMessage = 2 }
 
enum  BT8XXEMU_EmulatorMode {
  BT8XXEMU_EmulatorFT800 = 0x0800 , BT8XXEMU_EmulatorFT801 = 0x0801 , BT8XXEMU_EmulatorFT810 = 0x0810 , BT8XXEMU_EmulatorFT811 = 0x0811 ,
  BT8XXEMU_EmulatorFT812 = 0x0812 , BT8XXEMU_EmulatorFT813 = 0x0813 , BT8XXEMU_EmulatorBT880 = 0x0880 , BT8XXEMU_EmulatorBT881 = 0x0881 ,
  BT8XXEMU_EmulatorBT882 = 0x0882 , BT8XXEMU_EmulatorBT883 = 0x0883 , BT8XXEMU_EmulatorBT815 = 0x0815 , BT8XXEMU_EmulatorBT816 = 0x0816 ,
  BT8XXEMU_EmulatorBT817 = 0x0817 , BT8XXEMU_EmulatorBT818 = 0x0818
}
 
enum  BT8XXEMU_EmulatorFlags {
  BT8XXEMU_EmulatorEnableKeyboard = 0x01 , BT8XXEMU_EmulatorEnableAudio = 0x02 , BT8XXEMU_EmulatorEnableCoprocessor = 0x04 , BT8XXEMU_EmulatorEnableMouse = 0x08 ,
  BT8XXEMU_EmulatorEnableDebugShortkeys = 0x10 , BT8XXEMU_EmulatorEnableGraphicsMultithread = 0x20 , BT8XXEMU_EmulatorEnableDynamicDegrade = 0x40 , BT8XXEMU_EmulatorEnableRegPwmDutyEmulation = 0x100 ,
  BT8XXEMU_EmulatorEnableTouchTransformation = 0x200 , BT8XXEMU_EmulatorEnableStdOut = 0x400 , BT8XXEMU_EmulatorEnableBackgroundPerformance = 0x800 , BT8XXEMU_EmulatorEnableMainPerformance = 0x1000 ,
  BT8XXEMU_EmulatorEnableHSFPreview = 0x2000
}
 
enum  BT8XXEMU_FrameFlags { BT8XXEMU_FrameBufferChanged = 0x01 , BT8XXEMU_FrameBufferComplete = 0x02 , BT8XXEMU_FrameChanged = 0x04 , BT8XXEMU_FrameSwap = 0x08 }
 

Functions

INIT
BT8XXEMU_API const char * BT8XXEMU_version ()
 
BT8XXEMU_API void BT8XXEMU_defaults (uint32_t versionApi, BT8XXEMU_EmulatorParameters *params, BT8XXEMU_EmulatorMode mode)
 
BT8XXEMU_API void BT8XXEMU_run (uint32_t versionApi, BT8XXEMU_Emulator **emulator, const BT8XXEMU_EmulatorParameters *params)
 
BT8XXEMU_API void BT8XXEMU_stop (BT8XXEMU_Emulator *emulator)
 
BT8XXEMU_API void BT8XXEMU_destroy (BT8XXEMU_Emulator *emulator)
 
BT8XXEMU_API int BT8XXEMU_isRunning (BT8XXEMU_Emulator *emulator)
 
RUNTIME
BT8XXEMU_API uint8_t BT8XXEMU_transfer (BT8XXEMU_Emulator *emulator, uint8_t data)
 
BT8XXEMU_API void BT8XXEMU_chipSelect (BT8XXEMU_Emulator *, int cs)
 
BT8XXEMU_API int BT8XXEMU_hasInterrupt (BT8XXEMU_Emulator *emulator)
 
ADVANCED
BT8XXEMU_API void BT8XXEMU_touchSetXY (BT8XXEMU_Emulator *emulator, int idx, int x, int y, int pressure)
 
BT8XXEMU_API void BT8XXEMU_touchResetXY (BT8XXEMU_Emulator *emulator, int idx)
 
BT8XXEMU_API int BT8XXEMU_setFlag (BT8XXEMU_Emulator *emulator, BT8XXEMU_EmulatorFlags flag, int value)
 
FLASH
BT8XXEMU_API void BT8XXEMU_Flash_defaults (uint32_t versionApi, BT8XXEMU_FlashParameters *params)
 
BT8XXEMU_API BT8XXEMU_FlashBT8XXEMU_Flash_create (uint32_t versionApi, const BT8XXEMU_FlashParameters *params)
 
BT8XXEMU_API void BT8XXEMU_Flash_destroy (BT8XXEMU_Flash *flash)
 
BT8XXEMU_API uint8_t BT8XXEMU_Flash_transferSpi4 (BT8XXEMU_Flash *flash, uint8_t signal)
 

Detailed Description

BT8XX Emulator Library.

Author
Jan Boon jan.b.nosp@m.oon@.nosp@m.kaete.nosp@m.mi.b.nosp@m.e
Date
2018

MIT License

Copyright (c) [2019] [Bridgetek Pte Ltd (BRTChip)]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Definition in file bt8xxemu.h.

Macro Definition Documentation

◆ BT8XXEMU_API

#define BT8XXEMU_API

Definition at line 73 of file bt8xxemu.h.

◆ BT8XXEMU_VERSION_API

#define BT8XXEMU_VERSION_API   12

Definition at line 52 of file bt8xxemu.h.

◆ EVE_TCHAR_DEFINED

#define EVE_TCHAR_DEFINED

Definition at line 43 of file bt8xxemu.h.

Typedef Documentation

◆ BT8XXEMU_Emulator

typedef void BT8XXEMU_Emulator

Definition at line 98 of file bt8xxemu.h.

◆ BT8XXEMU_Flash

typedef void BT8XXEMU_Flash

Definition at line 99 of file bt8xxemu.h.

◆ eve_tchar_t

typedef char eve_tchar_t

Definition at line 47 of file bt8xxemu.h.

Enumeration Type Documentation

◆ BT8XXEMU_EmulatorFlags

Enumerator
BT8XXEMU_EmulatorEnableKeyboard 

0x01; enables the keyboard to be used as input (default: on)

BT8XXEMU_EmulatorEnableAudio 

0x02; enables audio (default: on)

BT8XXEMU_EmulatorEnableCoprocessor 

0x04; enables coprocessor (default: on)

BT8XXEMU_EmulatorEnableMouse 

0x08; enables mouse as touch (default: on)

BT8XXEMU_EmulatorEnableDebugShortkeys 

0x10; enable debug shortkeys (default: on)

BT8XXEMU_EmulatorEnableGraphicsMultithread 

0x20; enable graphics processor multithreading (default: on)

BT8XXEMU_EmulatorEnableDynamicDegrade 

0x40; enable dynamic graphics quality degrading by reducing resolution and dropping frames (default: on)

BT8XXEMU_EmulatorEnableRegPwmDutyEmulation 

0x100; enable emulating REG_PWM_DUTY by fading the rendered display to black (default: off)

BT8XXEMU_EmulatorEnableTouchTransformation 

0x200; enable usage of touch transformation matrix (default: on) (should be disabled in editor)

BT8XXEMU_EmulatorEnableStdOut 

0x400; enable output to stdout from the emulator (default: off) (note: stdout is is some cases not thread safe)

BT8XXEMU_EmulatorEnableBackgroundPerformance 

0x800; enable performance adjustments for running the emulator as a background process without window (default: off)

BT8XXEMU_EmulatorEnableMainPerformance 

0x1000; enable performance adjustments for the main MCU thread (default: on)

BT8XXEMU_EmulatorEnableHSFPreview 

0x2000; enable HSF preview (default: on for bt817 and up, off otherwise)

Definition at line 128 of file bt8xxemu.h.

129{
137 // BT8XXEMU_EmulatorEnableRegRotate = 0x80, /**< 0x80; Now always on; enable usage of REG_ROTATE (default: off) */
144
BT8XXEMU_EmulatorFlags
Definition bt8xxemu.h:129
@ BT8XXEMU_EmulatorEnableCoprocessor
Definition bt8xxemu.h:132
@ BT8XXEMU_EmulatorEnableDebugShortkeys
Definition bt8xxemu.h:134
@ BT8XXEMU_EmulatorEnableStdOut
Definition bt8xxemu.h:140
@ BT8XXEMU_EmulatorEnableRegPwmDutyEmulation
Definition bt8xxemu.h:138
@ BT8XXEMU_EmulatorEnableHSFPreview
Definition bt8xxemu.h:143
@ BT8XXEMU_EmulatorEnableGraphicsMultithread
Definition bt8xxemu.h:135
@ BT8XXEMU_EmulatorEnableTouchTransformation
Definition bt8xxemu.h:139
@ BT8XXEMU_EmulatorEnableKeyboard
Definition bt8xxemu.h:130
@ BT8XXEMU_EmulatorEnableDynamicDegrade
Definition bt8xxemu.h:136
@ BT8XXEMU_EmulatorEnableMainPerformance
Definition bt8xxemu.h:142
@ BT8XXEMU_EmulatorEnableMouse
Definition bt8xxemu.h:133
@ BT8XXEMU_EmulatorEnableAudio
Definition bt8xxemu.h:131
@ BT8XXEMU_EmulatorEnableBackgroundPerformance
Definition bt8xxemu.h:141

◆ BT8XXEMU_EmulatorMode

Enumerator
BT8XXEMU_EmulatorFT800 

0x0800

BT8XXEMU_EmulatorFT801 

0x0801

BT8XXEMU_EmulatorFT810 

0x0810

BT8XXEMU_EmulatorFT811 

0x0811

BT8XXEMU_EmulatorFT812 

0x0812

BT8XXEMU_EmulatorFT813 

0x0813

BT8XXEMU_EmulatorBT880 

0x0880

BT8XXEMU_EmulatorBT881 

0x0881

BT8XXEMU_EmulatorBT882 

0x0882

BT8XXEMU_EmulatorBT883 

0x0883

BT8XXEMU_EmulatorBT815 

0x0815

BT8XXEMU_EmulatorBT816 

0x0816

BT8XXEMU_EmulatorBT817 

0x0817

BT8XXEMU_EmulatorBT818 

0x0818

Definition at line 110 of file bt8xxemu.h.

111{
112 BT8XXEMU_EmulatorFT800 = 0x0800,
113 BT8XXEMU_EmulatorFT801 = 0x0801,
114 BT8XXEMU_EmulatorFT810 = 0x0810,
115 BT8XXEMU_EmulatorFT811 = 0x0811,
116 BT8XXEMU_EmulatorFT812 = 0x0812,
117 BT8XXEMU_EmulatorFT813 = 0x0813,
118 BT8XXEMU_EmulatorBT880 = 0x0880,
119 BT8XXEMU_EmulatorBT881 = 0x0881,
120 BT8XXEMU_EmulatorBT882 = 0x0882,
121 BT8XXEMU_EmulatorBT883 = 0x0883,
122 BT8XXEMU_EmulatorBT815 = 0x0815,
123 BT8XXEMU_EmulatorBT816 = 0x0816,
124 BT8XXEMU_EmulatorBT817 = 0x0817,
125 BT8XXEMU_EmulatorBT818 = 0x0818,
BT8XXEMU_EmulatorMode
Definition bt8xxemu.h:111
@ BT8XXEMU_EmulatorFT811
Definition bt8xxemu.h:115
@ BT8XXEMU_EmulatorBT817
Definition bt8xxemu.h:124
@ BT8XXEMU_EmulatorBT883
Definition bt8xxemu.h:121
@ BT8XXEMU_EmulatorFT813
Definition bt8xxemu.h:117
@ BT8XXEMU_EmulatorFT800
Definition bt8xxemu.h:112
@ BT8XXEMU_EmulatorBT818
Definition bt8xxemu.h:125
@ BT8XXEMU_EmulatorBT880
Definition bt8xxemu.h:118
@ BT8XXEMU_EmulatorBT815
Definition bt8xxemu.h:122
@ BT8XXEMU_EmulatorBT881
Definition bt8xxemu.h:119
@ BT8XXEMU_EmulatorBT816
Definition bt8xxemu.h:123
@ BT8XXEMU_EmulatorBT882
Definition bt8xxemu.h:120
@ BT8XXEMU_EmulatorFT801
Definition bt8xxemu.h:113
@ BT8XXEMU_EmulatorFT810
Definition bt8xxemu.h:114
@ BT8XXEMU_EmulatorFT812
Definition bt8xxemu.h:116

◆ BT8XXEMU_FrameFlags

Note
: Difference between FrameChanged and FrameBufferChanged is that FrameChanged will only be true if the content of the frame changed, whereas FrameBufferChanged will be true if the rendered buffer changed. For example, when the emulator renders a frame incompletely due to CPU overload, it will then finish the frame in the next callback, and when this is the same frame, FrameChanged will be false, but FrameBufferChanged will be true as the buffer has changed.
: Frames can change even though no frame was swapped, due to several parameters such as REG_MACRO or REG_ROTATE.
: If you only want completely rendered frames, turn OFF the EmulatorEnableDynamicDegrade feature.
: To get the accurate frame after a frame swap, wait for FrameSwap to be set, and get the first frame which has FrameBufferComplete set.
: To get the accurate frame after any frame change, wait for FrameChanged, and get the first frame which has FrameBufferComplete set.
Enumerator
BT8XXEMU_FrameBufferChanged 

0x01; frame render has changes since last render

BT8XXEMU_FrameBufferComplete 

0x02; frame is completely rendered (without degrade)

BT8XXEMU_FrameChanged 

0x04; frame has changes since last render

BT8XXEMU_FrameSwap 

0x08; frame rendered right after display list swap

Definition at line 168 of file bt8xxemu.h.

169{
172 BT8XXEMU_FrameChanged = 0x04,
173 BT8XXEMU_FrameSwap = 0x08,
174
BT8XXEMU_FrameFlags
Definition bt8xxemu.h:169
@ BT8XXEMU_FrameBufferChanged
Definition bt8xxemu.h:170
@ BT8XXEMU_FrameBufferComplete
Definition bt8xxemu.h:171
@ BT8XXEMU_FrameSwap
Definition bt8xxemu.h:173
@ BT8XXEMU_FrameChanged
Definition bt8xxemu.h:172

◆ BT8XXEMU_LogType

Enumerator
BT8XXEMU_LogError 

0

BT8XXEMU_LogWarning 

1

BT8XXEMU_LogMessage 

2

Definition at line 103 of file bt8xxemu.h.

104{
BT8XXEMU_LogType
Definition bt8xxemu.h:104
@ BT8XXEMU_LogError
Definition bt8xxemu.h:105
@ BT8XXEMU_LogMessage
Definition bt8xxemu.h:107
@ BT8XXEMU_LogWarning
Definition bt8xxemu.h:106

Function Documentation

◆ BT8XXEMU_chipSelect()

BT8XXEMU_API void BT8XXEMU_chipSelect ( BT8XXEMU_Emulator ,
int  cs 
)
extern

Set chip select. Must be set to 1 to start data transfer, 0 to end. See FT8XX documentation for CS_N

◆ BT8XXEMU_defaults()

BT8XXEMU_API void BT8XXEMU_defaults ( uint32_t  versionApi,
BT8XXEMU_EmulatorParameters params,
BT8XXEMU_EmulatorMode  mode 
)
extern

Initialize the default emulator parameters

◆ BT8XXEMU_destroy()

BT8XXEMU_API void BT8XXEMU_destroy ( BT8XXEMU_Emulator emulator)
extern

Destroy the emulator. Calls BT8XXEMU_stop implicitly. Emulator must be destroyed before process exits.

◆ BT8XXEMU_Flash_create()

BT8XXEMU_API BT8XXEMU_Flash * BT8XXEMU_Flash_create ( uint32_t  versionApi,
const BT8XXEMU_FlashParameters params 
)
extern

Create flash emulator instance

◆ BT8XXEMU_Flash_defaults()

BT8XXEMU_API void BT8XXEMU_Flash_defaults ( uint32_t  versionApi,
BT8XXEMU_FlashParameters params 
)
extern

Initialize the default flash emulator parameters

◆ BT8XXEMU_Flash_destroy()

BT8XXEMU_API void BT8XXEMU_Flash_destroy ( BT8XXEMU_Flash flash)
extern

Destroy flash emulator instance

◆ BT8XXEMU_Flash_transferSpi4()

BT8XXEMU_API uint8_t BT8XXEMU_Flash_transferSpi4 ( BT8XXEMU_Flash flash,
uint8_t  signal 
)
extern

Transfer data using SPI or Quad SPI protocol. Bit 0:3 are data, bit 4 is cable select (0 active), SCK is clock. In single mode bit 0 is MOSI and bit 1 is MISO

◆ BT8XXEMU_hasInterrupt()

BT8XXEMU_API int BT8XXEMU_hasInterrupt ( BT8XXEMU_Emulator emulator)
extern

Returns 1 if there is an interrupt flag set. Depends on mask. See FT8XX documentation for INT_N

◆ BT8XXEMU_isRunning()

BT8XXEMU_API int BT8XXEMU_isRunning ( BT8XXEMU_Emulator emulator)
extern

Poll if the emulator is still running. Returns 0 when the output window has been closed, or when the emulator has been stopped.

◆ BT8XXEMU_run()

BT8XXEMU_API void BT8XXEMU_run ( uint32_t  versionApi,
BT8XXEMU_Emulator **  emulator,
const BT8XXEMU_EmulatorParameters params 
)
extern

Run the emulator on the current thread. Returns when the emulator is fully stopped when a Main function is supplied, returns when the emulator is fully started otherwise. Parameter versionApi must be set to BT8XXEMU_VERSION_API

◆ BT8XXEMU_setFlag()

BT8XXEMU_API int BT8XXEMU_setFlag ( BT8XXEMU_Emulator emulator,
BT8XXEMU_EmulatorFlags  flag,
int  value 
)
extern

Set a single emulation flag on or off. Only PWM and HSF options can be changed at runtime. Returns the value of the flag after the operation

◆ BT8XXEMU_stop()

BT8XXEMU_API void BT8XXEMU_stop ( BT8XXEMU_Emulator emulator)
extern

Stop the emulator. Can be called from any thread. Returns when the emulator has fully stopped. Safe to call multiple times.

◆ BT8XXEMU_touchResetXY()

BT8XXEMU_API void BT8XXEMU_touchResetXY ( BT8XXEMU_Emulator emulator,
int  idx 
)
extern

Reset touch XY. Call once no longer touching when using custom graphics output

◆ BT8XXEMU_touchSetXY()

BT8XXEMU_API void BT8XXEMU_touchSetXY ( BT8XXEMU_Emulator emulator,
int  idx,
int  x,
int  y,
int  pressure 
)
extern

Set touch XY. Param idx 0..4. Call on every frame during mouse down or touch when using custom graphics output

◆ BT8XXEMU_transfer()

BT8XXEMU_API uint8_t BT8XXEMU_transfer ( BT8XXEMU_Emulator emulator,
uint8_t  data 
)
extern

Transfer data over the imaginary SPI bus. Call from the MCU thread (from the setup/loop callbacks). See FT8XX documentation for SPI transfer protocol

◆ BT8XXEMU_version()

BT8XXEMU_API const char * BT8XXEMU_version ( )
extern

Return version information