buttons
This commit is contained in:
parent
4a5d49c28d
commit
4fa8c52157
|
@ -1 +1,3 @@
|
||||||
src/blink/build
|
src/blink/build
|
||||||
|
blink/build
|
||||||
|
blink/build
|
||||||
|
|
|
@ -5,8 +5,7 @@ BUILD=./build
|
||||||
mkdir -p $BUILD
|
mkdir -p $BUILD
|
||||||
avr-gcc -mmcu=atmega328p -DF_CPU=16000000L \
|
avr-gcc -mmcu=atmega328p -DF_CPU=16000000L \
|
||||||
-DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR \
|
-DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR \
|
||||||
-I/home/plex/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino \
|
-I/usr/avr/include \
|
||||||
-I/home/plex/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/eightanaloginputs \
|
|
||||||
main.c -o $BUILD/main.elf
|
main.c -o $BUILD/main.elf
|
||||||
avr-objcopy -O ihex -R .eeprom $BUILD/main.elf $BUILD/main.hex
|
avr-objcopy -O ihex -R .eeprom $BUILD/main.elf $BUILD/main.hex
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
TDIR=$(mktemp -d)
|
||||||
|
BUILD=./build
|
||||||
|
mkdir -p $BUILD
|
||||||
|
avr-gcc -mmcu=atmega328p -DF_CPU=16000000L \
|
||||||
|
-DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR \
|
||||||
|
-I/usr/avr/include \
|
||||||
|
main.c -o $BUILD/main.elf
|
||||||
|
avr-objcopy -O ihex -R .eeprom $BUILD/main.elf $BUILD/main.hex
|
||||||
|
|
||||||
|
avr-size -A $BUILD/main.elf
|
||||||
|
avrdude \
|
||||||
|
"-C/home/plex/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf" -v -V \
|
||||||
|
-patmega328p -carduino -P/dev/ttyUSB0 -b57600 -D \
|
||||||
|
-Uflash:w:$BUILD/main.hex:i
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,18 @@
|
||||||
|
:100000000C9434000C943E000C943E000C943E0082
|
||||||
|
:100010000C943E000C943E000C943E000C943E0068
|
||||||
|
:100020000C943E000C943E000C943E000C943E0058
|
||||||
|
:100030000C943E000C943E000C943E000C943E0048
|
||||||
|
:100040000C943E000C943E000C943E000C943E0038
|
||||||
|
:100050000C943E000C943E000C943E000C943E0028
|
||||||
|
:100060000C943E000C943E0011241FBECFEFD8E04C
|
||||||
|
:10007000DEBFCDBF0E9440000C9481000C940000B4
|
||||||
|
:10008000CF93DF93CDB7DEB784E290E02FEFFC0192
|
||||||
|
:1000900020838AE290E0FC0110828BE290E0FC0178
|
||||||
|
:1000A00020818BE290E02C60FC01208385E290E0CF
|
||||||
|
:1000B000FC01108289E290E0FC018081882F90E0B1
|
||||||
|
:1000C00084709927009749F485E290E0FC01208133
|
||||||
|
:1000D00085E290E02062FC01208389E290E0FC014F
|
||||||
|
:1000E0008081882F90E088709927009719F785E222
|
||||||
|
:1000F00090E0FC01208185E290E02F7DFC012083CF
|
||||||
|
:06010000D9CFF894FFCFF7
|
||||||
|
:00000001FF
|
|
@ -0,0 +1,21 @@
|
||||||
|
#define F_CPU 16000000UL
|
||||||
|
#define __AVR_ATmega328P__
|
||||||
|
#include <avr/io.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
DDRB = 0xff;
|
||||||
|
DDRD = 0;
|
||||||
|
|
||||||
|
PORTD |= (1 << PORTD2) | (1 << PORTD3);
|
||||||
|
|
||||||
|
PORTB = 0;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
if (!(PIND & (1 << PIND2))) {
|
||||||
|
PORTB |= (1 << PORTB5);
|
||||||
|
}
|
||||||
|
if (!(PIND & (1 << PIND3))) {
|
||||||
|
PORTB &= ~(1 << PORTB5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue