This file contains 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
#include <stdint.h> | |
extern __flash const uint8_t digital_pin_to_bit_mask_PGM[]; | |
uint8_t read_array(uint8_t i) | |
{ | |
return digital_pin_to_bit_mask_PGM[i]; // bug: uses ld | |
// return *(digital_pin_to_bit_mask_PGM + i); // uses lpm | |
} |
This file contains 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
sudo ./openocd -f ~/devel/dap/cmsis-dap.cfg | |
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev (2020-10-13-17:27) | |
Licensed under GNU GPL v2 | |
For bug reports, read | |
http://openocd.org/doc/doxygen/bugs.html | |
Info : CMSIS-DAP: SWD Supported | |
Info : CMSIS-DAP: FW Version = 1.0.0 | |
Info : CMSIS-DAP: Interface Initialised (SWD) | |
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1 | |
Info : CMSIS-DAP: Interface ready |
This file contains 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
// Ralph Doncaster 2020 public domain software | |
// calculate the 64-bit inverse of odd integers | |
#include <stdio.h> | |
#include <stdint.h> | |
#define END_RANGE 9999 | |
int main() | |
{ | |
uint64_t neg1 = (uint64_t) -1LL; |
This file contains 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
// Ralph Doncaster 2020 public domain software | |
// generate lookup table for powers of sqrt(2) | |
#include <stdio.h> | |
#include <math.h> | |
int main() | |
{ | |
double sqrt2 = sqrt(2.0); | |
for (double d = 2; d <= 16; d += 1) { | |
printf( "1.414^%d = %lf\n", (int)d, pow(sqrt2, d) ); |
This file contains 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
/* Fridge Door Alarm for the ATTiny13[A] | |
* | |
* Functionality: | |
* | |
* Door opens, door open chime. | |
* After 60 seconds, door-open warning beep. | |
* If door still open, warning beeps every 30 seconds. | |
* After 5 minutes, continous alarm signal. | |
* Door closes, door close chime. | |
* If Silent Running pressed, no door chimes for ONE operation. |
This file contains 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
/* | |
ATtiny13 internal oscillator tuner | |
By Ralph Doncaster (2019) | |
Tweaked and tuned by MCUdude | |
------------------------------------------------------------------------------ | |
[ See diagram: https://github.com/MCUdude/MicroCore#minimal-setup ] | |
Tunes the internal oscillator using a software serial implementation |
This file contains 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
/* ssd1306 test for picoI2C | |
* Ralph Doncaster (c) 2019 | |
* free software - MIT license | |
*/ | |
#include <stdint.h> | |
#include <avr/io.h> | |
#include <avr/pgmspace.h> | |
#include <util/delay.h> | |
#include "picoI2C.h" |
This file contains 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
// t13 OSCCAL tuner | |
// Ralph Doncaster 2019 public domain software | |
// repeatedly press 'x' until OSCCAL value stabilizes | |
// output value is timing delta in cycles followed by OSCCAL | |
#define BAUD_RATE 115200 | |
#include <BBUart.h> | |
#include <avr/sleep.h> | |
#define UART_RX 1 |
This file contains 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
// blink LED using sleep and millis() on MicroCore | |
// 2019 Ralph Doncaster freeware | |
#define LEDPIN 0 | |
#include <avr/sleep.h> | |
static void sleep_ms(unsigned ms) { | |
ms -= 9; // 1/2 millis minimum increment in MicroCore | |
unsigned snapshot = (unsigned)millis(); |
This file contains 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
/* 2018 Ralph Doncaster public domain software */ | |
/* spew a char to stdout, null if none provided */ | |
#include <unistd.h> | |
#include <string.h> | |
int main(int argc, char** argv){ | |
char buf[1024]; | |
char c = 0; | |
if( argc > 1 ) c = *argv[1]; |
NewerOlder