Skip to content

Instantly share code, notes, and snippets.

118059 verbose linkMans [email protected]
118060 verbose rebuildBundles [email protected]
118061 silly build graceful-fs
118062 info linkStuff [email protected]
118063 silly linkStuff [email protected] has C:\Users\B48923\AppData\Roaming\npm\node_modules\strongloop\node_modules\globule\node_modules as its parent node_modules
118064 silly linkStuff [email protected] is part of a global install
118065 silly linkStuff [email protected] is installed into a global node_modules
118066 verbose linkBins [email protected]
118067 verbose linkMans [email protected]
118068 verbose rebuildBundles [email protected]
@Overdrivr
Overdrivr / KL25Z_serial_easy_setup.c
Last active January 15, 2016 15:36
serial/UART simple program and setup with Kinetis KL25Z
/* --
This program shows how to configure and output 'AB\n' on the USB serial port of a KL25Z
It is using processor expert and was tested on Kinetis Design Studio (KDS) ver 3.0.0
-- */
// 1. Add Processor Expert module AsynchroSerial
// In KDS, in the 'Components' view, right click on 'Components' then "Show components library"
// In the opened window, select the category 'Kinetis/Peripheral Drivers/Communication' and double-click on AsyncroSerial
// this will add the AsyncroSerial module to your project
// 2. Configuration
@Overdrivr
Overdrivr / cffi-python-struct.py
Last active August 8, 2023 22:58
Pass and return structs (by copy) between C and Python using CFFI
from cffi import FFI
ffi = FFI()
ffi.cdef("""
typedef struct T T;
struct T
{
int a;
float b;
};
@Overdrivr
Overdrivr / Plot.py
Created February 3, 2016 17:43
Matplotlib animated sine function with Tkinter canvas
import matplotlib
matplotlib.use('TkAgg')
from numpy import arange, sin, pi
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from matplotlib.figure import Figure
import tkinter as Tk
import tkinter.ttk as ttk
class Plot2D(Tk.Frame):
def __init__(self,parent,**kwargs):
@Overdrivr
Overdrivr / Plot.py
Created February 4, 2016 13:38
PyQtGraph animated sine and cosine functions - real smooth
# -*- coding: utf-8 -*-
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
from numpy import arange, sin, cos, pi
import pyqtgraph as pg
import sys
class Plot2D():
def __init__(self):
self.traces = dict()
@Overdrivr
Overdrivr / telemetry-publish.c
Created February 5, 2016 14:12
Example to use telemetry to publish regularly a value on a topic (MBED)
#include "telemetry/driver.hpp"
int main()
{
// User state - not used for now
TM_state state;
// Create a telemetry instance
Telemetry TM(&state);
@Overdrivr
Overdrivr / example_printer.py
Created February 5, 2016 14:28
Print received values from a telemetry-enabled serial connection using pytelemetry
import pytelemetry as tm
import pytelemetry.transports.serialtransport as transports
import time
def printer(topic, data):
print(topic," : ", data)
transport = transports.SerialTransport()
c = tm.pytelemetry(transport)
@Overdrivr
Overdrivr / Plot.py
Created February 7, 2016 10:04
Runs a Pyqtgraph in a second process, liberating the main process to continue its work.
# -*- coding: utf-8 -*-
"""
This demo is similar to Pyqtgraph remote plotting examples (https://github.com/pyqtgraph/pyqtgraph/blob/develop/examples/RemoteGraphicsView.py)
Except that it does not use Pyqtgraph's buggy multiprocess module. Instead, it relies on standard python 3+ multiprocessing (https://docs.python.org/3.5/library/multiprocessing.html).
In this example, function f is executed in a second process, which liberates immediately the main process.
"""
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
from multiprocessing import Process, Manager
@Overdrivr
Overdrivr / Plot.py
Last active October 25, 2023 12:49
Reads data from a thread, plots it in another Process, with main process being free all the time ! Using PyQtGraph, python standard multiprocessing and multiprocessing.Queue
# -*- coding: utf-8 -*-
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
from multiprocessing import Process, Manager, Queue
import sched, time, threading
# This function is responsible for displaying the data
# it is run in its own process to liberate main process
def display(name,q):
@Overdrivr
Overdrivr / Plot.py
Last active March 8, 2023 09:37
Plots data to a PyQtGraph graph that is hosted another process, effectively liberating main thread immediately.
# -*- coding: utf-8 -*-
"""
This example is identical to https://gist.github.com/Overdrivr/efea3d363556c0dcf4b6
Except that here the plot is contained in a class.
The superplot.start method starts the graph and returns a standard multiprocessing.queue
the io function puts data in this queue, while the graph empties it regularly
The outcome is :
- a super fast application thanks to PyQtGraph
- a main process that is never blocked by the graph
Enjoy !