Skip to content

Instantly share code, notes, and snippets.

@mitjakukovec
mitjakukovec / .gdbinit
Last active August 29, 2015 14:08 — forked from skyscribe/.gdbinit
#
# STL GDB evaluators/views/utilities - 1.03
#
# The new GDB commands:
# are entirely non instrumental
# do not depend on any "inline"(s) - e.g. size(), [], etc
# are extremely tolerant to debugger settings
#
# This file should be "included" in .gdbinit as following:
# source stl-views.gdb or just paste it into your .gdbinit file
@mitjakukovec
mitjakukovec / imguiverticaltext.h
Created June 28, 2016 18:44 — forked from Flix01/imguiverticaltext.h
ImDrawList methods to display vertical text in ImGui
#pragma once
#include <imgui.h>
#include <imgui_internal.h>
// ImDrawList methods to display vertical text
/*
// TEST: inside a window:
ImGuiWindow* window = ImGui::GetCurrentWindow();
ImDrawList* dl = window->DrawList;
@mitjakukovec
mitjakukovec / pcint_example.c
Created April 3, 2018 19:10 — forked from Wollw/pcint_example.c
ATMega328P PCINT example
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/atomic.h>
#include <util/delay.h>
#include <stdbool.h>
/*
* A global flag used to communicate between the Interrupt Service Routine
* and the main program. It has to be declared volatile or the compiler
* might optimize it out.
@mitjakukovec
mitjakukovec / interrupt_example.c
Created April 3, 2018 19:10 — forked from Wollw/interrupt_example.c
AVR Timer Interrupt Examples
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdbool.h>
/*
* A global flag used to communicate between the Interrupt Service Routine
* and the main program. It has to be declared volatile or the compiler
* might optimize it out.
*/
volatile bool update = false;
@mitjakukovec
mitjakukovec / main.c
Created April 3, 2018 19:10 — forked from Wollw/main.c
#include <stdio.h>
#include "serial.h"
#include <avr/pgmspace.h>
int main(void) {
serial_init(19200);
int i;
char buffer[8];
@mitjakukovec
mitjakukovec / m328p_fastpwm.c
Created April 3, 2018 19:11 — forked from Wollw/m328p_fastpwm.c
ATmega328P PWM Example
/**
* A PWM example for the ATmega328P using the 8-Bit Fast PWM mode.
*/
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdbool.h>
#include <util/delay.h>
int main (void) {
@mitjakukovec
mitjakukovec / adc_example.c
Created April 3, 2018 19:12 — forked from Wollw/adc_example.c
ATmega328P ADC conversion example
/* A simple ADC example that checks the analog reading on ADC0 and turns
* an LED on if the reading is higher than a threshold value and turns if
* off if it is under that value. */
#include <avr/io.h>
#include <stdint.h>
/* Which analog pin we want to read from. The pins are labeled "ADC0"
* "ADC1" etc on the pinout in the data sheet. In this case ADC_PIN
* being 0 means we want to use ADC0. On the ATmega328P this is also
* the same as pin PC0 */
@mitjakukovec
mitjakukovec / 74HC595_example.c
Created April 3, 2018 19:15 — forked from Wollw/74HC595_example.c
ATMega328P 74HC595 Example
#include <avr/io.h>
#include <util/delay.h>
#include <stdlib.h>
#include <stdint.h>
typedef uint8_t bits_type;
#define CFG_SHIFT_DDR DDRB
#define CFG_SHIFT_PORT PORTB
#define CFG_SHIFT_SRCLK PB1
#define CFG_SHIFT_RCLK PB2
@mitjakukovec
mitjakukovec / deque.c
Created April 3, 2018 19:16 — forked from Wollw/deque.c
Deque in C
#include <stdlib.h>
#include <assert.h>
#include "deque.h"
struct node_struct {
struct node_struct *next;
struct node_struct *prev;
deque_val_type val;
};
@mitjakukovec
mitjakukovec / class.c
Created April 3, 2018 19:18 — forked from Wollw/class.c
Object Encapsulation in ANSI C
#include <malloc.h>
#include "class.h"
/* This is the actual implementation of the class.
* Because this file isn't included by main.c
* code in main.c can not access foo except through
* the functions declared in class.h.
*/
struct my_class_s {
int foo;