comparison Discovery/Src/base.c @ 115:3834b6272ee5 FlipDisplay

Merge with 68181cd61f2069d061621c2cd2a6afddb7486f5e
author Ideenmodellierer
date Thu, 03 Jan 2019 19:59:36 +0100
parents f561c79b0546 22a1094545f3
children b848056057ce
comparison
equal deleted inserted replaced
114:79b19d56ab08 115:3834b6272ee5
772 /// 772 ///
773 /// VSYNC will switch foreground and background picture if demanded - 773 /// VSYNC will switch foreground and background picture if demanded -
774 /// see GFX_change_LTDC() 774 /// see GFX_change_LTDC()
775 /// 775 ///
776 // =============================================================================== 776 // ===============================================================================
777 void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) 777 void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
778 { 778 if (!GPIO_Pin)
779 if(!GPIO_Pin) 779 return;
780 return; 780
781 781 uint8_t action = 0;
782 uint8_t action = 0; 782 SStateList status;
783 SStateList status; 783
784 if (GPIO_Pin == VSYNC_IRQ_PIN) // rechts, unten
785 {
786 GFX_change_LTDC();
787 housekeepingFrame();
788 /*
789 #ifdef DEMOMODE
790 static uint8_t countCall = 0;
791 if(countCall++ < 10)
792 return;
793 countCall = 0;
794 uint8_t buttonAction = demoGetCommand();
795 if(buttonAction)
796 GPIO_Pin = buttonAction;
797 else
798 #endif
799 */
800 return;
801 }
802
784 SSettings* pSettings; 803 SSettings* pSettings;
785 pSettings = settingsGetPointer(); 804 pSettings = settingsGetPointer();
786 805 if (GPIO_Pin == VSYNC_IRQ_PIN) // rechts, unten
787 if(GPIO_Pin == VSYNC_IRQ_PIN) // rechts, unten 806 {
788 { 807 GFX_change_LTDC();
789 GFX_change_LTDC(); 808 housekeepingFrame();
790 housekeepingFrame(); 809 /*
791 /* 810 #ifdef DEMOMODE
811 static uint8_t countCall = 0;
812 if(countCall++ < 10)
813 return;
814 countCall = 0;
815 uint8_t buttonAction = demoGetCommand();
816 if(buttonAction)
817 GPIO_Pin = buttonAction;
818 else
819 #endif
820 */
821 return;
822 }
823
792 #ifdef DEMOMODE 824 #ifdef DEMOMODE
793 static uint8_t countCall = 0; 825 uint8_t demoMachineCall = 0;
794 if(countCall++ < 10) 826 if(GPIO_Pin & 0x80)
795 return; 827 {
796 countCall = 0; 828 demoMachineCall = 1;
797 uint8_t buttonAction = demoGetCommand(); 829 GPIO_Pin &= 0x7F;
798 if(buttonAction) 830 }
799 GPIO_Pin = buttonAction;
800 else
801 #endif 831 #endif
802 */ 832
803 return; 833 time_without_button_pressed_deciseconds = 0;
804 } 834
805 835 if (GFX_logoStatus() != 0)
806 #ifdef DEMOMODE 836 return;
807 uint8_t demoMachineCall = 0; 837
808 if(GPIO_Pin & 0x80) 838 if (GPIO_Pin == BUTTON_BACK_PIN) { // links
809 { 839 HAL_Delay(BUTTON_DEBOUNCE_DELAY);
810 demoMachineCall = 1; 840 if (HAL_GPIO_ReadPin(BUTTON_BACK_GPIO_PORT, BUTTON_BACK_PIN) == 1) {
811 GPIO_Pin &= 0x7F; 841 action = ACTION_BUTTON_BACK;
812 } 842 }
813 #endif 843 }
814 844
815 time_without_button_pressed_deciseconds = 0; 845 else if (GPIO_Pin == BUTTON_ENTER_PIN) { // mitte
816 846 HAL_Delay(BUTTON_DEBOUNCE_DELAY);
817 if(GFX_logoStatus() != 0) 847 if (HAL_GPIO_ReadPin(BUTTON_ENTER_GPIO_PORT, BUTTON_ENTER_PIN) == 1) {
818 return; 848 action = ACTION_BUTTON_ENTER;
849 }
850 }
851
852 else if (GPIO_Pin == BUTTON_NEXT_PIN) { // rechts
853 HAL_Delay(BUTTON_DEBOUNCE_DELAY);
854 if (HAL_GPIO_ReadPin(BUTTON_NEXT_GPIO_PORT, BUTTON_NEXT_PIN) == 1) {
855 action = ACTION_BUTTON_NEXT;
856 }
857 }
819 858
820 if(GPIO_Pin == BUTTON_BACK_PIN) // links 859 if(GPIO_Pin == BUTTON_BACK_PIN) // links
821 { 860 {
822 if(!pSettings->FlipDisplay) 861 if(!pSettings->FlipDisplay)
823 { 862 {
846 if(GPIO_Pin == BUTTON_CUSTOM_PIN) // extra 885 if(GPIO_Pin == BUTTON_CUSTOM_PIN) // extra
847 action = ACTION_BUTTON_CUSTOM; 886 action = ACTION_BUTTON_CUSTOM;
848 #endif 887 #endif
849 888
850 #ifdef DEMOMODE // user pressed button ? 889 #ifdef DEMOMODE // user pressed button ?
851 if((!demoMachineCall) && demoModeActive()) 890 if((!demoMachineCall) && demoModeActive())
852 { 891 {
853 demoSendCommand(action); 892 demoSendCommand(action);
854 return; 893 return;
855 } 894 }
856 #endif 895 #endif
857 896
858 get_globalStateList(&status); 897 get_globalStateList(&status);
859 898
860 if(action == ACTION_BUTTON_CUSTOM) 899 if (action == ACTION_BUTTON_CUSTOM) {
861 { 900 GFX_screenshot();
862 GFX_screenshot(); 901 }
863 } 902
864 903 switch (status.base) {
865 switch(status.base) 904 case BaseStop:
866 { 905 if (action == ACTION_BUTTON_BACK)
867 case BaseStop: 906 resetToFirmwareUpdate();
868 if(action == ACTION_BUTTON_BACK) 907 break;
869 resetToFirmwareUpdate(); 908 case BaseComm:
870 break; 909 if (action == ACTION_BUTTON_BACK) {
871 case BaseComm: 910 settingsGetPointer()->bluetoothActive = 0;
872 if(action == ACTION_BUTTON_BACK) 911 MX_Bluetooth_PowerOff();
873 { 912 tComm_exit();
874 settingsGetPointer()->bluetoothActive = 0; 913 }
875 MX_Bluetooth_PowerOff(); 914 break;
876 tComm_exit(); 915 case BaseHome:
877 } 916 if (action == ACTION_BUTTON_NEXT) {
878 break; 917 if (status.page == PageSurface)
879 case BaseHome: 918 openMenu(1);
880 if(action == ACTION_BUTTON_NEXT) 919 else
881 { 920 tHomeDiveMenuControl(action);
882 if(status.page == PageSurface) 921 } else if (action == ACTION_BUTTON_BACK) {
883 openMenu(1); 922 if (get_globalState() == StS)
884 else 923 openInfo(StILOGLIST);
885 tHomeDiveMenuControl(action); 924 else if ((status.page == PageDive)
886 } 925 && (settingsGetPointer()->design < 7)) {
887 else 926 settingsGetPointer()->design = 7; // auto switch to 9 if necessary
888 if(action == ACTION_BUTTON_BACK) 927 } else if ((status.page == PageDive) && (status.line != 0)) {
889 { 928 if (settingsGetPointer()->extraDisplay == EXTRADISPLAY_BIGFONT)
890 if(get_globalState() == StS) 929 settingsGetPointer()->design = 3;
891 openInfo(StILOGLIST); 930 else if (settingsGetPointer()->extraDisplay
892 else 931 == EXTRADISPLAY_DECOGAME)
893 if((status.page == PageDive) && (settingsGetPointer()->design < 7)) 932 settingsGetPointer()->design = 4;
894 { 933
895 settingsGetPointer()->design = 7; // auto switch to 9 if necessary 934 set_globalState(StD);
896 } 935 } else
897 else 936 tHome_change_field_button_pressed();
898 if((status.page == PageDive) && (status.line != 0)) 937 } else if (action == ACTION_BUTTON_ENTER) {
899 { 938 if ((status.page == PageDive) && (status.line == 0))
900 if(settingsGetPointer()->extraDisplay == EXTRADISPLAY_BIGFONT) 939 tHome_change_customview_button_pressed();
901 settingsGetPointer()->design = 3; 940 else if (status.page == PageSurface)
902 else 941 tHome_change_customview_button_pressed();
903 if(settingsGetPointer()->extraDisplay == EXTRADISPLAY_DECOGAME) 942 else
904 settingsGetPointer()->design = 4; 943 tHomeDiveMenuControl(action);
905 944 }
906 set_globalState(StD); 945 break;
907 } 946
908 else 947 case BaseMenu:
909 tHome_change_field_button_pressed(); 948 if (status.line == 0)
910 } 949 sendActionToMenu(action);
911 else 950 else
912 if(action == ACTION_BUTTON_ENTER) 951 sendActionToMenuEdit(action);
913 { 952 break;
914 if((status.page == PageDive) && (status.line == 0)) 953
915 tHome_change_customview_button_pressed(); 954 case BaseInfo:
916 else 955 if (status.page == InfoPageLogList)
917 if(status.page == PageSurface) 956 sendActionToInfoLogList(action);
918 tHome_change_customview_button_pressed(); 957 else if (status.page == InfoPageLogShow)
919 else 958 sendActionToInfoLogShow(action);
920 tHomeDiveMenuControl(action); 959 else
921 } 960 sendActionToInfo(action);
922 break; 961 break;
923 962
924 case BaseMenu: 963 default:
925 if(status.line == 0) 964 break;
926 sendActionToMenu(action); 965 }
927 else
928 sendActionToMenuEdit(action);
929 break;
930
931 case BaseInfo:
932 if(status.page == InfoPageLogList)
933 sendActionToInfoLogList(action);
934 else
935 if(status.page == InfoPageLogShow)
936 sendActionToInfoLogShow(action);
937 else
938 sendActionToInfo(action);
939 break;
940
941 default:
942 break;
943 }
944 } 966 }
945 967
946 968
947 void gotoSleep(void) 969 void gotoSleep(void)
948 { 970 {