Skip to content

Commit

Permalink
Merge pull request #1 from jason-mao/feature/support_esp32
Browse files Browse the repository at this point in the history
Support esp32
  • Loading branch information
jason-mao authored Oct 30, 2019
2 parents 0ed1aaa + 8c01056 commit 4a87244
Show file tree
Hide file tree
Showing 30 changed files with 2,590 additions and 7 deletions.
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.config
*.o
*.pyc

# gtags
GTAGS
GRTAGS
GPATH

# emacs
.dir-locals.el


# eclipse setting
.settings

# MacOS directory files
.DS_Store

# Example project files
# example/**/sdkconfig
example/**/sdkconfig.old
example/**/build

# gcov coverage reports
*.gcda
*.gcno
coverage.info
coverage_report/

# VS Code Settings
.vscode/
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "components"]
path = components
url = https://github.com/jason-mao/awtk.git
[submodule "esp-idf"]
path = esp-idf
url = https://github.com/espressif/esp-idf.git
[submodule "components/awtk"]
path = components/awtk
url = https://github.com/jason-mao/awtk.git
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@


# Todo list
- [ ] Porting awtk to support ESP32
- [ ] Support touch events
- [x] Porting awtk to support ESP32
- [x] Running first demo on ESP-WROVER-KIT
- [ ] Support touch input events
- [ ] Implement framebuffer to improve speed
1 change: 0 additions & 1 deletion components
Submodule components deleted from 1b173c
1 change: 1 addition & 0 deletions components/awtk
Submodule awtk added at cd002a
116 changes: 116 additions & 0 deletions components/esp32-port/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 100
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
RawStringFormats:
- Delimiter: pb
Language: TextProto
BasedOnStyle: google
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 2
UseTab: Never
...

4 changes: 4 additions & 0 deletions components/esp32-port/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set(COMPONENT_SRCS "lcd_esp32_raw.c" "main_loop_esp32_raw.c" "platform.c")
set(COMPONENT_ADD_INCLUDEDIRS "awtk_config.h")

register_component()
89 changes: 89 additions & 0 deletions components/esp32-port/awtk_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@

/**
* File: awtk_config.h
* Author: AWTK Develop Team
* Brief: config
*
* Copyright (c) 2018 - 2018 Guangzhou ZHIYUAN Electronics Co.,Ltd.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* License file for more details.
*
*/

/**
* History:
* ================================================================
* 2018-09-12 Li XianJing <[email protected]> created
*
*/

#ifndef AWTK_CONFIG_H
#define AWTK_CONFIG_H

/**
* 嵌入式系统有自己的main函数时,请定义本宏。
*
*/
#define USE_GUI_MAIN 1

/**
* 如果需要支持预先解码的图片,请定义本宏。一般只在RAM极小时,才启用本宏。
*/
#define WITH_BITMAP_FONT 1

/**
* 如果不需输入法,请定义本宏
*
*/
#define WITH_NULL_IM 1

/**
* 如果支持极速模式,请定义本宏。极速模式不支持控件透明半透明效果,只有在CPU配置极低时启用。
*
* #define USE_FAST_MODE 1
*/

/**
* 如果有标准的malloc/free/calloc等函数,请定义本宏
*
*/
// #define HAS_STD_MALLOC 1

/**
* 如果有标准的fopen/fclose等函数,请定义本宏
*
*/
#define HAS_STDIO 1

/**
* 如果有优化版本的memcpy函数,请定义本宏
*
*/
#define HAS_FAST_MEMCPY 1

/**
* 如果禁用控件动画,请定义本宏
*
*/
#define WITHOUT_WIDGET_ANIMATORS 1

/**
* 如果禁用窗口动画,请定义本宏
*
*/
#define WITHOUT_WINDOW_ANIMATORS 1

/**
* 如果对话框高亮策略,请定义本宏
*
*/
#define WITHOUT_DIALOG_HIGHLIGHTER 1

#define WITHOUT_EXT_WIDGETS 1

#define FRAGMENT_FRAME_BUFFER_SIZE 32 * 1024

#endif/*AWTK_CONFIG_H*/
7 changes: 7 additions & 0 deletions components/esp32-port/component.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# "main" pseudo-component makefile.
#
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)

COMPONENT_ADD_INCLUDEDIRS := ./
COMPONENT_SRCDIRS := ./
2 changes: 2 additions & 0 deletions components/esp32-port/format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
find . -name \*.c -exec clang-format -i {} \;

54 changes: 54 additions & 0 deletions components/esp32-port/lcd_esp32_raw.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* File: lcd_stm32_raw.c
* Author: AWTK Develop Team
* Brief: stm32_raw implemented lcd interface
*
* Copyright (c) 2018 - 2018 Guangzhou ZHIYUAN Electronics Co.,Ltd.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* License file for more details.
*
*/

/**
* History:
* ================================================================
* 2018-02-16 Li XianJing <[email protected]> created
*
*/

#include "ili9341.h"

#include "lcd/lcd_reg.h"
#include "stdio.h"
typedef uint16_t pixel_t;

#define LCD_FORMAT BITMAP_FMT_BGR565
#define pixel_from_rgb(r, g, b) ((((r) >> 3) << 11) | (((g) >> 2) << 5) | ((b) >> 3))
#define pixel_to_rgba(p) {(0xff & ((p >> 11) << 3)), (0xff & ((p >> 5) << 2)), (0xff & (p << 3))}

extern ili9341_lcd_t *lcd;
extern void write_data_func(uint16_t dat);
extern void set_window_func(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end);

void write_data_func(uint16_t dat)
{
ili9341_start_pixels(lcd);
ili9341_write_pixel(lcd, dat);
ili9341_end_pixels(lcd);
}
void set_window_func(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end)
{
uint16_t w = (x_end - x_start + 1);
uint16_t h = (y_end - y_start + 1);
ESP_LOGI("LCD_SET_W", "%d-%d, %d-%d, w:%d,h:%d", x_start, x_end, y_start, y_end, w,h );
ili9341_start_pixels(lcd);
ili9341_set_window(lcd, x_start, y_start, w, h);
ili9341_end_pixels(lcd);
}

#include "base/pixel.h"
#include "blend/pixel_ops.inc"
#include "lcd/lcd_reg.inc"
Loading

0 comments on commit 4a87244

Please sign in to comment.