Created
February 26, 2014 21:13
-
-
Save jiriw/9238695 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// blik.h********************************************************************************** | |
#ifndef BLIK_H_INCLUDED | |
#define BLIK_H_INCLUDED | |
#include <stdint.h> | |
extern void blik(void); | |
void morse (uint8_t *i); | |
#endif // BLIK_H_INCLUDED | |
// main.c********************************************************************************** | |
#define F_CPU 16000000 | |
#include <avr/io.h> | |
#include <util/delay.h> | |
#include "blik.h" | |
#include <stdint.h> //pro standartizovane typy | |
#define i 0 | |
int main (void) | |
{ | |
DDRG |= _BV(PG1); //LED9 pro blik | |
DDRG |= _BV(PG0); //LED10 pro SOS | |
uint8_t pole[] = { 1,0,1,0,1,0,0,1,1,1,0,1,1,1,0,1,1,1,0,0,1,0,1,0,1 }; | |
while (1){ | |
morse(pole); | |
//_delay_ms(200); | |
} | |
} | |
//blik.c********************************************************************************** | |
#include "blik.h" | |
#include <avr/io.h> | |
#include <stdio.h> | |
#include <stdint.h> //pro standartizovane typy | |
void morse (uint8_t *i){ | |
if (i) { //roznuti | |
PORTG |= 0b00000010; | |
} | |
else { //zhasnuti | |
PORTG &= 0b11111101; | |
} | |
i++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment