Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
can.c
Go to the documentation of this file.
1 /*
2  * $Id:$
3  *
4  * Copyright (C) 2010 Piotr Esden-Tempski <piotr@esden.net>
5  *
6  * This file is part of paparazzi.
7  *
8  * paparazzi is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * paparazzi is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with paparazzi; see the file COPYING. If not, write to
20  * the Free Software Foundation, 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  *
23  */
24 
25 #include <stdint.h>
26 
27 #include "mcu_periph/can.h"
28 #include "mcu_periph/can_arch.h"
29 
31 
32 void _can_run_rx_callback(uint32_t id, uint8_t *buf, uint8_t len);
33 
35 {
36  can_rx_callback = callback;
37  can_hw_init();
38 }
39 
40 int can_transmit(uint32_t id, const uint8_t *buf, uint8_t len)
41 {
42  return can_hw_transmit(id, buf, len);
43 }
44 
46 {
47  if(can_rx_callback)
48  can_rx_callback(id, buf, len);
49 }
void(* can_rx_callback_t)(uint32_t id, uint8_t *buf, int len)
Definition: can.h:28
int can_transmit(uint32_t id, const uint8_t *buf, uint8_t len)
Definition: can.c:40
unsigned long uint32_t
Definition: types.h:18
int can_hw_transmit(uint32_t id, const uint8_t *buf, uint8_t len)
Definition: can_arch.c:126
unsigned char uint8_t
Definition: types.h:14
void _can_run_rx_callback(uint32_t id, uint8_t *buf, uint8_t len)
Definition: can.c:45
void can_hw_init(void)
Definition: can_arch.c:49
can_rx_callback_t can_rx_callback
Definition: can.c:30
void can_init(can_rx_callback_t callback)
Definition: can.c:34