Subversion Repositories chibiosIgnition

Rev

Rev 7 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7 mjames 1
/*
2
    ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
3
                 2011,2012 Giovanni Di Sirio.
4
 
5
    This file is part of ChibiOS/RT.
6
 
7
    ChibiOS/RT is free software; you can redistribute it and/or modify
8
    it under the terms of the GNU General Public License as published by
9
    the Free Software Foundation; either version 3 of the License, or
10
    (at your option) any later version.
11
 
12
    ChibiOS/RT is distributed in the hope that it will be useful,
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
    GNU General Public License for more details.
16
 
17
    You should have received a copy of the GNU General Public License
18
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 
20
                                      ---
21
 
22
    A special exception to the GPL can be applied should you wish to distribute
23
    a combined work that includes ChibiOS/RT, without being obliged to provide
24
    the source code for any proprietary components. See the file exception.txt
25
    for full details of how and when the exception can be applied.
26
*/
27
 
28
#ifndef _BOARD_H_
29
#define _BOARD_H_
30
 
31
/*
32
 * Setup for the bluePill STM32F103 proto board.
33
 */
34
 
35
/*
36
 * Board identifier.
37
 */
38
#define BOARD_ST_BLUE_PILL_F103
39
#define BOARD_NAME              "Blue Pill STM32F103"
40
 
41
/*
42
 * Board frequencies.
43
 */
44
#define STM32_LSECLK            32768
45
#define STM32_HSECLK            8000000
46
 
47
/*
48
 * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
49
 */
50
#define STM32F103xB
51
 
52
/*
53
 * IO pins assignments.
54
 */
55
 
56
 #define GPIOC_LED               13
57
 
58
#define GPIOA_STROBE            0
59
#define GPIOA_COIL              6
60
 
61
 
62
/*
63
 * I/O ports initial setup, this configuration is established soon after reset
64
 * in the initialization code.
65
 *
66
 * The digits have the following meaning:
67
 *   0 - Analog input.
68
 *   1 - Push Pull output 10MHz.
69
 *   2 - Push Pull output 2MHz.
70
 *   3 - Push Pull output 50MHz.
71
 *   4 - Digital input.
72
 *   5 - Open Drain output 10MHz.
73
 *   6 - Open Drain output 2MHz.
74
 *   7 - Open Drain output 50MHz.
75
 *   8 - Digital input with PullUp or PullDown resistor depending on ODR.
76
 *   9 - Alternate Push Pull output 10MHz.
77
 *   A - Alternate Push Pull output 2MHz.
78
 *   B - Alternate Push Pull output 50MHz.
79
 *   C - Reserved.
80
 *   D - Alternate Open Drain output 10MHz.
81
 *   E - Alternate Open Drain output 2MHz.
82
 *   F - Alternate Open Drain output 50MHz.
83
 * Please refer to the STM32 Reference Manual for details.
84
 */
85
 
86
/*
87
 * Port A setup.
88
 * Everything input with pull-up except:
89
 * PA0  - Alternate open drain output  Timer 2 Channel 1    (STROBE).
90
 * PA1  - Digital Input Timer 2 Channel 2
91
 * PA2  - ADC channel 2
92
 * PA3  - ADC channel 3
93
 * PA8 - Timer 1 output 1
94
 *
95
 */
96
#define VAL_GPIOACRL            0x8488008B   /*  PA7...PA0 */
97
#define VAL_GPIOACRH            0x8888888B   /* PA15...PA8 */
98
#define VAL_GPIOAODR            0xFFFFFFFF
99
 
100
/*
101
 * Port B setup.
102
 * Everything input with pull-up except:
103
 * PB5 - SPI1 MOSI  2MHz
104
 * PB3- SPI1 SCK1  2MHz
105
 * PB6  Display CS
106
 * PB7  Display CD
107
 * PB8  Display Reset
9 mjames 108
 *
109
 * PB10 alternative OD
110
 * PB11 alternative OD
7 mjames 111
  */
112
#define VAL_GPIOBCRL            0x11989888      /*  PB7...PB0 */
9 mjames 113
#define VAL_GPIOBCRH            0x8888FF81     /* PB15...PB8 */
7 mjames 114
#define VAL_GPIOBODR            0xFFFFFFFF
115
 
116
/*
117
 * Port C setup.
118
 * Everything input with pull-up except:
119
 
120
 * PC13 - Push Pull output (LED).
121
 */
122
#define VAL_GPIOCCRL            0x88888888      /*  PC7...PC0 */
123
#define VAL_GPIOCCRH            0x88388888      /* PC15...PC8 */
124
#define VAL_GPIOCODR            0xFFFFFFFF
125
 
126
/*
127
 * Port D setup.
128
 * Everything input with pull-up except:
129
 * PD0  - Normal input (XTAL).
130
 * PD1  - Normal input (XTAL).
131
 */
132
#define VAL_GPIODCRL            0x88888844      /*  PD7...PD0 */
133
#define VAL_GPIODCRH            0x88888888      /* PD15...PD8 */
134
#define VAL_GPIODODR            0xFFFFFFFF
135
 
136
/*
137
 * Port E setup.
138
 * Everything input with pull-up except:
139
 */
140
#define VAL_GPIOECRL            0x88888888      /*  PE7...PE0 */
141
#define VAL_GPIOECRH            0x88888888      /* PE15...PE8 */
142
#define VAL_GPIOEODR            0xFFFFFFFF
143
 
144
 
145
/*
146
 * USB bus activation macro, required by the USB driver.
147
 */
148
#define usb_lld_connect_bus(usbp) {}
149
 
150
/*
151
 * USB bus de-activation macro, required by the USB driver.
152
 */
153
#define usb_lld_disconnect_bus(usbp) {}
154
 
155
 
156
#if !defined(_FROM_ASM_)
157
#ifdef __cplusplus
158
extern "C" {
159
#endif
160
  void boardInit(void);
161
#ifdef __cplusplus
162
}
163
#endif
164
#endif /* _FROM_ASM_ */
165
 
166
#endif /* _BOARD_H_ */