pcb and initial code from https://github.com/das-labor/borgware-2d.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
634 B
36 lines
634 B
|
|
#include <avr/io.h>
|
|
#include <util/delay.h>
|
|
|
|
#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
|
|
rfm12_init();
|
|
}
|
|
|