Changeset 6d8c366 in avrstuff


Ignore:
Timestamp:
Jul 29, 2014, 10:37:32 PM (10 years ago)
Author:
Adrien Destugues <pulkomandy@…>
Branches:
main
Children:
d31c2f5
Parents:
cd3a9ac
Message:

Chiptest: use libusart.

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

Location:
chiptest
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • chiptest/Makefile

    rcd3a9ac r6d8c366  
    77# Common
    88MCU=attiny2313
     9BAUD=9600
    910
    1011all: blinkdel.hex
     
    1213include ../kbd/common.mk
    1314
    14 COMPILE = $(CC) -Wall -Os -std=c99 -mmcu=$(MCU) -DF_CPU=$(F_CPU)
     15COMPILE = $(CC) -Wall -Os -std=c99 -mmcu=$(MCU) -DF_CPU=$(F_CPU) -DBAUD=$(BAUD) \
     16        -I../libs/usart/
     17
     18VPATH=../libs/usart/
    1519
    1620#Rules
    1721
    18 blinkdel.bin: main.o
    19         $(COMPILE) main.o -o blinkdel.bin
     22blinkdel.bin: main.o usart.o
     23        $(COMPILE) $^ -o $@
    2024
    2125main.o: main.c
    22         $(COMPILE) -c main.c -o main.o
     26        $(COMPILE) -c $^ -o $@
    2327
    2428#Generic rules
  • chiptest/blinkdel.hex

    rcd3a9ac r6d8c366  
    11:1000000012C017C016C015C014C013C012C011C052
    22:1000100010C00FC00EC00DC00CC00BC00AC009C07C
    3 :1000200008C007C006C011241FBECFEDCDBF02D04F
    4 :100030002AC0E6CF2FE088E190E00FB6F894A895AB
    5 :1000400081BD0FBE21BD10BE84E083BF87B38FEF9B
    6 :1000500087BB18BA12B88DE489B9599888E18AB972
    7 :1000600086E083B990E042E034E028E4A89508B641
    8 :1000700001FE02C048BF9F5F9111F8CF88B383276C
    9 :0A00800088BB2CB9F3CFF894FFCF32
     3:1000200008C007C006C011241FBECFEDCDBF28D029
     4:1000300046C0E6CF12B88DE489B9599886E083B9F5
     5:1000400088E18AB908955D9BFECF8CB908955F9BC6
     6:10005000FECF8CB10895CF93C82F982F92959F70A3
     7:100060009A3010F480E301C087E3890FECDF8C2F16
     8:100070008F708A3010F4805D01C0895CCF91E3CF2E
     9:100080002FE088E190E00FB6F894A89581BD0FBEEF
     10:1000900021BD10BE84E083BFBA9AC298CBDFC0E016
     11:1000A00012E0D4E0A89508B601FEFCCF18BFCF5FE0
     12:1000B000C9F788B38D2788BB88E4C5DFF3CFF894F0
     13:0200C000FFCF70
    1014:00000001FF
  • chiptest/main.c

    rcd3a9ac r6d8c366  
     1#include <usart.h>
     2
    13#include <avr/io.h>
    24#include <avr/interrupt.h>
     
    1214#define DDRLED DDRB
    1315#define PORTLED PORTB
    14 #define LEDBIT 1 << PB2
     16#define LEDBIT (1 << PB2)
    1517
    1618#define BAUD 9600 // Safe value even for low clocks. (used by setbaud.h)
     
    2325
    2426        //debug LED - output
    25         DDRLED |= 255;
     27        DDRLED |= LEDBIT;
     28        PORTLED &= ~LEDBIT;
    2629
    27         PORTLED = 0;
    28 
    29         // Serial baudrate - use avrlibc magic to compute the baudrate register
    30         // values.
    31         #include <util/setbaud.h>
    32         UBRRH = UBRRH_VALUE;
    33         UBRRL = UBRRL_VALUE;
    34         #if USE_2X
    35                 UCSRA |= (1 << U2X);
    36         #else
    37                 UCSRA &= ~(1 << U2X);
    38         #endif
    39 
    40         // Enable the serial port.
    41         UCSRB = (1<<RXEN) |(1<<TXEN);
    42         UCSRC = (1 << UCSZ1) | (1 << UCSZ0);
     30        USARTInit();
    4331
    4432        // Let's rock!
     
    5543                        {
    5644                                PORTLED ^= LEDBIT; // Toggle the LED
    57                                 UDR = 'H'; // Send a byte to the UART
     45                                USARTWriteChar('H'); // Send a byte to the UART
    5846                        }
    5947                }
Note: See TracChangeset for help on using the changeset viewer.