Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

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