
A Anhang
1 /* * * ** * *** *** *** *** *** * ** * ** * *** *** ***
2 copyright ( c) 2007 Axel Wachtler
3 modfied by Mirco Kern , FH Du e sseldorf
4 * ** * *** *** *** *** *** *** * ** * ** * ** * *** ** */
5
6
7 /* exampl e : tr a nsmitti n g frames */
8 /* * * *** *** * *** *** *** * *** *** *** * * */
9
10 /* includ e header files */
11 # inclu de " board .h"
12 # inclu de " tra n sceiver .h "
13 # inclu de " ioutil . h"
14 # inclu de " xmpl .h"
15 # inclu de < util / delay .h>
16
17
18 /* variable indicating tx state */
19 static volatile bool tx _ in_pr o gress ;
20
21 /* variable indicating button state */
22 static volatile bool bu t ton_p r essed ;
23
24
25 int main ( void )
26 {
27 /* define PE5 as input */
28 PORTE |= _BV ( PE5 );
29 /* setup pull ups */
30 MCUCR = 0 x00 ;
31 /* c o nfigure interr u p t registers */
32 EIMSK |= _BV ( INT5 );
33
34 /* ieee 8 0 2 . 1 5 . 4 frame */
35 uint8_t txfrm [] =
36 {1 ,0 , /* faked ieee 80 2 . 1 5 . 4 data frame control field */
37 01 , /* se q u e nce counter */
38 ’1 ’, ’2’ ,’8 ’ , ’R ’, ’F ’ ,’A ’ ,’1 ’, ’: ’,’ ’ ,’H ’ , ’e ’, ’l ’ ,’l ’ ,’o ’,
39 ’X ’, ’X’ /* crc bytes ( overwri t ten by transceiv e r */
40 };
41
42 /* i nitialize leds ( red switched on ) */
43 LED_INIT ();
44
45 /* i nitialize the t r ansceiver */
46 DELAY_US ( TR X_INI T _TIM E _US );
47 TRX _ RESET_ L OW ();
48 TRX _ SLPTR_ L OW ();
42
Kommentare zu diesen Handbüchern