STM32单片机的电子琴程序芯片解密
单片机主程序源码
- 芯片解密#include "system.h"
- 芯片解密#include "app_demo.h"
- 芯片解密#include "OLED.h"
- 芯片解密#include "key.h"
- 芯片解密#include "app_demo.h"
- //#include "Delay.h"
- int main()
-
- {
-
- /*OLED初始化*/
- OLED_Init();
- OLED_ShowString(16, 0, "Hello World!", OLED_8X16);//初始化显示
- OLED_Update();
- while(1)
- {
- appdemo_show();
- }
- }
- #include "key.h"
- #include "SysTick.h"
- #include "OLED.h"
- /*******************************************************************************
- * 函 数 名 : KEY_Init
- * 函数功能 : 按键初始化
- * 输 入 : 无
- * 输 出 : 无
- *******************************************************************************/
- void KEY_Init(void)
- {
- GPIO_InitTypeDef GPIO_InitStructure; //定义结构体变量
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);
- GPIO_InitStructure.GPIO_Pin=KEY1_PIN|KEY2_PIN|KEY3_PIN|KEY4_PIN|KEY5_PIN|KEY6_PIN|KEY7_PIN;
- GPIO_InitStructure.GPIO_Mode=GPIO_Mode_IPU; //上拉输入
- GPIO_Init(KEY_PORT,&GPIO_InitStructure);
- }
- /*******************************************************************************
- * 函 数 名 : KEY_Scan
- * 函数功能 : 按键扫描检测
- * 输 入 : mode=0:单次按下按键
- mode=1:连续按下按键
- * 输 出 : 0:未有按键按下
- KEY_UP_PRESS:KEY_UP键按下
- KEY0_PRESS:KEY0键按下
- KEY1_PRESS:KEY1键按下
- KEY2_PRESS:KEY2键按下
- *******************************************************************************/
- u8 KEY_Scan(u8 mode)
- {
- static u8 key=1;
-
- if(mode==1) //连续按键按下
- key=1;
- if(key==1&&(KEY1==0||KEY2==0||KEY3==0||KEY4==0||KEY5==0||KEY6==0||KEY7==0)) //任意一个按键按下
- {
- delay_ms(1); //消抖
- key=0;
- if(KEY1==0)
- {
- // OLED_ShowChinese(0, 18, "当前按下的音符为“哆”");//当前按下的音符为“哆”
- // OLED_ShowChinese(35, 40, "“哆”");
- // OLED_Update();
- return KEY1_PRESS;
- }
- else if(KEY2==0)
- return KEY2_PRESS;
- else if(KEY3==0)
- return KEY3_PRESS;
- else if(KEY4==0)
- return KEY4_PRESS;
- else if(KEY5==0)
- return KEY5_PRESS;
- else if(KEY6==0)
- return KEY6_PRESS;
- else if(KEY7==0)
- return KEY7_PRESS;
- }
- else if(KEY1==1&&KEY2==1&&KEY3==1&&KEY4==1&&KEY5==1&&KEY6==1&&KEY7==1) //无按键按下
- key=0;
- return 0;
- }

芯片解密