mirror of
https://github.com/sengeiou/realtek_ameba_mp_sdk.git
synced 2025-07-31 20:11:04 +00:00
ameba micropython sdk first commit
This commit is contained in:
commit
8508ee6139
5619 changed files with 1874619 additions and 0 deletions
|
|
@ -0,0 +1,48 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2015 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#include <platform_opts.h>
|
||||
#include <get_beacon_frame/example_get_beacon_frame.h>
|
||||
#include <platform/platform_stdlib.h>
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
typedef int (*get_beacon_frame_func_ptr)(BEACON_INFO_T beacon_frame);
|
||||
extern get_beacon_frame_func_ptr get_beacon_frame_callback;
|
||||
|
||||
int get_beacon_frame_func(BEACON_INFO_T beacon_frame)
|
||||
{
|
||||
printf("\nbeacon frame_ctl = %02x %02x\n",beacon_frame.frame_ctl[0],beacon_frame.frame_ctl[1]);
|
||||
printf("\nbeacon duration_id = %02x %02x\n",beacon_frame.duration_id[0],beacon_frame.duration_id[1]);
|
||||
printf("\nbeacon addr1 = %02x:%02x:%02x:%02x:%02x:%02x\n",\
|
||||
beacon_frame.addr1[0],beacon_frame.addr1[1],beacon_frame.addr1[2],beacon_frame.addr1[3],beacon_frame.addr1[4],beacon_frame.addr1[5]);
|
||||
printf("\nbeacon addr2 = %02x:%02x:%02x:%02x:%02x:%02x\n",\
|
||||
beacon_frame.addr2[0],beacon_frame.addr2[1],beacon_frame.addr2[2],beacon_frame.addr2[3],beacon_frame.addr2[4],beacon_frame.addr2[5]);
|
||||
printf("\nbeacon addr3 = %02x:%02x:%02x:%02x:%02x:%02x\n",\
|
||||
beacon_frame.addr3[0],beacon_frame.addr3[1],beacon_frame.addr3[2],beacon_frame.addr3[3],beacon_frame.addr3[4],beacon_frame.addr3[5]);
|
||||
printf("\nbeacon seq_ctl = %02x %02x\n",beacon_frame.seq_ctl[0],beacon_frame.seq_ctl[1]);
|
||||
printf("\nbeacon timestamp = %02x %02x %02x %02x %02x %02x %02x %02x\n",\
|
||||
beacon_frame.timestamp[0],beacon_frame.timestamp[1],beacon_frame.timestamp[2],beacon_frame.timestamp[3],beacon_frame.timestamp[4],beacon_frame.timestamp[5],beacon_frame.timestamp[6],beacon_frame.timestamp[7]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void get_beacon_frame_thread(void *param)
|
||||
{
|
||||
vTaskDelay(10000);//a rough time for waiting wifi connected
|
||||
//Register callback function until wifi connected
|
||||
get_beacon_frame_callback = get_beacon_frame_func;
|
||||
vTaskDelete(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
void example_get_beacon_frame(void)
|
||||
{
|
||||
if(xTaskCreate(get_beacon_frame_thread, ((const char*)"get_beacon_frame_thread"), 256, NULL, tskIDLE_PRIORITY , NULL) != pdPASS)
|
||||
printf("\n\r%s xTaskCreate(get_beacon_frame_thread) failed", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef __EXAMPLE_GET_BEACON_FRAME_H__
|
||||
#define __EXAMPLE_GET_BEACON_FRAME_H__
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2015 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
typedef struct beacon_info_str{
|
||||
//802.11 MAC header
|
||||
unsigned char frame_ctl[2];
|
||||
unsigned char duration_id[2];
|
||||
unsigned char addr1[6];
|
||||
unsigned char addr2[6];
|
||||
unsigned char addr3[6];
|
||||
unsigned char seq_ctl[2];
|
||||
//802.11 beacon IE
|
||||
unsigned char timestamp[8];
|
||||
}BEACON_INFO_T;
|
||||
|
||||
void example_get_beacon_frame(void);
|
||||
int get_beacon_frame_func(BEACON_INFO_T beacon_frame);
|
||||
|
||||
#endif //#ifndef __EXAMPLE_GET_BEACON_FRAME_H__
|
||||
13
component/common/example/get_beacon_frame/readme.txt
Normal file
13
component/common/example/get_beacon_frame/readme.txt
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
GET BEACON FRAME EXAMPLE
|
||||
|
||||
Description:
|
||||
Get beacon frame information in station mode
|
||||
|
||||
Configuration:
|
||||
[platform_opts.h]
|
||||
#define CONFIG_EXAMPLE_GET_BEACON_FRAME 1
|
||||
|
||||
Execution:
|
||||
Call example_get_beacon_frame() to create get beacon frame thread.
|
||||
It can collect the beacon of AP in the air.
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue