This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // RefObj.h : includes CRefObject, CRefAutoPtr | |
| // | |
| // Written by "Daniel Ranger" <dranger003@gmail.com> | |
| // Copyright (c) 2009 Daniel Ranger | |
| // | |
| // DESCRIPTION | |
| // | |
| // CRefAutoPtr is a smart pointer class to manage reference count within | |
| // a CRefObject class. A normal smart pointer class manages reference | |
| // count within its own class however in this implementation you must |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #pragma once | |
| struct CFileHandleTraits | |
| { | |
| typedef HANDLE HTYPE; | |
| static const HTYPE INVALID_HANDLE; | |
| static BOOL Close(HTYPE h) | |
| { | |
| return ::CloseHandle(h) != FALSE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // FormatBytes.h : includes AtlConvertBytes, AtlFormatBytes | |
| // | |
| // Written by "Daniel Ranger" <dranger003@gmail.com> | |
| // Copyright (c) 2009 Daniel Ranger | |
| // | |
| // DESCRIPTION | |
| // | |
| // Utility functions to convert a number of bytes into either a specific | |
| // unit or the unit based on the multiple of the base (1000 or 1024). | |
| // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Threading; | |
| namespace FORMATIQUE | |
| { | |
| public class BlockingQueue<T> | |
| { | |
| private int _head = -1; | |
| private int _tail = -1; | |
| private T[] _buffer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ATtiny85 | |
| // Hardware PWM, pins 0, 1 & 4 | |
| int main() | |
| { | |
| sei(); | |
| DDRB = _BV(PORTB0); // OC0A | |
| DDRB |= _BV(PORTB1); // OC0B | |
| DDRB |= _BV(PORTB4); // OC1B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const double _F = F_CPU / 38000.0 + 0.5 - 1; | |
| const double _D = _F * 0.33 + 0.5 - 1; | |
| const uint16_t _cv[] = { 40085, 36.39716198 }; | |
| const uint16_t _cp[][2] = | |
| { | |
| { 97, 24 }, | |
| { 24, 24 }, | |
| { 48, 24 }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 1 cycle = 62.5ns | |
| int main() | |
| { | |
| DDRD |= _BV(3); | |
| PORTD &= ~_BV(3); | |
| for (;;) | |
| { | |
| PORTD ^= _BV(3); // 5 cycles |
NewerOlder