CARME-M4 BSP  V1.5
can.c File Reference

Drivers for the CAN interface. Uses the SJA1000 CAN controller on the CARME motherboard. More...

#include <string.h>
#include <stdio.h>
#include <stm32f4xx.h>
#include <carme.h>
#include <can_sja1000.h>
#include <can.h>
+ Include dependency graph for can.c:

Go to the source code of this file.

Functions

static void CARME_CAN_InitSTM (void)
 Initialize the stm32f4xx GPIOs and the nCAN_INT.
The CAN interrupt is on CARME_CAN_nCAN_IRQn_CH with NVIC_IRQChannelPreemptionPriority = 0x0F and NVIC_IRQChannelSubPriority = 0x0F. More...
 
static void CARME_CAN_SetBusTiming (uint8_t btr0, uint8_t btr1)
 Set the Bus-Timing-Registers of the SJA1000 directly. More...
 
void CARME_CAN_Init (uint32_t baud, uint8_t flags)
 Initialize GPIOs and the CAN-Controller. More...
 
void CARME_CAN_InitI (uint32_t baud, uint8_t flags, uint32_t interrupts)
 Initialize GPIOs and the CAN-Controller. More...
 
void CARME_CAN_RegisterIRQCallback (enum CARME_CAN_IRQ_CALLBACKS id, IRQ_CALLBACK pIRQCallback)
 Registers a callback function. Callback functions are called in Interruptmode. Use this function after CARME_CAN_init() or CARME_CAN_initI(). More...
 
void CARME_CAN_UnregisterIRQCallback (enum CARME_CAN_IRQ_CALLBACKS id)
 Unregisters a callback function. Callback functions are called in Interruptmode. More...
 
ERROR_CODES CARME_CAN_SetMode (uint8_t flags)
 Change operating mode from the CAN-Controller. More...
 
ERROR_CODES CARME_CAN_Read (CARME_CAN_MESSAGE *rxMsg)
 Reads a CAN-Message from the Receive-Buffer. If no message is in the buffer, the function returns CARME_ERROR_CAN_ERROR_RXFIFO_EMPTY. More...
 
void CARME_CAN_Interrupt_Handler (void)
 This function will be called from the Interrupt-Handler on a CAN-Interrupt.
If it was not the EXTI Line from the CAN controller, then the functions MyEXTI9_5_IRQHandler is called. More...
 
ERROR_CODES CARME_CAN_SetBaudrate (uint32_t baud)
 Set the baudrate for the CAN-Communication. More...
 
ERROR_CODES CARME_CAN_Write (CARME_CAN_MESSAGE *txMsg)
 Sends a CAN-Messsage over the CAN-Bus. More...
 
ERROR_CODES CARME_CAN_SetAcceptaceFilter (CARME_CAN_ACCEPTANCE_FILTER *af)
 ACCEPTANCE FILTER
With the help of the acceptance filter the CAN controller is able to allow passing of received messages to the RXFIFO only when the identifier bits of the received message are equal to the predefined ones within the acceptance filter registers.
The acceptance filter is defined by the Acceptance Code Registers (ACRn) and the Acceptance Mask Registers (AMRn). The bit patterns of messages to be received are defined within the acceptance code registers. The corresponding acceptance mask registers allow to define certain bit positions to be 'don't care'. Two different filter modes are selectable within the mode register: More...
 
ERROR_CODES CARME_CAN_GetAcceptaceFilter (CARME_CAN_ACCEPTANCE_FILTER *af)
 Get the Acceptance Filter settings. More...
 

Variables

static IRQ_CALLBACK CARME_CAN_IRQCallbacks [CARME_CAN_IRQID_COUNT]
 

Detailed Description

Drivers for the CAN interface. Uses the SJA1000 CAN controller on the CARME motherboard.

Version
1.0
Date
2007-04-13
Author
M. Muehlemann

This software can be used by students and other personal of the Bern University of Applied Sciences under the terms of the MIT license. For other persons this software is under the terms of the GNU General Public License version 2.

Copyright © 2013, Bern University of Applied Sciences. All rights reserved.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

GNU GENERAL PUBLIC LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Definition in file can.c.