-
Notifications
You must be signed in to change notification settings - Fork 12
/
hardware_config.h
101 lines (77 loc) · 3.88 KB
/
hardware_config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
__ __| | | /_) | ___| | |
| __ \ _ \ ' / | | / | _ \ __ \ | _` | __ \ __|
| | | | __/ . \ | < | | __/ | | | ( | | |\__ \
_| _| |_|\___| _|\_\_|_|\_\\____|\___|_| _| _____|\__,_|_.__/ ____/
-----------------------------------------------------------------------------
USBMIDIKLIK 4X4 - USB Midi advanced firmware for STM32F1 platform.
Copyright (C) 2019 by The KikGen labs.
LICENCE CREATIVE COMMONS - Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
This file is part of the USBMIDIKLIK-4x4 distribution
https://github.com/TheKikGen/USBMidiKliK4x4
Copyright (c) 2019 TheKikGen Labs team.
-----------------------------------------------------------------------------
Disclaimer.
This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/
or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
NON COMMERCIAL - PERSONAL USE ONLY : You may not use the material for pure
commercial closed code solution without the licensor permission.
You are free to copy and redistribute the material in any medium or format,
adapt, transform, and build upon the material.
You must give appropriate credit, a link to the github site
https://github.com/TheKikGen/USBMidiKliK4x4 , provide a link to the license,
and indicate if changes were made. You may do so in any reasonable manner,
but not in any way that suggests the licensor endorses you or your use.
You may not apply legal terms or technological measures that legally restrict
others from doing anything the license permits.
You do not have to comply with the license for elements of the material
in the public domain or where your use is permitted by an applicable exception
or limitation.
No warranties are given. The license may not give you all of the permissions
necessary for your intended use. 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.
*/
#ifndef _HARDWARE_CONFIG_H_
#define _HARDWARE_CONFIG_H_
#pragma once
// Macros to expand preprocessor variables
#define __VALUE_TO_STRING(x) #x
#define __VALUE(x) __VALUE_TO_STRING(x)
#define __VAR_NAME_VALUE(var) #var " = " __VALUE(var)
// BCD Version
#define VERSION_MAJOR 2
#define VERSION_MINOR 5
#define BCD_VERSION ( VERSION_MAJOR << 8 ) + (VERSION_MINOR << 4)
// About STM32F103xx microcontrollers :
// Low-density devices have a flash memory between 16 and 32 Kbytes.
// Medium-density devices have a flash memory between 32 and 128 Kbytes.
// High-density devices have a a flash memory between 256 and 512 Kbytes.
// Low and medium-density devices use a 1K bytes page size.
// High-density density devices use a 2K bytes page size.
// Flash memory base address (cf STM32F103xx datasheet page 34)
#define EE_FLASH_MEMORY_BASE 0x08000000
#ifdef MCU_STM32F103RB
// Set EEPROM parameters for the STMF103RB (medium density)
#define EE_PAGE_SIZE 0x400
#define EE_FLASH_SIZEK 128
#define EE_NBPAGE 1
#define EE_CAPACITY EE_NBPAGE*EE_PAGE_SIZE
// This drives the DISC pin for USB connect
#define HAS_DISC_ON_PIN PA8
#define SERIAL_INTERFACE_MAX 1
#define SERIALS_PLIST &Serial1
#define HARDWARE_TYPE "MIDIPLUS SMARTPAD"
#define LED_CONNECT PC9
#else
#error "PLEASE CHOOSE STM32F103RB variant to compile ."
#endif
#pragma message(__VAR_NAME_VALUE(HARDWARE_TYPE))
// Reserve the last pages for the EEPROM emulation
#define EE_BASE EE_FLASH_MEMORY_BASE + EE_FLASH_SIZEK * 1024 - EE_CAPACITY
#define EE_PAGE_BASE ( EE_BASE - EE_FLASH_MEMORY_BASE ) / EE_PAGE_SIZE
#define USBCABLE_INTERFACE_MAX USB_MIDI_IO_PORT_NUM
// USBDM (USB -) PIN
#define PIN_USBDM PA11
#endif