mbed library sources, include can_api for nucleo-f091rc

Dependents:   CanNucleoF0_example

Fork of mbed-src by mbed official

Committer:
ptpaterson
Date:
Thu Jan 07 05:49:05 2016 +0000
Revision:
645:13c87cbecd54
Parent:
337:6ed01c00b962
corrected freeze on CAN_RECEIVE_IT

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 337:6ed01c00b962 1 /* mbed Microcontroller Library
mbed_official 337:6ed01c00b962 2 * Copyright (c) 2006-2013 ARM Limited
mbed_official 337:6ed01c00b962 3 *
mbed_official 337:6ed01c00b962 4 * Licensed under the Apache License, Version 2.0 (the "License");
mbed_official 337:6ed01c00b962 5 * you may not use this file except in compliance with the License.
mbed_official 337:6ed01c00b962 6 * You may obtain a copy of the License at
mbed_official 337:6ed01c00b962 7 *
mbed_official 337:6ed01c00b962 8 * http://www.apache.org/licenses/LICENSE-2.0
mbed_official 337:6ed01c00b962 9 *
mbed_official 337:6ed01c00b962 10 * Unless required by applicable law or agreed to in writing, software
mbed_official 337:6ed01c00b962 11 * distributed under the License is distributed on an "AS IS" BASIS,
mbed_official 337:6ed01c00b962 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
mbed_official 337:6ed01c00b962 13 * See the License for the specific language governing permissions and
mbed_official 337:6ed01c00b962 14 * limitations under the License.
mbed_official 337:6ed01c00b962 15 */
mbed_official 337:6ed01c00b962 16 #include "mbed_assert.h"
mbed_official 337:6ed01c00b962 17 #include "pinmap.h"
mbed_official 337:6ed01c00b962 18 #include "mbed_error.h"
mbed_official 337:6ed01c00b962 19
mbed_official 337:6ed01c00b962 20
mbed_official 337:6ed01c00b962 21 void pin_function(PinName pin, int function)
mbed_official 337:6ed01c00b962 22 {
mbed_official 337:6ed01c00b962 23 // do nothing
mbed_official 337:6ed01c00b962 24 return;
mbed_official 337:6ed01c00b962 25 }
mbed_official 337:6ed01c00b962 26
mbed_official 337:6ed01c00b962 27 void pin_mode(PinName pin, PinMode mode)
mbed_official 337:6ed01c00b962 28 {
mbed_official 337:6ed01c00b962 29 MBED_ASSERT(pin != (PinName)NC);
mbed_official 337:6ed01c00b962 30
mbed_official 337:6ed01c00b962 31 if ((pin == P0_10) || (pin == P0_11)) {
mbed_official 337:6ed01c00b962 32 // True open-drain pins can be configured for different I2C-bus speeds
mbed_official 337:6ed01c00b962 33 return;
mbed_official 337:6ed01c00b962 34 }
mbed_official 337:6ed01c00b962 35
mbed_official 337:6ed01c00b962 36 __IO uint32_t *reg = (uint32_t *)(LPC_IOCON_BASE + (pin & 0xFF));
mbed_official 337:6ed01c00b962 37
mbed_official 337:6ed01c00b962 38 if (mode == OpenDrain) {
mbed_official 337:6ed01c00b962 39 *reg |= (1 << 10);
mbed_official 337:6ed01c00b962 40 } else {
mbed_official 337:6ed01c00b962 41 uint32_t tmp = *reg;
mbed_official 337:6ed01c00b962 42 tmp &= ~(0x3 << 3);
mbed_official 337:6ed01c00b962 43 tmp |= (mode & 0x3) << 3;
mbed_official 337:6ed01c00b962 44 *reg = tmp;
mbed_official 337:6ed01c00b962 45 }
mbed_official 337:6ed01c00b962 46 }