|
以前的學(xué)習(xí)結(jié)果,為了f429,現(xiàn)貢獻(xiàn)給大家,大家可以直接用我這程序當(dāng)做安卓的串口調(diào)試助手,望大家喜歡,幫我加油頂貼!
給大家一個(gè)提示,這個(gè)安卓程序要求你的安卓設(shè)備支持Host功能,并且root,打開(kāi)了usbhost權(quán)限哈。
809ec317f4dae6703b589bc73d38cc69.png (93.2 KB, 下載次數(shù): 128)
下載附件
2016-6-17 16:20 上傳
|
cbf89f3ecfebd9f22f71be2af028582b.png (79.75 KB, 下載次數(shù): 120)
下載附件
2016-6-17 16:20 上傳
- /**
- ******************************************************************************
- * @file main.c
- * @author MCD Application Team
- * @version V4.0.0
- * @date 21-January-2013
- * @brief Virtual Com Port Demo main file
- ******************************************************************************
- * @attention
- *
- * [b]© COPYRIGHT 2013 STMicroelectronics[/b]
- *
- * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
- * You may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * [url]http://www.st.com/software_license_agreement_liberty_v2[/url]
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************************
- */
- /* Includes ------------------------------------------------------------------*/
- #include "hw_config.h"
- #include "usb_lib.h"
- #include "usb_desc.h"
- #include "usb_pwr.h"
- /* Private typedef -----------------------------------------------------------*/
- /* Private define ------------------------------------------------------------*/
- /* Private macro -------------------------------------------------------------*/
- /* Private variables ---------------------------------------------------------*/
- /* Extern variables ----------------------------------------------------------*/
- /* Private function prototypes -----------------------------------------------*/
- /* Private functions ---------------------------------------------------------*/
- /*******************************************************************************
- * Function Name : main.
- * Description : Main routine.
- * Input : None.
- * Output : None.
- * Return : None.
- *******************************************************************************/
- void delay_ms(unsigned int m)
- {
- while(m--);
- }
- /*******************************************************************************
- * Function Name : USB_To_USART_Send_Data.
- * Description : send the received data from USB to the UART 0.
- * Input : data_buffer: data address.
- Nb_bytes: number of bytes to send.
- * Return : none.
- *******************************************************************************/
- void USB_To_USART_Send_Data(uint8_t* data_buffer, uint8_t Nb_bytes)
- {
- //在此處處理用戶數(shù)據(jù)接收。
- }
- int main(void)
- {
- Set_System();
- Set_USBClock();
- USB_Interrupts_Config();
- USB_Init();
- while (1)
- {
- delay_ms(50);
- USART_To_USB_Send_Data((unsigned char *)"Hello",6);
- }
- }
- #ifdef USE_FULL_ASSERT
- /*******************************************************************************
- * Function Name : assert_failed
- * Description : Reports the name of the source file and the source line number
- * where the assert_param error has occurred.
- * Input : - file: pointer to the source file name
- * - line: assert_param error line source number
- * Output : None
- * Return : None
- *******************************************************************************/
- void assert_failed(uint8_t* file, uint32_t line)
- {
- /* User can add his own implementation to report the file name and line number,
- ex: printf("Wrong parameters value: file %s on line %d", file, line) */
- /* Infinite loop */
- while (1)
- {}
- }
- #endif
- /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
復(fù)制代碼
stm32f103虛擬串口程序.zip
(368.2 KB, 下載次數(shù): 73)
2016-6-17 15:30 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
安卓端Host程序.zip
(1.33 MB, 下載次數(shù): 62)
2016-6-17 15:31 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
|
|