Skip to content

Instantly share code, notes, and snippets.

View TorstenC's full-sized avatar

Torsten C. TorstenC

View GitHub Profile
@TorstenC
TorstenC / NotifyBase.cs
Last active November 11, 2016 21:04
Base Class for INotifyPropertyChanged Properties
public class NotifyBase : System.ComponentModel.INotifyPropertyChanged {
protected void OnPropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null) {
PropertyChanged?.Invoke(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected bool SetField<T>(ref T field, T value, [System.Runtime.CompilerServices.CallerMemberName] string propertyName = null) {
if(EqualityComparer<T>.Default.Equals(field, value)) return false;
field = value;
OnPropertyChanged(propertyName);
return true;
@TorstenC
TorstenC / RF_24_Remote01.c
Created September 3, 2016 21:41
Remote Control Receiver for NTF24L01+, SE8R01, RFM70/BK2421, BK2423, XN297 etc.
/* RF_24_Remote01.c
* Created: 31.08.2016 21:41:47
* Author : Torsten C
*/
#define F_CPU 800000UL // 3,3V-CPU läuft an 8MHz-Quarz
#include "MyAvrIO.h" // z.B. PORTB, DDRB, SPCR_SPE, uint8_t, …
#include <string.h> // z.B. memcpy()
#include <stdio.h> // z.B. printf(), benötigt stdout (siehe am Ende)
// ToDo: Ausgabe auf Smartphone mit
// https://www.mikrocontroller.net/articles/MCURSES
@TorstenC
TorstenC / main.c
Last active August 29, 2015 14:22
STM32F030F4P6 Module Blink-Test
// STM8S103F3P6 Hardware module see https://github.com/TorstenC/Notizblog/wiki/Mikrocontroller
#include <stm8s.h>
volatile uint32_t counter = 10;
int main( void ) {
GPIO_Init(GPIOD, GPIO_PIN_3, GPIO_MODE_OUT_PP_LOW_FAST);
GPIO_Init(GPIOB, GPIO_PIN_5, GPIO_MODE_OUT_PP_HIGH_FAST);
while (1) {
while (counter) counter--;
GPIO_WriteHigh(GPIOD, GPIO_PIN_3);
GPIO_WriteLow(GPIOB, GPIO_PIN_5);
@TorstenC
TorstenC / wc24h1816tables.c
Last active August 29, 2015 14:14
Word-Arrays for 24h Wordclock 18 x 16 Initialisierung
// Word-Arrays for 24h Wordclock, see http://www.mikrocontroller.net/articles/WordClock24h
// Von-Neumann-Variant, Data from Wc24h1816_1833,16.Mai15-ACHT-VIER, CodeGen v0.15
// Code-Generator see https://gist.github.com/TorstenC/aec0724be4afcd1d7545
#include "tables.h"
const struct Modes tbl_modes[MODES_COUNT] = {
{ MM_8, HM_5, "ES IST HH UHR MM (12)" },
{ MM_8, HM_6, "ES IST HH UHR MM (24)" },
{ MM_9, HM_5, "ES IST HH UHR UND MM MINUTEN (12)" },
{ MM_9, HM_6, "ES IST HH UHR UND MM MINUTEN (24)" },
{ MM_2, HM_3, "ES IST MM MINUTEN NACH HH UHR (12) NACHTS" },
@TorstenC
TorstenC / wc24h1816tables.h
Last active August 29, 2015 14:14
Word-Arrays for 24h 18 x 16 Wordclock Deklaration + Definition
// Word-Arrays for 24h Wordclock, see http://www.mikrocontroller.net/articles/WordClock24h
// Von-Neumann-Variant, Data from Wc24h1816_1833,16.Mai15-ACHT-VIER CodeGen v0.15
// Code-Generator see https://gist.github.com/TorstenC/aec0724be4afcd1d7545
// tbl_modes[MODES_COUNT]: 1152 bytes
// tbl_hours[HOUR_MODES_COUNT][HOUR_COUNT][MAX_HOUR_WORDS]: 800 bytes
// tbl_minutes[MINUTE_MODES_COUNT][MINUTE_COUNT]: 5280 bytes
// illumination[1][WP_COUNT]: 231 bytes
// total (tbl_minutes + tbl_hours + tbl_modes + illumination): 7463 bytes
#ifndef TABLES_H
@TorstenC
TorstenC / displaytables18x16.json
Last active August 29, 2015 14:13
18 x 16 Steuer-Daten der 24h Wordclock im JSON-Format
{"comment":"Mock-up arrays for 24h Wordclock, see http://www.mikrocontroller.net/articles/WordClock24h",
"version":"Data from WC24h_18x16_V2_2010_2003_15_Dez_2014, CodeGen v0.02",
"columnsCount":18,
"rowsCount":16,
"display":[
"ES#IST#VIERTELEINS",
"DREINERSECHSIEBEN#",
"ELFÜNFNEUNVIERACHT",
"NULLZWEI#ZWÖLFZEHN",
"UND#ZWANZIGVIERZIG",
@TorstenC
TorstenC / HUB08_PAL_STM32.h
Last active August 29, 2015 14:11
WC24h-PCB-abstraction for HUB08 Display module and STM32F103C8T6
// Module Pin 26: "A" (PB14)
// Module Pin 27: 2.MOSI = G1 (PB15)
// Module Pin 28: 1.CK = SCK (PA8)
// Module Pin 29: 1.TX = B1 (PA9)
// Module Pin 30: "B" (PA10)
// Module Pin 31: "C" (PA11)
// Module Pin 32: "D" (PA12)
// Module Pin 38: 1.MOSI = R1 (PB5)
// Module Pin 39: LAT (PB6)
// Module Pin 40: OE (PB7)
@TorstenC
TorstenC / tables.h
Last active August 29, 2015 14:11
16 x 16 Arrays aus den Tabellen der 24h Wordclock
// Word-Arrays for 24h Wordclock, see http://www.mikrocontroller.net/articles/WordClock24h
// Von-Neumann-Variant, Data from WC24h16x16_28.Nov.2014_1607Uhr_korr2 CodeGen v0.11
// Code-Generator see https://gist.github.com/TorstenC/aec0724be4afcd1d7545
// tbl_modes[MODES_COUNT]: 386 bytes
// tbl_hours[HOUR_MODES_COUNT][HOUR_COUNT][MAX_HOUR_WORDS]: 750 bytes
// tbl_minutes[MINUTE_MODES_COUNT][MINUTE_COUNT]: 3360 bytes
// illumination[1][WP_COUNT]: 252 bytes
// total (tbl_minutes + tbl_hours + tbl_modes + illumination): 4748 bytes
#define ModesCount 10 // deprecated
@TorstenC
TorstenC / display.h
Last active August 29, 2015 14:11
16 x 16 Arrays für das 24h Wordclock Mock-up aus den Tabellen
// Mock-up arrays for 24h Wordclock, see http://www.mikrocontroller.net/articles/WordClock24h
// Von-Neumann-Variant, Data from WC24h16x16_28.Nov.2014_1607Uhr_korr2, CodeGen v0.11
// Code-Generator see https://gist.github.com/TorstenC/aec0724be4afcd1d7545
#define DisplayX 16 // deprecated
#define WC_COLUMNS 16
#define DisplayY 16 // deprecated
#define WC_ROWS 16
struct WordIllu {
@TorstenC
TorstenC / WC24h_18x16.xml
Created December 7, 2014 22:58
Aus den Tabellen der 24h Wordclock 18 x 16 generiertes geprüftes XML
<?xml version="1.0" encoding="utf-8"?>
<WC24h version="WC24h16x16_28.Nov.2014_1607Uhr">
<!--ES#IST#SIND#HALB-->
<!--DREIVIERTELFACHT-->
<!--ZWEINEUNULLZWÖLF-->
<!--DREINSECHSIEB###-->
<!--##ELFÜNFZSIEBEND-->
<!--ZWANZIG#DREISSIG-->
<!--VIERZIG##FÜNFZIG-->
<!--MINUTENUHRVORUND-->