change some io settings for TWR-K22F-120M

Dependents:   twr_helloworld

Committer:
Jasper_lee
Date:
Tue Dec 23 03:35:08 2014 +0000
Revision:
0:b16d94660a33
change some io setting used in TWR-K22F120M

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jasper_lee 0:b16d94660a33 1 /* mbed Microcontroller Library
Jasper_lee 0:b16d94660a33 2 * Copyright (c) 2006-2013 ARM Limited
Jasper_lee 0:b16d94660a33 3 *
Jasper_lee 0:b16d94660a33 4 * Licensed under the Apache License, Version 2.0 (the "License");
Jasper_lee 0:b16d94660a33 5 * you may not use this file except in compliance with the License.
Jasper_lee 0:b16d94660a33 6 * You may obtain a copy of the License at
Jasper_lee 0:b16d94660a33 7 *
Jasper_lee 0:b16d94660a33 8 * http://www.apache.org/licenses/LICENSE-2.0
Jasper_lee 0:b16d94660a33 9 *
Jasper_lee 0:b16d94660a33 10 * Unless required by applicable law or agreed to in writing, software
Jasper_lee 0:b16d94660a33 11 * distributed under the License is distributed on an "AS IS" BASIS,
Jasper_lee 0:b16d94660a33 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Jasper_lee 0:b16d94660a33 13 * See the License for the specific language governing permissions and
Jasper_lee 0:b16d94660a33 14 * limitations under the License.
Jasper_lee 0:b16d94660a33 15 */
Jasper_lee 0:b16d94660a33 16 #ifndef MBED_CAN_API_H
Jasper_lee 0:b16d94660a33 17 #define MBED_CAN_API_H
Jasper_lee 0:b16d94660a33 18
Jasper_lee 0:b16d94660a33 19 #include "device.h"
Jasper_lee 0:b16d94660a33 20
Jasper_lee 0:b16d94660a33 21 #if DEVICE_CAN
Jasper_lee 0:b16d94660a33 22
Jasper_lee 0:b16d94660a33 23 #include "PinNames.h"
Jasper_lee 0:b16d94660a33 24 #include "PeripheralNames.h"
Jasper_lee 0:b16d94660a33 25 #include "can_helper.h"
Jasper_lee 0:b16d94660a33 26
Jasper_lee 0:b16d94660a33 27 #ifdef __cplusplus
Jasper_lee 0:b16d94660a33 28 extern "C" {
Jasper_lee 0:b16d94660a33 29 #endif
Jasper_lee 0:b16d94660a33 30
Jasper_lee 0:b16d94660a33 31 typedef enum {
Jasper_lee 0:b16d94660a33 32 IRQ_RX,
Jasper_lee 0:b16d94660a33 33 IRQ_TX,
Jasper_lee 0:b16d94660a33 34 IRQ_ERROR,
Jasper_lee 0:b16d94660a33 35 IRQ_OVERRUN,
Jasper_lee 0:b16d94660a33 36 IRQ_WAKEUP,
Jasper_lee 0:b16d94660a33 37 IRQ_PASSIVE,
Jasper_lee 0:b16d94660a33 38 IRQ_ARB,
Jasper_lee 0:b16d94660a33 39 IRQ_BUS,
Jasper_lee 0:b16d94660a33 40 IRQ_READY
Jasper_lee 0:b16d94660a33 41 } CanIrqType;
Jasper_lee 0:b16d94660a33 42
Jasper_lee 0:b16d94660a33 43
Jasper_lee 0:b16d94660a33 44 typedef enum {
Jasper_lee 0:b16d94660a33 45 MODE_RESET,
Jasper_lee 0:b16d94660a33 46 MODE_NORMAL,
Jasper_lee 0:b16d94660a33 47 MODE_SILENT,
Jasper_lee 0:b16d94660a33 48 MODE_TEST_GLOBAL,
Jasper_lee 0:b16d94660a33 49 MODE_TEST_LOCAL,
Jasper_lee 0:b16d94660a33 50 MODE_TEST_SILENT
Jasper_lee 0:b16d94660a33 51 } CanMode;
Jasper_lee 0:b16d94660a33 52
Jasper_lee 0:b16d94660a33 53 typedef void (*can_irq_handler)(uint32_t id, CanIrqType type);
Jasper_lee 0:b16d94660a33 54
Jasper_lee 0:b16d94660a33 55 typedef struct can_s can_t;
Jasper_lee 0:b16d94660a33 56
Jasper_lee 0:b16d94660a33 57 void can_init (can_t *obj, PinName rd, PinName td);
Jasper_lee 0:b16d94660a33 58 void can_free (can_t *obj);
Jasper_lee 0:b16d94660a33 59 int can_frequency(can_t *obj, int hz);
Jasper_lee 0:b16d94660a33 60
Jasper_lee 0:b16d94660a33 61 void can_irq_init (can_t *obj, can_irq_handler handler, uint32_t id);
Jasper_lee 0:b16d94660a33 62 void can_irq_free (can_t *obj);
Jasper_lee 0:b16d94660a33 63 void can_irq_set (can_t *obj, CanIrqType irq, uint32_t enable);
Jasper_lee 0:b16d94660a33 64
Jasper_lee 0:b16d94660a33 65 int can_write (can_t *obj, CAN_Message, int cc);
Jasper_lee 0:b16d94660a33 66 int can_read (can_t *obj, CAN_Message *msg, int handle);
Jasper_lee 0:b16d94660a33 67 int can_mode (can_t *obj, CanMode mode);
Jasper_lee 0:b16d94660a33 68 int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t handle);
Jasper_lee 0:b16d94660a33 69 void can_reset (can_t *obj);
Jasper_lee 0:b16d94660a33 70 unsigned char can_rderror (can_t *obj);
Jasper_lee 0:b16d94660a33 71 unsigned char can_tderror (can_t *obj);
Jasper_lee 0:b16d94660a33 72 void can_monitor (can_t *obj, int silent);
Jasper_lee 0:b16d94660a33 73
Jasper_lee 0:b16d94660a33 74 #ifdef __cplusplus
Jasper_lee 0:b16d94660a33 75 };
Jasper_lee 0:b16d94660a33 76 #endif
Jasper_lee 0:b16d94660a33 77
Jasper_lee 0:b16d94660a33 78 #endif // MBED_CAN_API_H
Jasper_lee 0:b16d94660a33 79
Jasper_lee 0:b16d94660a33 80 #endif