STM32Fxx7接LAN8720A以太网PHY单片机解密
- 单片机解密void Show_circle(u16 x,u16 y,u16 c)
- {
- Draw_Circle(x,y,10,c);
- LCD_DrawLine(x-10,y,x+10,y,c);
- LCD_DrawLine(x,y-10,x,y+10,c);
- }
- void Touch_Adjust(float32_t *xdata,float32_t *ydata)
- {
- uint16_t x1_data,y1_data,x2_data,y2_data;
- LCD_ShowString(0,200,"Please click on the red dot wait 5s",BLACK,WHITE,16,0);
- Show_circle(10,10,RED);
- Ddl_Delay1ms(3000);
- XPT2046_Rd_Addata(&x1_data,&y1_data);
- Ddl_Delay1ms(2000);
- LCD_ShowString(0,200,"Please click on the green dot wait 5s",BLACK,WHITE,16,0);
- Show_circle(310,230,GREEN);
- Ddl_Delay1ms(3000);
- XPT2046_Rd_Addata(&x2_data,&y2_data);
- Ddl_Delay1ms(2000);
- *xdata = (float32_t)(x2_data-x1_data)/(300);
- *ydata = (float32_t)(y1_data-y2_data)/(220);
-
- LCD_Fill(0,0,320,240,WHITE);
- LCD_ShowString(0,200,"You are good",BLACK,WHITE,16,0);
-
- }
- void XPT2046_getPoint(u16 *x, u16 *y)
- {
- uint16_t xdata=0,ydata=0;
- XPT2046_Rd_Addata(&xdata,&ydata);
- *x = (u16)xdata/11.1633329-15;//由于扫描方式的不同这里的参数需要根据实际修改.
- *y = (u16)ydata/-15.4863634+255;
- }
main
- #include "hc32_ddl.h"
- #include "Kthermocouple.h"
- #include "userADC.h"
- #include "userUSART.h"
- #include "userSPI.h"
- #include "userPWM.h"
- #include "ev_hc32f460_lqfp100_v2.h"
- #include "rtthread.h"
- #include "lcd.h"
- #include "xpt2046.h"
- static void touch_thread_init(void);
- static struct rt_thread touch_thread;
- ALIGN(RT_ALIGN_SIZE)
- static rt_uint8_t rt_touch_thread_stack[1024];
- static void touch_thread_entry(void * para);
- static rt_uint8_t touch_thread_priority = 6;
- /**
- *******************************************************************************
- ** \brief Main function of template project
- **
- ** \param None
- **
- ** \retval int32_t return value, if needed
- **
- ******************************************************************************/
- int32_t main(void)
- {
- SPI1_Init();
- XPT2046_init();
- LCD_Init();
- LCD_Fill(0,0,320,240,WHITE);
- Ddl_Delay1ms(1000);
- touch_thread_init();
- }

芯片解密