Skip to content

Instantly share code, notes, and snippets.

View xidameng's full-sized avatar
🏠
Working from home

SimonXI xidameng

🏠
Working from home
  • Singapore
View GitHub Profile
@xidameng
xidameng / FileTransferTCPClient
Created November 11, 2019 10:21 — forked from giefko/FileTransferTCPClient
Python File Transfer over TCP
import socket # Import socket module
s = socket.socket() # Create a socket object
host = "1somehing.11somehing." #Ip address that the TCPServer is there
port = 50000 # Reserve a port for your service every new transfer wants a new port or you must wait.
s.connect((host, port))
s.send("Hello server!")
with open('received_file', 'wb') as f:
@xidameng
xidameng / ameba_RTL8722DM_add_more_GPIO.cpp
Last active August 29, 2021 02:34
There are 2 files need to update in order to add support for more GPIO pins
// "variant.cpp"
PinDescription g_APinDescription[TOTAL_GPIO_PIN_NUM]=
{
{PB_2, NOT_INITIAL, PIO_GPIO | PIO_GPIO_IRQ , NOT_INITIAL}, //D0
{PB_1, NOT_INITIAL, PIO_GPIO | PIO_GPIO_IRQ , NOT_INITIAL}, //D1
{PB_3, NOT_INITIAL, PIO_GPIO | PIO_GPIO_IRQ , NOT_INITIAL}, //D2
{PB_31, NOT_INITIAL, PIO_GPIO | PIO_GPIO_IRQ , NOT_INITIAL}, //D3
{PB_30, NOT_INITIAL, PIO_GPIO | PIO_GPIO_IRQ , NOT_INITIAL}, //D4
{PB_28, NOT_INITIAL, PIO_GPIO | PIO_GPIO_IRQ , NOT_INITIAL}, //D5
## Export bin
recipe.hooks.objcopy.postobjcopy.1.pattern=xcopy {runtime.tools.ameba_d_tools.path}\km0_km4_image2.bin {build.path}
recipe.hooks.objcopy.postobjcopy.1.pattern.windows=xcopy {runtime.tools.ameba_d_tools.path}\km0_km4_image2.bin {build.path}
recipe.hooks.objcopy.postobjcopy.1.pattern.linux=cp {runtime.tools.ameba_d_tools.path}/km0_km4_image2.bin {build.path}
recipe.hooks.objcopy.postobjcopy.1.pattern.macosx=cp {runtime.tools.ameba_d_tools.path}/km0_km4_image2.bin {build.path}
recipe.output.tmp_file=km0_km4_image2.bin
recipe.output.save_file=km0_km4_image2.bin
// Comment the following line to disable DEBUG log
#define __DEBUG__
#ifdef __DEBUG__
// You should only uncomment 1 version at a time!
// Version 1
//#define DEBUG(...) Serial.println(__VA_ARGS__)
// Version 2
#define DEBUG(...) Serial.println(__VA_ARGS__); \
Serial.print(" @ [SRC]: "); \