Skip to content

Instantly share code, notes, and snippets.

View nraynaud's full-sized avatar
🌵
learning new things

Nicolas Raynaud nraynaud

🌵
learning new things
View GitHub Profile
@nraynaud
nraynaud / Form1.cs
Created February 7, 2014 20:31
clipper C# GUI demo main form cleanup
//#define UsePolyTree
using System;
using System.Diagnostics;
using System.Text;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
@nraynaud
nraynaud / registers.ads
Created October 11, 2014 09:38
started reworking Adacore's modeling of registers in STM32F4
--------------------------------------------------------------------
---
-----------
-- --
-- GNAT EXAMPLE --
-- --
-- Copyright (C) 2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="chrome=1"/>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Visual CAM</title>
<script src="webapp/libs/require.js"></script>
<script src="webapp/config.js"></script>
<script>
requirejs.config({
@nraynaud
nraynaud / main.c
Created March 24, 2015 22:12
STM32F4: sending data to 2 chained 74HCT595 shift registers
#include <stm32f4xx.h>
#include "stm32f4xx_conf.h"
#include "stm32f4_discovery.h"
#include "math.h"
#include "arm_math.h"
uint16_t counter = 0;
void sendCounter();
@nraynaud
nraynaud / gist:75650aae6ebad2f97d77
Created March 30, 2015 16:13
STM32F4: receiving one shot of data on the SPI bus in receive only
#include <stm32f4xx.h>
#include "stm32f4xx_conf.h"
#include "stm32f4_discovery.h"
#include "math.h"
#include "arm_math.h"
volatile uint16_t counter = 0;
volatile uint16_t savedCounter = 0;
uint16_t parallelPins = GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10;
@nraynaud
nraynaud / svg.marker.js
Created April 18, 2014 12:20
markers for svg.js
"use strict";
define(['libs/svg'], (function () {
SVG.Marker = SVG.invent({
create: 'marker',
inherit: SVG.Container,
extend: {
getRef: function () {
return 'url(#' + this.attr('id') + ')'
},
update: function (block) {
const struct __attribute__((__packed__, aligned (4))) {
uint8_t bLength, bDescriptorType;
uint8_t bcdUSBL, bcdUSBH;
uint8_t bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize;
uint8_t idVendorL, idVendorH;
uint8_t idProductL, idProductH;
uint8_t bcdDeviceL, bcdDeviceH;
uint8_t iManufacturer, iProduct, iSerialNumber;
uint8_t bNumConfigurations;
} deviceDescriptor = {
test("jsparse number evaluation", function () {
var jp = jsparse;
var number = jp.action(jp.repeat1(jp.range('0', '9')), function (ast) {
return ast.join('');
});
var decimalPart = jp.action(jp.sequence('.', number), function (ast) {
return ast.join('');
});
var integerAndDecimal = jp.action(jp.sequence(number, jp.optional(decimalPart)), function (ast) {
return ast[1] !== false ? ast[0] + ast[1] : ast[0];
@nraynaud
nraynaud / serial.html
Created August 26, 2013 19:17
first test for a Huanyang VFD google chrome extension. broken without reason, the read just says it retrieved one byte.
<!DOCTYPE html>
<html>
<head>
<title>modbus ?</title>
</head>
<body>
modbus ?<br>
<script src="serial.js"></script>
<label>
DCD:
@nraynaud
nraynaud / test_C++.cpp
Created October 7, 2013 06:35
STM32F4 MCU C++ API test.
#include "stm32f4xx_conf.h"
#include "stm32f4_discovery.h"
template<uint32_t GPIO_CLK, intptr_t GPIO_PORT_ADDR> class GPIOPort {
public:
static GPIOPort& port() {
static GPIOPort instance;
return instance;
};