Changeset f51aacc in avrstuff


Ignore:
Timestamp:
Jul 29, 2014, 7:58:35 PM (10 years ago)
Author:
Adrien Destugues <pulkomandy@…>
Branches:
main
Children:
0db7c37
Parents:
b83dc2a
Message:

Convert muserial test to common.mk.

git-svn-id: svn://pulkomandy.tk/avrstuff@104 c6672c3c-f6b6-47f9-9001-1fd6b12fecbe

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kbd/common.mk

    rb83dc2a rf51aacc  
    77LIBS=../../../libs
    88
    9 # Generic pattern-rules
     9# Generic rules
    1010%.hex: %.bin
    1111        $(OBJCOPY) -j .text -j .data -O ihex $^ $@
    1212
     13clean:
     14        rm *.bin *.o *.hex
  • test_2313_muserial/Makefile

    rb83dc2a rf51aacc  
    1 #Set vars
     1# K4KUSB
     2F_CPU=12000000
     3
     4# muSerial
     5# F_CPU=20000000
     6
     7# Common
    28MCU=attiny2313
    3 COMPILE = avr-gcc -Wall -Os -std=c99 -mmcu=$(MCU) -DF_CPU=20000000
     9
     10all: blinkdel.hex
     11
     12include ../kbd/common.mk
     13
     14COMPILE = $(CC) -Wall -Os -std=c99 -mmcu=$(MCU) -DF_CPU=$(F_CPU)
    415
    516#Rules
    6 blinkdel.hex: blinkdel.bin
    7         avr-objcopy -j .text -j .data -O ihex blinkdel.bin blinkdel.hex
    817
    918blinkdel.bin: main.o
     
    2332        avrdude -c usbasp -p $(MCU) -Uflash:w:blinkdel.hex
    2433
    25 clean:
    26         rm *.bin *.o *.hex
  • test_2313_muserial/main.c

    rb83dc2a rf51aacc  
    88#include <stdbool.h>
    99
     10// muSerial: ATTiny2313 - LED = PD6
     11// K4KUSB: ATTiny2313 - LED = PB2
     12#define DDRLED DDRB
     13#define PORTLED PORTB
     14#define LEDBIT 1 << PB2
     15
    1016int main() {
    1117        wdt_enable(WDTO_2S);
     
    1521
    1622        //debug LED - output
    17         DDRD |= 255;
     23        DDRLED |= 255;
    1824
    19         PORTD = 0;
     25        PORTLED = 0;
    2026
    2127        // Serial PORT
     
    2430
    2531        UCSRB = (1<<RXEN) |(1<<TXEN);
    26         UCSRC = (1 << UCSZ1) | (1 << UCSZ0); 
     32        UCSRC = (1 << UCSZ1) | (1 << UCSZ0);
    2733
    2834        while(1) {
     
    3339                if (TIFR & (1 << TOV0)) {
    3440                        TIFR = (1 << TOV0); // reset flag
    35                         PORTD ^= (1<<PD6);
     41                        PORTLED ^= LEDBIT;
    3642
    3743                        UDR = 'H';
Note: See TracChangeset for help on using the changeset viewer.