Skip to content

Instantly share code, notes, and snippets.

@jiriw
Created February 26, 2014 21:13
Show Gist options
  • Save jiriw/9238695 to your computer and use it in GitHub Desktop.
Save jiriw/9238695 to your computer and use it in GitHub Desktop.
// 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