aboutsummaryrefslogtreecommitdiff
path: root/board/board-stbee-mini.h
blob: 7faeaba4092482b313668f9167895d1600988b15 (plain)
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
102
103
104
105
106
107
108
109
110
111
112
113
#define BOARD_NAME "STBee Mini"
#define BOARD_ID    0x1f341961

#define STM32F10X_MD		/* Medium-density device */

#define STM32_PLLXTPRE                  STM32_PLLXTPRE_DIV1
#define STM32_PLLMUL_VALUE              6
#define STM32_HSECLK                    12000000

#define GPIO_LED_BASE           GPIOA_BASE
#define GPIO_LED_CLEAR_TO_EMIT          13
#define GPIO_USB_BASE           GPIOA_BASE
#define GPIO_USB_SET_TO_ENABLE          14

#if defined(PINPAD_CIR_SUPPORT) || defined(PINPAD_DIAL_SUPPORT)
#define HAVE_7SEGLED	1
/*
 * Timer assignment for CIR
 */
#define TIMx                  TIM3
#define INTR_REQ_TIM          TIM3_IRQ
#define AFIO_EXTICR_INDEX     0
#endif

#if defined(PINPAD_CIR_SUPPORT)
#define AFIO_EXTICR1_EXTIx_Py AFIO_EXTICR1_EXTI0_PB
#define EXTI_PR               EXTI_PR_PR0
#define EXTI_IMR              EXTI_IMR_MR0
#define EXTI_FTSR_TR          EXTI_FTSR_TR0
#define INTR_REQ_EXTI         EXTI0_IRQ
#define RCC_APBnENR_TIMxEN    RCC_APB1ENR_TIM3EN
#define RCC_APBnRSTR_TIMxRST  RCC_APB1RSTR_TIM3RST
#elif defined(PINPAD_DIAL_SUPPORT)
#define AFIO_EXTICR1_EXTIx_Py AFIO_EXTICR1_EXTI2_PB
#define EXTI_PR               EXTI_PR_PR2
#define EXTI_IMR              EXTI_IMR_MR2
#define EXTI_FTSR_TR          EXTI_FTSR_TR2
#define INTR_REQ_EXTI         EXTI2_IRQ
#define RCC_APBnENR_TIMxEN    RCC_APB1ENR_TIM4EN
#define RCC_APBnRSTR_TIMxRST  RCC_APB1RSTR_TIM4RST
#endif
#define ENABLE_RCC_APB1

#if defined(PINPAD_CIR_SUPPORT) || defined(PINPAD_DIAL_SUPPORT)
/*
 * Port A setup.
 * PA1  - Digital input with PullUp.  AN1 for NeuG
 * PA2  - Digital input with PullUp.  AN2 for NeuG
 * PA6  - (TIM3_CH1) input with pull-up
 * PA7  - (TIM3_CH2) input with pull-down
 * PA11 - Push Pull output 10MHz 0 default (until USB enabled) (USBDM)
 * PA12 - Push Pull output 10MHz 0 default (until USB enabled) (USBDP)
 * PA13 - Open Drain output (LED1 0:ON 1:OFF)
 * PA14 - Push pull output  (USB ENABLE 0:DISABLE 1:ENABLE)
 * PA15 - Open Drain output (LED2 0:ON 1:OFF)
 */
#define VAL_GPIO_LED_ODR            0xFFFFE77F
#define VAL_GPIO_LED_CRL            0x88888888      /*  PA7...PA0 */
#define VAL_GPIO_LED_CRH            0x63611888      /* PA15...PA8 */

#define GPIO_OTHER_BASE          GPIOB_BASE
/*
 * Port B setup.
 * PB0  - Push pull output   (LED 1:ON 0:OFF)
 * ------------------------ Default
 * PBx  - input with pull-up.
 */
#define VAL_GPIO_OTHER_ODR            0xFFFFFFFF
#define VAL_GPIO_OTHER_CRL            0x88888888      /*  PB7...PB0 */
#define VAL_GPIO_OTHER_CRH            0x66666666      /* PB15...PB8 */

/* Port B setup. */
#define GPIOB_CIR               0
#define GPIOB_BUTTON            2
#define GPIOB_ROT_A             6
#define GPIOB_ROT_B             7

#define GPIOB_7SEG_DP           15
#define GPIOB_7SEG_A            14
#define GPIOB_7SEG_B            13
#define GPIOB_7SEG_C            12
#define GPIOB_7SEG_D            11
#define GPIOB_7SEG_E            10
#define GPIOB_7SEG_F            9
#define GPIOB_7SEG_G            8

#define RCC_ENR_IOP_EN      \
        (RCC_APB2ENR_IOPAEN | RCC_APB2ENR_IOPBEN | RCC_APB2ENR_AFIOEN)
#define RCC_RSTR_IOP_RST    \
        (RCC_APB2RSTR_IOPARST | RCC_APB2RSTR_IOPBRST | RCC_APB2RSTR_AFIORST)
#else
/*
 * Port A setup.
 * PA1  - Digital input with PullUp.  AN1 for NeuG
 * PA2  - Digital input with PullUp.  AN2 for NeuG
 * PA11 - Push Pull output 10MHz 0 default (until USB enabled) (USBDM)
 * PA12 - Push Pull output 10MHz 0 default (until USB enabled) (USBDP)
 * PA13 - Open Drain output (LED1 0:ON 1:OFF)
 * PA14 - Push pull output  (USB ENABLE 0:DISABLE 1:ENABLE)
 * PA15 - Open Drain output (LED2 0:ON 1:OFF)
 */
#define VAL_GPIO_LED_ODR            0xFFFFE7FF
#define VAL_GPIO_LED_CRL            0x88888888      /*  PA7...PA0 */
#define VAL_GPIO_LED_CRH            0x63611888      /* PA15...PA8 */

#undef  GPIO_OTHER_BASE

#define RCC_ENR_IOP_EN      (RCC_APB2ENR_IOPAEN | RCC_APB2ENR_AFIOEN)
#define RCC_RSTR_IOP_RST    (RCC_APB2RSTR_IOPARST | RCC_APB2RSTR_AFIORST)
#endif


#define AFIO_MAPR_SOMETHING     AFIO_MAPR_SWJ_CFG_DISABLE