Skip to content

Instantly share code, notes, and snippets.

View minimum-necessary-change's full-sized avatar

minimum-necessary-change

View GitHub Profile
/*******************Demo for MQ-2 Gas Sensor Module V1.0*****************************
Support: Tiequan Shao: support[at]sandboxelectronics.com
Lisence: Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0)
Note: This piece of source code is supposed to be used as a demostration ONLY. More
sophisticated calibration is required for industrial field application.
Sandbox Electronics 2011-04-25
************************************************************************************/

GCC compiler optimization for ARM-based systems

2017-03-03 fm4dd

The gcc compiler can optimize code by taking advantage of CPU specific features. Especially for ARM CPU's, this can have impact on application performance. ARM CPU's, even under the same architecture, could be implemented with different versions of floating point units (FPU). Utilizing full FPU potential improves performance of heavier operating systems such as full Linux distributions.

-mcpu, -march: Defining the CPU type and architecture

These flags can both be used to set the CPU type. Setting one or the other is sufficient.

@minimum-necessary-change
minimum-necessary-change / Wemos Lolin32 vs Wemos Lolin32 Lite Pinout.txt
Last active April 9, 2019 09:48
Wemos Lolin32 vs Wemos Lolin32 Lite Pinout
http://blog.pagefault-limited.co.uk/wemos-lolin32-pinout-vs-wemos-lolin32-lite-pinout
@minimum-necessary-change
minimum-necessary-change / 2ddda.c
Last active June 4, 2019 08:28
Image Scaling
/**************************************************************************
** ResizeDDA -- Reads an image from file 'f' one scan line at a time,
** outputs the image resized by the 'zoom' factor.
*/
void ResizeDDA(FILE *f, int rows, int cols, double zoom)
{
unsigned char *aspline, *line;
int x, y;
int ddax, dday, izoom, i, k;
extern int getline(FILE *, int, unsigned char *);
@minimum-necessary-change
minimum-necessary-change / rgb565.pde
Created April 19, 2019 11:41 — forked from companje/rgb565.pde
rgb565 to rgb888
//convert RGB565 to RGB888
byte src[] = loadBytes("ui.bin");
byte dst[] = new byte[src.length/2*3];
for (int i=0, j=0; i<src.length; i+=2) {
int c = src[i] + (src[i+1]<<8);
byte r = byte(((c & 0xF800) >> 11) << 3);
byte g = byte(((c & 0x7E0) >> 5) << 2);
byte b = byte(((c & 0x1F)) << 3);
@minimum-necessary-change
minimum-necessary-change / high-frequency-square-wave-generator-esp8266.ino
Created April 24, 2019 07:44 — forked from Jamesits/high-frequency-square-wave-generator-esp8266.ino
High-accuracy square wave generator (up to 250KHz) based on ESP8266, with runtime adjustable frequency, PWM width and offset.
// High-accuracy square wave generator
// based on ESP8266
// with runtime adjustable frequency, PWM width and offset
// Output wave at pin 5 (configurable from 0 to 15, but not 16)
// by James Swineson <github@public.swineson.me>, 2017-10
// https://gist.github.com/Jamesits/92394675c0fe786467b26f90e95d3904
// See https://blog.swineson.me/implementation-of-6mbps-high-speed-io-on-esp8266-arduino-ide/
// for more information (article in Chinese)
// Arduino UNO version: https://gist.github.com/Jamesits/8d164818946a65d0cafcd6203e3e5049
/*
Features
Module supports external voltage input of the 4-way acquisition (voltage input range of 0-5v)
integrated photoresistor
integrated thermistor
integrated potentiometer
Modules power indicator
Modules with DA output indicator, when the module DA output interface voltage reaches a certain value, will be lit panel the DA output indicator, the higher the voltage, the more obvious indicator brightness
Remove shunts to bypass on board integrated devices
The left connector
@minimum-necessary-change
minimum-necessary-change / RCWL-0516.ino
Created April 30, 2019 11:38
Radar Microwave Sensor - RCWL-0516
/*
* Arduino Microwave Radar Motion Sensor Interface
* https://Circuits4you.com
* Oct 2018
*/
int Sensor = 2; //Input Pin
int LED = 13; // Led pin for Indication
int flg = 0; //Change detection flag
@minimum-necessary-change
minimum-necessary-change / Build_ESP32_toolchain_for_ARM.txt
Created June 4, 2019 06:43
Build ESP32 toolchain for ARM (Linux)
https://github.com/espressif/arduino-esp32/issues/1024#issuecomment-360324759
Got it working!
I will post here my notes and results so others know what to expect!
I did this in a Pine64+ ARM (a 64bit ARM SBC).
Before running this I had installed Arduino IDE with this script: https://github.com/pfeerick/pine64-scripts/blob/master/install-arduino-ide.sh
To install ESP32 toolchain on Armbian:
See: http://esp-idf.readthedocs.io/en/latest/get-started/linux-setup-scratch.html
@minimum-necessary-change
minimum-necessary-change / atmel_adc_oversample.c
Last active June 20, 2019 09:33
Atmel ADC Oversampling
/*****************************************************************************
*
* Atmel Corporation
*
* File : main.c
* Compiler : IAR EWAAVR 2.28a/3.10c
* Revision : $Revision: 1.1 $
* Date : $Date: Wednesday, July 13, 2005 10:43:44 UTC $
* Updated by : $Author: omella $
*