borgware-2d/src/rfm12/borg_rfm12.c

37 lines
634 B
C
Raw Normal View History

2012-03-01 23:20:05 +00:00
#include <avr/io.h>
#include <util/delay.h>
2012-03-01 23:20:05 +00:00
#include "rfm12.h"
volatile uint8_t rfm12_joystick_val;
void borg_rfm12_tick(){
if (rfm12_rx_status() == STATUS_COMPLETE)
{
//uart_putstr ("new packet:\r\n");
uint8_t * bufp = rfm12_rx_buffer();
// dump buffer contents to uart
if(rfm12_rx_len() >= 1){
//-> F2 F1 RT LF DN UP
rfm12_joystick_val = *bufp;
}
// tell the implementation that the buffer
// can be reused for the next data.
rfm12_rx_clear();
}
rfm12_tick();
}
void borg_rfm12_init(){
_delay_ms(200);//the rfm12 seems to need this
2012-03-01 23:20:05 +00:00
rfm12_init();
}