RybaSG

odbiornik

Jul 5th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.03 KB | None | 0 0
  1. /*                  e-gadget.header
  2.  * main.c
  3.  *
  4.  *  Created on: 2015-04-07
  5.  *    Modyfied: 2015-04-07 19:45:16
  6.  *      Author: Nefarious19
  7.  *
  8.  * Project name: "NRF24"
  9.  *
  10.  *
  11.  *          MCU: ATmega32
  12.  *        F_CPU: 16 000 000 Hz
  13.  *
  14.  *    Flash: 2 992 bytes   [ 9,1 % ]
  15.  *      RAM:  189 bytes   [ 9,2 % ]
  16.  *   EEPROM:  0 bytes   [ 0,0 % ]
  17.  *
  18.  */
  19.  
  20.  
  21. #include <avr/io.h>
  22. #include <util/delay.h>
  23. #include <avr/interrupt.h>
  24. #include <stdlib.h>
  25. #include <string.h>
  26. #include <avr/pgmspace.h>
  27.  
  28. //
  29. #include "UART/Uart.h"
  30. #include "nRF24L01.h"
  31.  
  32.  
  33. void moja_funkcja ( void * nRF_RX_buff , uint8_t len );
  34. volatile uint16_t timer100ms;
  35.  
  36. int main (void)
  37. {
  38.     //inicjalizacja uarta
  39.     USART_Init(_UBRR);
  40.  
  41.     //inicjalizacja nRFa
  42.     nRF_init();
  43.     register_nRF_RX_Event_Callback(moja_funkcja);
  44.  
  45.     //zezwolenie na przerwania
  46.     sei();
  47.  
  48.     nRF_RX_Power_Up(); //odpalamy nRFA!
  49.     while(1)
  50.     {
  51.         nRF_RX_EVENT();
  52.     }
  53. }
  54.  
  55.  
  56. void moja_funkcja ( void * nRF_RX_buff, uint8_t len )
  57. {
  58.     USART_Transmit_string(nRF_RX_buff);
  59. }
Add Comment
Please, Sign In to add comment