hi
i want to use this library with se8r01 but it not working can some one help me modifying it to work with this module
i use platformio
#include <avr/io.h>
#include <util/delay.h>
#include <inttypes.h>
//#include <avr/interrupt.h>
#include "psx.h"
#include "nrf24.h"
//#include "uart.h"
#include <avr/pgmspace.h>
//#define F_CPU 8000000L
#define NRF24_IO_PORT PORTB
#define NRF24_IO_PINREG PINB
#define NRF24_IO_DDR DDRB
#define LED DDRD
// ATTINY2313A nrf24
// ________ _________
// | PB3 |----| CSN |
// | PB4 |----| CE |
// | PB5 |----| MOSI |
// | PB6 |----| MISO |
// | PB7 |----| SCK |
// | | |_________|
// | |
// | | PSX
// | | _________
// | PD2 |----| SCK |
// | PD3 |----| CS |
// | PD4 |----| DO |
// | PD5 |----| DI |
// |________| |_________|
uint8_t data_array[2];
uint8_t tx_address[5] = {0xE7, 0xE7, 0xE7, 0xE7, 0xE7};
uint8_t rx_address[5] = {0xD7, 0xD7, 0xD7, 0xD7, 0xD7};
int main() {
initUART();
PORTD |=(1<<6);
nrf24_init();
nrf24_config(2, 2); // channel 2, packet size 2
nrf24_tx_address(tx_address);
nrf24_rx_address(rx_address);
psx_init(false);
while (1) {
psx_read_gamepad(); // gamepad reading
data_array[0] = 0xFE; // test value
// up - left chassis forward
// down - left chassis back
// triangle - right landing gear forward
// cross - right landing gear back
data_array[1] = (psx_button(PSB_PAD_UP) << 1) | (psx_button(PSB_PAD_DOWN) << 2)
| (psx_button(PSB_TRIANGLE) << 3) | (psx_button(PSB_CROSS) << 4)
| (psx_stick(PSS_LX)<< 5 ) | (psx_stick(PSS_LY) << 6)
| (psx_stick(PSS_RX)<< 7 ) | (psx_stick(PSS_RY) << 8); // push buttons
nrf24_send(data_array); // send data
while (!nrf24_isSending());
_delay_ms(20);
//UDR=(psx_button(PSB_PAD_DOWN));
sendByte(data_array[1]);
}
}