-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathL0_gpio_init.c
More file actions
64 lines (55 loc) · 2.29 KB
/
Copy pathL0_gpio_init.c
File metadata and controls
64 lines (55 loc) · 2.29 KB
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
/*************************************************************************************************/
/* filename: L0_gpio_init.c
*
* content: Function to initialize the GPIO pins used to drive the LED matrix
*
* CREATED
* date: 06.01.2015
* version: 1.0
* author: Harald Netzer, FH Technikum Wien, ew13b123
* remarks: -
**************************************************************************************************/
#include "config.h"
// Initialization of GPIO pins for LED panel driver using XMC Lib functions
void gpio_init(void)
{
XMC_GPIO_CONFIG_t config_out = {
XMC_GPIO_MODE_OUTPUT_PUSH_PULL,
XMC_GPIO_OUTPUT_LEVEL_LOW,
XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE
};
XMC_GPIO_CONFIG_t config_out1 = {
XMC_GPIO_MODE_OUTPUT_PUSH_PULL,
XMC_GPIO_OUTPUT_LEVEL_HIGH,
XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE
};
// Port 1:
// Address lines A to D (A0 to A3)
XMC_GPIO_Init(XMC_GPIO_PORT1,0,&config_out); // A
XMC_GPIO_Init(XMC_GPIO_PORT1,1,&config_out); // B
XMC_GPIO_Init(XMC_GPIO_PORT1,2,&config_out); // C
XMC_GPIO_Init(XMC_GPIO_PORT1,3,&config_out); // D
// Strobe pin - on falling edge the values from shift registers are transfered to output registers
XMC_GPIO_Init(XMC_GPIO_PORT1,4,&config_out); // STB
// Output enable pin - OE = low enables the panel
XMC_GPIO_Init(XMC_GPIO_PORT1,8,&config_out1); // OE
// Port 0
// Clock generating for shift register
XMC_GPIO_Init(XMC_GPIO_PORT0,12,&config_out); // CLK
// Panel LINE 0 Data pins RGB 0
XMC_GPIO_Init(XMC_GPIO_PORT0,11,&config_out); // RED
XMC_GPIO_Init(XMC_GPIO_PORT0,10,&config_out); // GREEN
XMC_GPIO_Init(XMC_GPIO_PORT0,9,&config_out); // BLUE
// Panel LINE 0 Data pins RGB 1
XMC_GPIO_Init(XMC_GPIO_PORT0,8,&config_out); // RED
XMC_GPIO_Init(XMC_GPIO_PORT0,7,&config_out); // GREEN
XMC_GPIO_Init(XMC_GPIO_PORT0,6,&config_out); // BLUE
// Panel LINE 1 Data pins RGB 0 - currently not used
XMC_GPIO_Init(XMC_GPIO_PORT0,5,&config_out); // RED
XMC_GPIO_Init(XMC_GPIO_PORT0,4,&config_out); // GREEN
XMC_GPIO_Init(XMC_GPIO_PORT0,3,&config_out); // BLUE
// Panel LINE 1 Data pins RGB 1 - currently not used
XMC_GPIO_Init(XMC_GPIO_PORT0,2,&config_out); // RED
XMC_GPIO_Init(XMC_GPIO_PORT0,1,&config_out); // GREEN
XMC_GPIO_Init(XMC_GPIO_PORT0,0,&config_out); // BLUE
}