|
| 1 | +/* |
| 2 | + * MIT License |
| 3 | + * Copyright (c) 2017 - 2022 _VIFEXTech |
| 4 | + * |
| 5 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 6 | + * of this software and associated documentation files (the "Software"), to deal |
| 7 | + * in the Software without restriction, including without limitation the rights |
| 8 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 9 | + * copies of the Software, and to permit persons to whom the Software is |
| 10 | + * furnished to do so, subject to the following conditions: |
| 11 | + * |
| 12 | + * The above copyright notice and this permission notice shall be included in all |
| 13 | + * copies or substantial portions of the Software. |
| 14 | + * |
| 15 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 18 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 20 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 21 | + * SOFTWARE. |
| 22 | + */ |
| 23 | +#ifndef __MCU_CONFIG_H |
| 24 | +#define __MCU_CONFIG_H |
| 25 | + |
| 26 | +/*========================= |
| 27 | + MCU configuration |
| 28 | + *=========================*/ |
| 29 | + |
| 30 | +/* System tick */ |
| 31 | +#define SYSTICK_TICK_FREQ 1000 // Hz |
| 32 | +#define SYSTICK_PRIORITY 0 |
| 33 | + |
| 34 | +/* Hardware Serial */ |
| 35 | +#define SERIAL_RX_BUFFER_SIZE 128 |
| 36 | +#define SERIAL_PREEMPTIONPRIORITY_DEFAULT 1 |
| 37 | +#define SERIAL_SUBPRIORITY_DEFAULT 3 |
| 38 | +#define SERIAL_CONFIG_DEFAULT SERIAL_8N1 |
| 39 | + |
| 40 | +#define SERIAL_1_ENABLE 1 |
| 41 | +#if SERIAL_1_ENABLE |
| 42 | +# define SERIAL_1_USART USART1 |
| 43 | +# define SERIAL_1_IRQ_HANDLER_DEF() void USART1_IRQHandler(void) |
| 44 | +#endif |
| 45 | + |
| 46 | +#define SERIAL_2_ENABLE 1 |
| 47 | +#if SERIAL_2_ENABLE |
| 48 | +# define SERIAL_2_USART USART2 |
| 49 | +# define SERIAL_2_IRQ_HANDLER_DEF() void USART2_IRQHandler(void) |
| 50 | +#endif |
| 51 | + |
| 52 | +#define SERIAL_3_ENABLE 1 |
| 53 | +#if SERIAL_3_ENABLE |
| 54 | +# define SERIAL_3_USART USART3 |
| 55 | +# define SERIAL_3_IRQ_HANDLER_DEF() void USART3_IRQHandler(void) |
| 56 | +#endif |
| 57 | + |
| 58 | +#define SERIAL_4_ENABLE 0 |
| 59 | +#if SERIAL_4_ENABLE |
| 60 | +# define SERIAL_4_USART UART4 |
| 61 | +# define SERIAL_4_IRQ_HANDLER_DEF() void UART4_IRQHandler(void) |
| 62 | +#endif |
| 63 | + |
| 64 | +#define SERIAL_5_ENABLE 0 |
| 65 | +#if SERIAL_5_ENABLE |
| 66 | +# define SERIAL_5_USART UART5 |
| 67 | +# define SERIAL_5_IRQ_HANDLER_DEF() void UART5_IRQHandler(void) |
| 68 | +#endif |
| 69 | + |
| 70 | +/* Wire (Software I2C) */ |
| 71 | +#define WIRE_USE_FULL_SPEED_I2C 0 |
| 72 | +#define WIRE_SDA_PIN PB7 |
| 73 | +#define WIRE_SCL_PIN PB6 |
| 74 | +#define WIRE_DELAY 0 |
| 75 | +#define WIRE_BEGIN_TIMEOUT 100 // ms |
| 76 | +#define WIRE_BUFF_SIZE 32 |
| 77 | + |
| 78 | +/* SPI Class */ |
| 79 | +#define SPI_CLASS_AVR_COMPATIBILITY_MODE 1 |
| 80 | +#define SPI_CLASS_PIN_DEFINE_ENABLE 1 |
| 81 | + |
| 82 | +#define SPI_CLASS_1_ENABLE 1 |
| 83 | +#if SPI_CLASS_1_ENABLE |
| 84 | +# define SPI_CLASS_1_SPI SPI1 |
| 85 | +#endif |
| 86 | + |
| 87 | +#define SPI_CLASS_2_ENABLE 1 |
| 88 | +#if SPI_CLASS_2_ENABLE |
| 89 | +# define SPI_CLASS_2_SPI SPI2 |
| 90 | +#endif |
| 91 | + |
| 92 | +#define SPI_CLASS_3_ENABLE 1 |
| 93 | +#if SPI_CLASS_3_ENABLE |
| 94 | +# define SPI_CLASS_3_SPI SPI3 |
| 95 | +#endif |
| 96 | + |
| 97 | +/* WString */ |
| 98 | +#define WSTRING_MEM_INCLUDE <stdlib.h> |
| 99 | +#define WSTRING_MEM_REALLOC realloc |
| 100 | +#define WSTRING_MEM_FREE free |
| 101 | + |
| 102 | +/* Print */ |
| 103 | +#define PRINT_PRINTF_BUFFER_LENGTH 128 |
| 104 | + |
| 105 | +/* GPIO */ |
| 106 | +#define GPIO_DRIVE_DEFAULT GPIO_Speed_50MHz |
| 107 | + |
| 108 | +/* External Interrupt */ |
| 109 | +#define EXTI_PREEMPTIONPRIORITY_DEFAULT 2 |
| 110 | +#define EXTI_SUBPRIORITY_DEFAULT 1 |
| 111 | + |
| 112 | +/* Timer Interrupt */ |
| 113 | +#define TIMER_PREEMPTIONPRIORITY_DEFAULT 0 |
| 114 | +#define TIMER_SUBPRIORITY_DEFAULT 3 |
| 115 | + |
| 116 | +/* Tone */ |
| 117 | +#define TONE_TIMER_DEFAULT TIM1 |
| 118 | +#define TONE_PREEMPTIONPRIORITY_DEFAULT 0 |
| 119 | +#define TONE_SUBPRIORITY_DEFAULT 1 |
| 120 | + |
| 121 | +/* PWM */ |
| 122 | +#define PWM_RESOLUTION_DEFAULT 1000 |
| 123 | +#define PWM_FREQUENCY_DEFAULT 10000 |
| 124 | + |
| 125 | +#endif |
0 commit comments