Added arduino libs

هذا الالتزام موجود في:
Mik6e6
2020-07-04 12:31:18 -04:00
ملتزم من قبل GitHub
الأصل 3d9b49e518
التزام dc9596f994
90 ملفات معدلة مع 9419 إضافات و0 حذوفات

عرض الملف

@@ -0,0 +1,48 @@
#include <EnableInterrupt.h>
#ifdef EI_ATTINY24
#define OUTPUTPIN 10 // == B0
#define INTERRUPTEDPIN 9 // == B1
// Modify this at your leisure. But you must be aware of which port it's on (see below).
#elif defined EI_ATTINY25
#define OUTPUTPIN 0 // == B0
#define INTERRUPTEDPIN 1 // == B1
#else
#error Dang, only ATtiny chips supported by this sketch.
#endif
// Connect a LED to Pin 3. It might be different in different ATtiny micro controllers
//const uint8_t outputBitMask = 0x01;
const uint8_t outputBitMask = digital_pin_to_bit_mask_PGM[OUTPUTPIN];
const uint8_t inputBitMask = digital_pin_to_bit_mask_PGM[INTERRUPTEDPIN];
volatile uint16_t endlessCounter=0; // The count will go back to 0 after hitting 65535.
volatile uint8_t interruptState=0;
void interruptFunction() {
if (interruptState) {
interruptState=0;
PORTB &= ~_BV(outputBitMask);
} else {
interruptState=1;
PORTB |= 1 << outputBitMask;
}
}
// the setup routine runs once when you press reset:
void setup() {
DDRB |= outputBitMask; // OUTPUTPIN is set to output
DDRB &= ~inputBitMask; // INPUTPIN is set to input
PORTB |= inputBitMask; // Pull up the resistor
MCUCR &= ~PUD; // ensure Pull Up Disable is off
enableInterrupt(INTERRUPTEDPIN, interruptFunction, CHANGE);
}
// the loop routine runs over and over again forever:
void loop() {
//digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
//delay(1000); // wait for a second
//digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
//delay(1000); // wait for a second
endlessCounter++; // give it something to do
}

عرض الملف

@@ -0,0 +1,19 @@
## Arduino Makefile, see https://github.com/sudar/Arduino-Makefile (it's awesome!)
ARDUINO_DIR = /home/schwager/bin/arduino-1.8.5
# ISP_PORT = /dev/ttyACM0
#BOARD_TAG = attiny85at8
BOARD_TAG = attiny44at8
ALTERNATE_CORE = tiny
BOARDS_TXT = ~/sketchbook/hardware/arduino-tiny/boards.txt
ARDUINO_CORE_PATH = /home/schwager/sketchbook/hardware/arduino-tiny/cores/tiny
# ARDUINO_VAR_PATH = ~/sketchbook/hardware/arduino-tiny/cores/tiny
#AVR_TOOLS_DIR = /home/schwager/bin/arduino-1.8.4/hardware/tools/avr
CFLAGS_STD = -g
CXXFLAGS_STD = -g
ISP_PROG = usbtiny
F_CPU = 1000000L
include /usr/share/arduino/Arduino.mk