Skip to content

Instantly share code, notes, and snippets.

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

Kenta IDA ciniml

🏠
Working from home
View GitHub Profile
@ciniml
ciniml / esp32_ble_gattc_scan.ino
Created May 21, 2017 17:13
esp32_ble_gattc_scan
#include <Esp.h>
#include <esp32-hal-bt.h>
#include "bt.h"
#include "esp_bt_main.h"
#include "esp_gap_ble_api.h"
#include "esp_gattc_api.h"
static esp_gatt_if_t appGattcIf = ESP_GATT_IF_NONE;
static constexpr uint16_t appId = 0x0001u;
@ciniml
ciniml / InitializeStructArrayWithLinq.cs
Created June 8, 2017 05:36
InitializeStructArrayWithLinq
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
enum MemAttr
{
@ciniml
ciniml / freertos_future.hpp
Created July 16, 2017 09:24
C++11 std::future like class template for FreeRTOS
#ifndef FREERTOS_FUTURE_HPP__
#define FREERTOS_FUTURE_HPP__
#include <type_traits>
#include <utility>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "freertos/event_groups.h"
@ciniml
ciniml / test_server.js
Last active September 6, 2017 22:38
ESP32 HTTPS communication test server
const https = require('https');
const fs = require('fs');
const util = require('util');
const debuglog = util.debuglog('SERVER')
const options = {
key: fs.readFileSync('test_server.key'),
cert: fs.readFileSync('test_server.crt')
};
@ciniml
ciniml / dfu_upload.bat
Created November 3, 2017 00:20
Fixed dfu_upload.bat for users whose Windows user name contains some blanks
@echo off
echo DFU begin
"%~dp0/dfu-util-0.8-mingw32/dfu-util.exe" -d %2 -a %1 -D "%3" -s %4 -R
echo DFU end
@ciniml
ciniml / start_intelhls.bat
Created November 7, 2017 13:53
Batch script to setup Intel HLS Compiler environment variables
@set INTELFPGA_DIR=C:\intelFPGA_lite
@set INTELFPGA_VER=17.1
@set INTELFPGA_ROOT=%INTELFPGA_DIR%\%INTELFPGA_VER%
@set MODELSIM_TYPE=modelsim_ase
@echo Using Intel FPGA in %INTELFPGA_ROOT%
@set "WindowsSdkDir=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1\"
@set "PATH=%WindowsSdkDir%bin\NETFX 4.0 Tools;%WindowsSdkDir%bin;%PATH%"
@set "INCLUDE=%WindowsSdkDir%include;%INCLUDE%"
@ciniml
ciniml / start_intelhls_vs2010pro.bat
Created November 7, 2017 19:15
Batch script to setup Intel HLS Compiler environment with VS2010 Pro
@set INTELFPGA_DIR=C:\intelFPGA_lite
@set INTELFPGA_VER=17.1
@set INTELFPGA_ROOT=%INTELFPGA_DIR%\%INTELFPGA_VER%
@set MODELSIM_TYPE=modelsim_ase
@echo Using Intel FPGA in %INTELFPGA_ROOT%
call "%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvars64.bat"
@set HLS_ROOT=%INTELFPGA_ROOT%\hls
@ciniml
ciniml / design_top.tcl
Created December 4, 2017 21:37
udmabuf_dma_test_design
################################################################
# This is a generated script based on design: design_top
#
# Though there are limitations about the generated script,
# the main purpose of this utility is to make learning
# IP Integrator Tcl commands easier.
################################################################
namespace eval _tcl {
@ciniml
ciniml / Output
Created January 17, 2018 18:49
C# Simple State Machine
Initial State: Initial
Initial -> Connecting
Connecting...
Connecting -> Connected
Connected
Connected -> Disconnecting
Disconnecting -> Disconnected
Connecting...
Connecting -> Connected
Connected
@ciniml
ciniml / swap_component.hpp
Created February 14, 2018 15:44
HLS Stream Packing
#include <hls_stream.h>
#include <ap_int.h>
#include <ap_fixed.h>
template <typename TComponentType, int TNumberOfComponents>
struct PackedComponent
{
typedef PackedComponent<TComponentType, TNumberOfComponents> SelfType;
typedef TComponentType ComponentType;
static const int NumberOfComponents = TNumberOfComponents;