Browse Source

Adding btn example

main
Goran Mahovlic 2 years ago
parent
commit
c1343e7d0d
  1. 2
      Core/Inc/main.h
  2. 6
      Core/Src/gpio.c
  3. 83638
      Debug/stm32f746g-disco.hex
  4. 259
      Src/eez-flow-template-stm32f746g-disco.eez-project
  5. 13
      Src/gui/data.cpp
  6. 14938
      Src/gui/document.cpp
  7. 36
      Src/gui/document.h

2
Core/Inc/main.h

@ -315,6 +315,8 @@ void Error_Handler(void);
#define ARDUINO_MISO_D12_GPIO_Port GPIOB #define ARDUINO_MISO_D12_GPIO_Port GPIOB
#define ARDUINO_MOSI_PWM_D11_Pin GPIO_PIN_15 #define ARDUINO_MOSI_PWM_D11_Pin GPIO_PIN_15
#define ARDUINO_MOSI_PWM_D11_GPIO_Port GPIOB #define ARDUINO_MOSI_PWM_D11_GPIO_Port GPIOB
#define USER_BTN_Pin GPIO_PIN_11
#define USER_BTN_GPIO_Port GPIOI
/* USER CODE BEGIN Private defines */ /* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */ /* USER CODE END Private defines */

6
Core/Src/gpio.c

@ -101,6 +101,12 @@ void MX_GPIO_Init(void)
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(OTG_HS_OverCurrent_GPIO_Port, &GPIO_InitStruct); HAL_GPIO_Init(OTG_HS_OverCurrent_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = USER_BTN_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(USER_BTN_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : PGPin PGPin PGPin */ /*Configure GPIO pins : PGPin PGPin PGPin */
GPIO_InitStruct.Pin = RMII_TXD1_Pin|RMII_TXD0_Pin|RMII_TX_EN_Pin; GPIO_InitStruct.Pin = RMII_TXD1_Pin|RMII_TXD0_Pin|RMII_TX_EN_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

83638
Debug/stm32f746g-disco.hex

File diff suppressed because it is too large Load Diff

259
Src/eez-flow-template-stm32f746g-disco.eez-project

@ -164,18 +164,21 @@
"native": true "native": true
}, },
{ {
"objID": "c5a6832f-691a-4c67-8245-2f8dab50efde", "objID": "ddddb67e-d476-43e7-b706-a3413db953b0",
"name": "gauge_data", "name": "ARDUINO_PWM_D3_Pin_status",
"description": "Holding LED1 status",
"type": "integer", "type": "integer",
"defaultValue": "0", "defaultValue": "0",
"persistent": false "persistent": false,
"native": true
}, },
{ {
"objID": "ddddb67e-d476-43e7-b706-a3413db953b0", "objID": "e46739a1-807b-41d2-bf75-843b316e833d",
"name": "ARDUINO_PWM_D3_Pin_status", "name": "btn_color",
"description": "Holding LED1 status",
"type": "integer", "type": "integer",
"defaultValue": "0", "defaultValue": "0",
"defaultMinValue": 0,
"defaultMaxValue": 1,
"persistent": false, "persistent": false,
"native": true "native": true
} }
@ -943,10 +946,190 @@
"height": 53, "height": 53,
"customInputs": [], "customInputs": [],
"customOutputs": [], "customOutputs": [],
"page": "page2"
},
{
"objID": "2423378e-8115-4115-b51a-8c5575c58fc6",
"type": "TextWidget",
"left": 98,
"top": 29,
"width": 184,
"height": 32,
"customInputs": [],
"customOutputs": [],
"data": "\"B1 user btn status\"",
"style": {
"objID": "5c1fac69-801c-4cf8-fc1d-893983a6833d",
"inheritFrom": "default"
},
"timeline": []
},
{
"objID": "8f404b3f-4f54-4632-e462-a4d109de296c",
"type": "TextWidget",
"left": 0,
"top": 79,
"width": 480,
"height": 65,
"customInputs": [],
"customOutputs": [],
"data": "\"EEZ flow BTN input\"",
"style": {
"objID": "385c5427-0e29-4d48-b266-3b6afa8a50f8",
"inheritFrom": "default_XL"
},
"timeline": []
},
{
"objID": "901b888a-2af5-4c6f-db87-7f85abfacb69",
"type": "TextWidget",
"left": 0,
"top": 144,
"width": 480,
"height": 65,
"customInputs": [],
"customOutputs": [],
"data": "\"Envox EEZ Studio\"",
"style": {
"objID": "385c5427-0e29-4d48-b266-3b6afa8a50f8",
"inheritFrom": "default_XL"
},
"timeline": []
},
{
"objID": "bfec1e00-637b-4e10-edc2-074e2aaaecea",
"type": "Select",
"left": 19,
"top": 21,
"width": 64,
"height": 40,
"customInputs": [],
"customOutputs": [],
"data": "btn_color",
"style": {
"objID": "22e8bb71-24a8-4fe6-d46e-0b3c72d184da",
"inheritFrom": "default"
},
"timeline": [],
"widgets": [
{
"objID": "0feaed51-f0ab-42ac-f8a4-be5481686a59",
"type": "ButtonWidget",
"left": 0,
"top": 0,
"width": 64,
"height": 40,
"customInputs": [],
"customOutputs": [],
"asOutputProperties": [],
"data": "\"Off\"",
"resizing": {
"pinToEdge": 0,
"fixSize": 3
},
"style": {
"objID": "e842f742-5f69-4de3-e1ca-adb505d0ae11",
"inheritFrom": "button",
"color": "#000000",
"backgroundColor": "#ff0000"
},
"timeline": [],
"text": "",
"disabledStyle": {
"objID": "f88f18d9-e049-439c-ae60-37100567ce0c",
"inheritFrom": "button_disabled"
}
},
{
"objID": "e6885273-1805-401f-c3be-87d7ab63fc93",
"type": "ButtonWidget",
"left": 0,
"top": 0,
"width": 64,
"height": 40,
"customInputs": [],
"customOutputs": [],
"asOutputProperties": [],
"data": "\"On\"",
"style": {
"objID": "e842f742-5f69-4de3-e1ca-adb505d0ae11",
"inheritFrom": "button",
"color": "#000000",
"backgroundColor": "#00ff00",
"backgroundImage": ""
},
"timeline": [],
"text": "",
"disabledStyle": {
"objID": "f88f18d9-e049-439c-ae60-37100567ce0c",
"inheritFrom": "button_disabled"
}
}
]
}
],
"connectionLines": [
{
"objID": "c547d4b4-2c35-4ba3-8112-00ed48923ecc",
"source": "925d4f01-0172-475d-a6fa-9966e19542de",
"output": "action",
"target": "8deadb65-f411-4138-850f-eae36153fe75",
"input": "@seqin"
}
],
"localVariables": [],
"name": "page3",
"style": "background",
"left": 0,
"top": 0,
"width": 480,
"height": 272,
"scaleToFit": true
},
{
"objID": "e8ee1744-64c7-4d89-f8fc-12d4b36b9485",
"components": [
{
"objID": "0fba1953-fc88-4a9d-f544-dbda11b5f393",
"type": "ButtonWidget",
"left": 19,
"top": 218,
"width": 141,
"height": 40,
"customInputs": [],
"customOutputs": [],
"asOutputProperties": [
"action"
],
"data": "\"Back\"",
"resizing": {
"pinToEdge": 0,
"fixSize": 3
},
"style": {
"objID": "88090903-67a2-42ba-f82e-dcbec9eaf05c",
"inheritFrom": "button"
},
"timeline": [],
"text": "",
"disabledStyle": {
"objID": "bb0ffd13-534b-4610-f2a0-916a32fc98b1",
"inheritFrom": "button_disabled"
}
},
{
"objID": "468dabc6-fa1a-45a2-a4b1-08dd2f7790ee",
"type": "ShowPageActionComponent",
"left": 205,
"top": 322,
"width": 105,
"height": 53,
"customInputs": [],
"customOutputs": [],
"page": "page1" "page": "page1"
}, },
{ {
"objID": "2a112e99-5217-4364-c1d9-ce69141b32e3", "objID": "7384b2b1-937d-4d6c-ec15-56ae12c076c9",
"type": "SwitchWidget", "type": "SwitchWidget",
"left": 19, "left": 19,
"top": 29, "top": 29,
@ -972,7 +1155,7 @@
"timeline": [] "timeline": []
}, },
{ {
"objID": "2423378e-8115-4115-b51a-8c5575c58fc6", "objID": "e69cce4f-5737-414d-d313-b90a3223c6ca",
"type": "TextWidget", "type": "TextWidget",
"left": 89, "left": 89,
"top": 29, "top": 29,
@ -988,7 +1171,7 @@
"timeline": [] "timeline": []
}, },
{ {
"objID": "3d2c9d40-555a-4ae6-d626-2e575287407a", "objID": "9071c5e6-655b-4c83-9c7c-b0db38d95267",
"type": "SetVariableActionComponent", "type": "SetVariableActionComponent",
"left": 127, "left": 127,
"top": -75, "top": -75,
@ -1011,7 +1194,7 @@
] ]
}, },
{ {
"objID": "8f404b3f-4f54-4632-e462-a4d109de296c", "objID": "288c2a5e-b0dc-4169-8d50-bfed91162463",
"type": "TextWidget", "type": "TextWidget",
"left": 0, "left": 0,
"top": 80, "top": 80,
@ -1027,7 +1210,7 @@
"timeline": [] "timeline": []
}, },
{ {
"objID": "901b888a-2af5-4c6f-db87-7f85abfacb69", "objID": "c402b762-9ed0-48ad-e94a-083fd05fc7c0",
"type": "TextWidget", "type": "TextWidget",
"left": 0, "left": 0,
"top": 144, "top": 144,
@ -1041,22 +1224,68 @@
"inheritFrom": "default_XL" "inheritFrom": "default_XL"
}, },
"timeline": [] "timeline": []
},
{
"objID": "e1f0a256-9538-475c-d715-a5ac9f5f6fb5",
"type": "ButtonWidget",
"left": 323,
"top": 218,
"width": 141,
"height": 40,
"customInputs": [],
"customOutputs": [],
"asOutputProperties": [
"action"
],
"data": "\"Next\"",
"resizing": {
"pinToEdge": 0,
"fixSize": 3
},
"style": {
"objID": "88090903-67a2-42ba-f82e-dcbec9eaf05c",
"inheritFrom": "button"
},
"timeline": [],
"text": "",
"disabledStyle": {
"objID": "bb0ffd13-534b-4610-f2a0-916a32fc98b1",
"inheritFrom": "button_disabled"
}
},
{
"objID": "6cc1650c-e0a8-45d7-bdd5-29d66fe244f7",
"type": "ShowPageActionComponent",
"left": 521,
"top": 309,
"width": 105,
"height": 53,
"customInputs": [],
"customOutputs": [],
"page": "page3"
} }
], ],
"connectionLines": [ "connectionLines": [
{ {
"objID": "c547d4b4-2c35-4ba3-8112-00ed48923ecc", "objID": "c547d4b4-2c35-4ba3-8112-00ed48923ecc",
"source": "925d4f01-0172-475d-a6fa-9966e19542de", "source": "0fba1953-fc88-4a9d-f544-dbda11b5f393",
"output": "action", "output": "action",
"target": "8deadb65-f411-4138-850f-eae36153fe75", "target": "468dabc6-fa1a-45a2-a4b1-08dd2f7790ee",
"input": "@seqin" "input": "@seqin"
}, },
{ {
"objID": "c9adc4b8-975c-433f-c4d2-16d6f2f70ff6", "objID": "c9adc4b8-975c-433f-c4d2-16d6f2f70ff6",
"source": "2a112e99-5217-4364-c1d9-ce69141b32e3", "source": "7384b2b1-937d-4d6c-ec15-56ae12c076c9",
"output": "Toggle_led", "output": "Toggle_led",
"target": "3d2c9d40-555a-4ae6-d626-2e575287407a", "target": "9071c5e6-655b-4c83-9c7c-b0db38d95267",
"input": "data_in" "input": "data_in"
},
{
"objID": "92745750-5167-43e6-a10f-fb5c9c67e934",
"source": "e1f0a256-9538-475c-d715-a5ac9f5f6fb5",
"output": "action",
"target": "6cc1650c-e0a8-45d7-bdd5-29d66fe244f7",
"input": "@seqin"
} }
], ],
"localVariables": [], "localVariables": [],

13
Src/gui/data.cpp

@ -22,5 +22,18 @@ void data_arduino_pwm_d3_pin_status(DataOperationEnum operation, const WidgetCur
} }
} }
void data_btn_color(DataOperationEnum operation, const WidgetCursor &widgetCursor, Value &value){
if (operation == DATA_OPERATION_GET) {
g_set_pin_status = HAL_GPIO_ReadPin(USER_BTN_GPIO_Port, USER_BTN_Pin);
value = g_set_pin_status;
if(g_set_pin_status){
HAL_GPIO_WritePin(ARDUINO_PWM_D3_GPIO_Port, ARDUINO_PWM_D3_Pin, GPIO_PIN_SET);
}
else{
HAL_GPIO_WritePin(ARDUINO_PWM_D3_GPIO_Port, ARDUINO_PWM_D3_Pin, GPIO_PIN_RESET);
}
}
}
} // namespace gui } // namespace gui
} // namespace eez } // namespace eez

14938
Src/gui/document.cpp

File diff suppressed because it is too large Load Diff

36
Src/gui/document.h

@ -24,7 +24,8 @@ enum DataEnum {
DATA_ID_KEYPAD_OPTION3_TEXT = 12, DATA_ID_KEYPAD_OPTION3_TEXT = 12,
DATA_ID_KEYPAD_MODE = 13, DATA_ID_KEYPAD_MODE = 13,
DATA_ID_KEYPAD_OK_ENABLED = 14, DATA_ID_KEYPAD_OK_ENABLED = 14,
DATA_ID_ARDUINO_PWM_D3_PIN_STATUS = 15 DATA_ID_ARDUINO_PWM_D3_PIN_STATUS = 15,
DATA_ID_BTN_COLOR = 16
}; };
void data_none(DataOperationEnum operation, const WidgetCursor &cursor, Value &value); void data_none(DataOperationEnum operation, const WidgetCursor &cursor, Value &value);
@ -43,6 +44,7 @@ void data_keypad_option3_text(DataOperationEnum operation, const WidgetCursor &c
void data_keypad_mode(DataOperationEnum operation, const WidgetCursor &cursor, Value &value); void data_keypad_mode(DataOperationEnum operation, const WidgetCursor &cursor, Value &value);
void data_keypad_ok_enabled(DataOperationEnum operation, const WidgetCursor &cursor, Value &value); void data_keypad_ok_enabled(DataOperationEnum operation, const WidgetCursor &cursor, Value &value);
void data_arduino_pwm_d3_pin_status(DataOperationEnum operation, const WidgetCursor &cursor, Value &value); void data_arduino_pwm_d3_pin_status(DataOperationEnum operation, const WidgetCursor &cursor, Value &value);
void data_btn_color(DataOperationEnum operation, const WidgetCursor &cursor, Value &value);
typedef void (*DataOperationsFunction)(DataOperationEnum operation, const WidgetCursor &widgetCursor, Value &value); typedef void (*DataOperationsFunction)(DataOperationEnum operation, const WidgetCursor &widgetCursor, Value &value);
@ -128,8 +130,10 @@ enum StylesEnum {
STYLE_ID_TEXT_BUTTON = 19, STYLE_ID_TEXT_BUTTON = 19,
STYLE_ID_TEXT_BUTTON_DISABLED = 20, STYLE_ID_TEXT_BUTTON_DISABLED = 20,
STYLE_ID_BUTTON_ICON = 21, STYLE_ID_BUTTON_ICON = 21,
STYLE_ID_SWITCH_WIDGET = 22, STYLE_ID_DEFAULT = 22,
STYLE_ID_DEFAULT = 23 STYLE_ID_INLINE22 = 23,
STYLE_ID_INLINE23 = 24,
STYLE_ID_SWITCH_WIDGET = 25
}; };
enum ThemesEnum { enum ThemesEnum {
@ -172,7 +176,9 @@ enum ColorsEnum {
COLOR_ID_TEXT_INPUT_BORDER = 31, COLOR_ID_TEXT_INPUT_BORDER = 31,
COLOR_ID_CUSTOM_UNDEFINED = 32, COLOR_ID_CUSTOM_UNDEFINED = 32,
COLOR_ID_CUSTOM_000000 = 33, COLOR_ID_CUSTOM_000000 = 33,
COLOR_ID_CUSTOM_00FF1E = 34 COLOR_ID_CUSTOM_00FF1E = 34,
COLOR_ID_CUSTOM_FF0000 = 35,
COLOR_ID_CUSTOM_00FF00 = 36
}; };
enum PagesEnum { enum PagesEnum {
@ -180,10 +186,11 @@ enum PagesEnum {
PAGE_ID_MAIN = 1, PAGE_ID_MAIN = 1,
PAGE_ID_NUMERIC_KEYPAD = 2, PAGE_ID_NUMERIC_KEYPAD = 2,
PAGE_ID_PAGE1 = 3, PAGE_ID_PAGE1 = 3,
PAGE_ID_PAGE2 = 4 PAGE_ID_PAGE3 = 4,
PAGE_ID_PAGE2 = 5
}; };
extern const uint8_t assets[55759]; extern const uint8_t assets[56364];
#elif defined(EEZ_PLATFORM_SIMULATOR) #elif defined(EEZ_PLATFORM_SIMULATOR)
@ -204,7 +211,8 @@ enum DataEnum {
DATA_ID_KEYPAD_MODE = 13, DATA_ID_KEYPAD_MODE = 13,
DATA_ID_KEYPAD_OK_ENABLED = 14, DATA_ID_KEYPAD_OK_ENABLED = 14,
DATA_ID_MAIN_APP_VIEW = 15, DATA_ID_MAIN_APP_VIEW = 15,
DATA_ID_ARDUINO_PWM_D3_PIN_STATUS = 16 DATA_ID_ARDUINO_PWM_D3_PIN_STATUS = 16,
DATA_ID_BTN_COLOR = 17
}; };
void data_none(DataOperationEnum operation, const WidgetCursor &cursor, Value &value); void data_none(DataOperationEnum operation, const WidgetCursor &cursor, Value &value);
@ -224,6 +232,7 @@ void data_keypad_mode(DataOperationEnum operation, const WidgetCursor &cursor, V
void data_keypad_ok_enabled(DataOperationEnum operation, const WidgetCursor &cursor, Value &value); void data_keypad_ok_enabled(DataOperationEnum operation, const WidgetCursor &cursor, Value &value);
void data_main_app_view(DataOperationEnum operation, const WidgetCursor &cursor, Value &value); void data_main_app_view(DataOperationEnum operation, const WidgetCursor &cursor, Value &value);
void data_arduino_pwm_d3_pin_status(DataOperationEnum operation, const WidgetCursor &cursor, Value &value); void data_arduino_pwm_d3_pin_status(DataOperationEnum operation, const WidgetCursor &cursor, Value &value);
void data_btn_color(DataOperationEnum operation, const WidgetCursor &cursor, Value &value);
typedef void (*DataOperationsFunction)(DataOperationEnum operation, const WidgetCursor &widgetCursor, Value &value); typedef void (*DataOperationsFunction)(DataOperationEnum operation, const WidgetCursor &widgetCursor, Value &value);
@ -312,7 +321,9 @@ enum StylesEnum {
STYLE_ID_BUTTON_ICON = 21, STYLE_ID_BUTTON_ICON = 21,
STYLE_ID_DEFAULT = 22, STYLE_ID_DEFAULT = 22,
STYLE_ID_INLINE22 = 23, STYLE_ID_INLINE22 = 23,
STYLE_ID_SWITCH_WIDGET = 24 STYLE_ID_INLINE23 = 24,
STYLE_ID_INLINE24 = 25,
STYLE_ID_SWITCH_WIDGET = 26
}; };
enum ThemesEnum { enum ThemesEnum {
@ -356,7 +367,9 @@ enum ColorsEnum {
COLOR_ID_CUSTOM_UNDEFINED = 32, COLOR_ID_CUSTOM_UNDEFINED = 32,
COLOR_ID_CUSTOM_000000 = 33, COLOR_ID_CUSTOM_000000 = 33,
COLOR_ID_CUSTOM_00FF1E = 34, COLOR_ID_CUSTOM_00FF1E = 34,
COLOR_ID_CUSTOM_FFFFFF = 35 COLOR_ID_CUSTOM_FFFFFF = 35,
COLOR_ID_CUSTOM_FF0000 = 36,
COLOR_ID_CUSTOM_00FF00 = 37
}; };
enum PagesEnum { enum PagesEnum {
@ -365,10 +378,11 @@ enum PagesEnum {
PAGE_ID_NUMERIC_KEYPAD = 2, PAGE_ID_NUMERIC_KEYPAD = 2,
PAGE_ID_FRONT_PANEL = 3, PAGE_ID_FRONT_PANEL = 3,
PAGE_ID_PAGE1 = 4, PAGE_ID_PAGE1 = 4,
PAGE_ID_PAGE2 = 5 PAGE_ID_PAGE3 = 5,
PAGE_ID_PAGE2 = 6
}; };
extern const uint8_t assets[72200]; extern const uint8_t assets[72816];
#endif #endif

Loading…
Cancel
Save