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
TARGET=blink | |
SOURCES=blink.c | |
DEPS= | |
COBJ=$(SOURCES:.c=.o) | |
CC=avr-gcc | |
OBJC=avr-objcopy | |
MCU=atmega328p | |
CFLAGS=-I. -Wall -Os -DF_CPU=16000000UL | |
LDFLAGS= |
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 <avr/io.h> | |
#include <util/delay.h> | |
int main(void) | |
{ | |
DDRB = 0x01; | |
PORTB = 0x00; | |
while (1) { | |
PORTB ^= 0x01; |
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
#ifndef _DUMMY_H_ | |
#define _DUMMY_H_ | |
// prototype | |
void portb_high(); | |
#endif |
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 "dummy.h" | |
#include "avr/io.h" | |
void portb_high() { | |
portb = 0xff; | |
} |
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 "dummy.h" | |
int main(void) { | |
portb_high(); | |
return 0; | |
} |
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 <avr/interrupt.h> | |
#include <avr/io.h> | |
#include <avr/power.h> | |
#define F_CPU 16000000UL | |
static volatile uint32_t duration = 0x00; | |
ISR(TIMER0_COMPA_vect) { |
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
TARGET=delay_tests | |
SOURCES=main.c | |
DEPS= | |
COBJ=$(SOURCES:.c=.o) | |
PCA_PREFIX=../pca | |
CC=avr-gcc | |
OBJC=avr-objcopy |
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
TARGET=beeper | |
SOURCES=beeper.c | |
DEPS= | |
COBJ=$(SOURCES:.c=.o) | |
CC=avr-gcc | |
OBJC=avr-objcopy | |
MCU=atmega328p | |
CFLAGS=-I. -Wall -Os -DF_CPU=16000000UL -std=c99 |
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
// system clock frequency | |
#define F_CPU 16000000UL | |
void timer_freq_prescale(uint32_t a_freq, uint8_t *a_ocr, uint8_t *a_prescaler) { | |
// prescaler table for timer 0 | |
uint8_t prescalers[] = { 0x00, 0x03, 0x06, 0x08, 0x0a, 0x00 }; | |
uint16_t ocr = 0x00; |
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 <stdio.h> | |
#include <stdint.h> | |
// system clock frequency | |
#define F_CPU 16000000UL | |
OlderNewer