Skip to content

Instantly share code, notes, and snippets.

View ahmetserdar's full-sized avatar

ahmet serdar ahmetserdar

  • Gebze Technical University
  • Turkey
View GitHub Profile
#include <SoftSPI.h>
/*
This code based from pecanpico6 Si446x Driver by KT5TK
https://github.com/tkrahn/pecanpico5a
*/
/*
const static uint8_t SS = 30; // PIC32 SS2
const static uint8_t MOSI = 29; // PIC32 SDO2
const static uint8_t MISO = 27; // PIC32 SDI2
@ahmetserdar
ahmetserdar / aligned_malloc.c
Created February 17, 2022 07:48 — forked from prasadwrites/aligned_malloc.c
n byte aligned malloc implementation
/*
* nMalloc.cpp
*
* Created on: Dec 5, 2014
* Author: prasadnair
*/
#include <stdlib.h>
#include <stdio.h>
@ahmetserdar
ahmetserdar / RIOServer_sm9.cpp
Created January 5, 2022 07:09 — forked from ujentus/RIOServer_sm9.cpp
Windows Registered I/O (RIO) Sample Code (Echo Server)
/*********************************************************************************************************
* Windows Registered I/O (RIO) Sample Code (Echo Server)
* Minimum requirement: Windows 8 or Windows Server 2012
* Author: @sm9kr
*
* Notice
* 몇몇 코드 조각들은 (http://www.serverframework.com/asynchronousevents/rio/)에서 가져옴.
* 그런데 여기도 제대로 완성된 코드가 있었던 것은 아니라서 상당 부분 기능을 추가하여 동작하도록 함.
* RIO의 사용법을 보여주기 위한 코드라 최대한 간단하게 필요한 부분만 넣었음.
* 그래서, 버그가 있을 수 있음...
@ahmetserdar
ahmetserdar / main.cpp
Created June 25, 2021 11:38 — forked from jkiv/main.cpp
FTDI GPIO example
#include <iostream>
#include <iomanip>
#include <chrono> // for std::chrono::milliseconds
#include <thread> // for std::this_thread::sleep_for
#include "ftd2xx.h" // must be in project include path
/*** HELPER FUNCTION DECLARATIONS ***/
// Formats and writes FT_DEVICE_LIST_INFO_NODE structure to output

I believe the article was originally written by fede.tft.

It appears they have copied source code to github and updated it for C++11: https://github.com/fedetft/serial-port

Introduction

The serial port protocol is one of the most long lived protocols currently in use. According to wikipedia, it has been standadized in 1969. First, a note: here we're talking about the RS232 serial protocol. This note is necessary because there are many other serial protocols, like SPI, I2C, CAN, and even USB and SATA.

Some time ago, when the Internet connections were done using a 56k modem, the serial port was the most common way of connecting a modem to a computer. Now that we have ADSL modems, the serial ports have disappeared from newer computers, but the protocol is still widely used.

In fact, most microcontrollers, even the newer ones have one or more peripherals capable of communicating using this protocol, and from the PC side, all operating system

@ahmetserdar
ahmetserdar / pulse_density_modulation.py
Created May 19, 2020 10:19 — forked from jeanminet/pulse_density_modulation.py
Simple simulation of pulse density modulator
import numpy as np
import matplotlib.pyplot as plt
def pdm(x):
n = len(x)
y = np.zeros(n)
error = np.zeros(n+1)
for i in range(n):
y[i] = 1 if x[i] >= error[i] else 0
error[i+1] = y[i] - x[i] + error[i]