| Nano100BN Series BSP V3.03.002 The Board Support Package for Nano100BN Series

NuEdu-Basic01_LED.c
Go to the documentation of this file.
1 /**************************************************************************/
12 #include <stdio.h>
13 #include "Nano100Series.h"
14 #include "NuEdu-Basic01_LED.h"
15
28 /*---------------------------------------------------------------------------------------------------------*/
29 /* Porting Define */
30 /*---------------------------------------------------------------------------------------------------------*/
31 #define LED1_ON PB0=0 //control LED1 on
32 #define LED2_ON PB1=0 //control LED2 on
33 #define LED3_ON PE9=0 //control LED3 on
34 #define LED4_ON PE10=0 //control LED4 on
35 #define LED5_ON PE11=0 //control LED5 on
36 #define LED6_ON PD8=0 //control LED6 on
37 #define LED7_ON PD9=0 //control LED7 on
38 #define LED8_ON PC7=0 //control LED8 on
39
40 #define LED1_OFF PB0=1 //control LED1 off
41 #define LED2_OFF PB1=1 //control LED2 off
42 #define LED3_OFF PE9=1 //control LED3 off
43 #define LED4_OFF PE10=1 //control LED4 off
44 #define LED5_OFF PE11=1 //control LED5 off
45 #define LED6_OFF PD8=1 //control LED6 off
46 #define LED7_OFF PD9=1 //control LED7 off
47 #define LED8_OFF PC7=1 //control LED8 off
48
49
54 void initial_led(void)
55 {
56 GPIO_SetMode(PB, BIT0, GPIO_PMD_OUTPUT);
57 GPIO_SetMode(PB, BIT1, GPIO_PMD_OUTPUT);
58 GPIO_SetMode(PE, BIT9, GPIO_PMD_OUTPUT);
59 GPIO_SetMode(PE, BIT10, GPIO_PMD_OUTPUT);
60 GPIO_SetMode(PE, BIT11, GPIO_PMD_OUTPUT);
61 GPIO_SetMode(PD, BIT8, GPIO_PMD_OUTPUT);
62 GPIO_SetMode(PD, BIT9, GPIO_PMD_OUTPUT);
63 GPIO_SetMode(PC, BIT7, GPIO_PMD_OUTPUT);
64
65 }
66
67
75 void LED_on(unsigned int temp)
76 {
77 if((temp&1)!=1)
78 LED1_OFF;
79 else
80 LED1_ON;
81
82 temp=temp>>1;
83
84 if((temp&1)!=1)
85 LED2_OFF;
86 else
87 LED2_ON;
88
89 temp=temp>>1;
90 if((temp&1)!=1)
91 LED3_OFF;
92 else
93 LED3_ON;
94
95 temp=temp>>1;
96 if((temp&1)!=1)
97 LED4_OFF;
98 else
99 LED4_ON;
100
101 temp=temp>>1;
102 if((temp&1)!=1)
103 LED5_OFF;
104 else
105 LED5_ON;
106
107 temp=temp>>1;
108 if((temp&1)!=1)
109 LED6_OFF;
110 else
111 LED6_ON;
112
113 temp=temp>>1;
114 if((temp&1)!=1)
115 LED7_OFF;
116 else
117 LED7_ON;
118
119 temp=temp>>1;
120 if((temp&1)!=1)
121 LED8_OFF;
122 else
123 LED8_ON;
124
125 }
126
131 void initial_close(void)
132 {
133
134 GPIO_SetMode(PB, BIT0, GPIO_PMD_INPUT); //LED1
135 GPIO_SetMode(PB, BIT1, GPIO_PMD_INPUT);
136 GPIO_SetMode(PE, BIT9, GPIO_PMD_INPUT);
137 GPIO_SetMode(PE, BIT10, GPIO_PMD_INPUT);
138 GPIO_SetMode(PE, BIT11, GPIO_PMD_INPUT);
139 GPIO_SetMode(PD, BIT8, GPIO_PMD_INPUT);
140 GPIO_SetMode(PD, BIT9, GPIO_PMD_INPUT);
141 GPIO_SetMode(PC, BIT7, GPIO_PMD_INPUT);
142
143 }
144 /* end of group Nano130_Basic01_FUNCTIONS Buzzer Exported Functions */
146 /* end of group NuEdu-SDK-Nano130_Basic01 Nano130_Basic01 Library */
148 /* end of group NANO100_Library NANO100 Library */
150 /*** (C) COPYRIGHT 2013 Nuvoton Technology Corp. ***/
PD
#define PD
Pointer to GPIO port D register structure.
Definition: Nano100Series.h:11698
LED2_OFF
#define LED2_OFF
Definition: NuEdu-Basic01_LED.c:41
LED1_ON
#define LED1_ON
Definition: NuEdu-Basic01_LED.c:31
GPIO_PMD_INPUT
#define GPIO_PMD_INPUT
Definition: gpio.h:37
BIT7
#define BIT7
Bit 7 mask of an 32 bit integer.
Definition: Nano100Series.h:11876
LED4_ON
#define LED4_ON
Definition: NuEdu-Basic01_LED.c:34
Nano100Series.h
Nano100 series peripheral access layer header file. This file contains all the peripheral register's ...
LED6_OFF
#define LED6_OFF
Definition: NuEdu-Basic01_LED.c:45
BIT0
#define BIT0
Bit 0 mask of an 32 bit integer.
Definition: Nano100Series.h:11869
LED8_ON
#define LED8_ON
Definition: NuEdu-Basic01_LED.c:38
LED8_OFF
#define LED8_OFF
Definition: NuEdu-Basic01_LED.c:47
BIT11
#define BIT11
Bit 11 mask of an 32 bit integer.
Definition: Nano100Series.h:11880
LED6_ON
#define LED6_ON
Definition: NuEdu-Basic01_LED.c:36
NuEdu-Basic01_LED.h
Nano100 series Basic01 board LED driver header file.
initial_close
void initial_close(void)
Set LED GPIO to input mode.
Definition: NuEdu-Basic01_LED.c:131
initial_led
void initial_led(void)
Set LED GPIO to output mode.
Definition: NuEdu-Basic01_LED.c:54
LED3_OFF
#define LED3_OFF
Definition: NuEdu-Basic01_LED.c:42
BIT8
#define BIT8
Bit 8 mask of an 32 bit integer.
Definition: Nano100Series.h:11877
BIT1
#define BIT1
Bit 1 mask of an 32 bit integer.
Definition: Nano100Series.h:11870
LED7_ON
#define LED7_ON
Definition: NuEdu-Basic01_LED.c:37
LED_on
void LED_on(unsigned int temp)
This function turn on LED numbers to open or close.
Definition: NuEdu-Basic01_LED.c:75
LED5_OFF
#define LED5_OFF
Definition: NuEdu-Basic01_LED.c:44
PC
#define PC
Pointer to GPIO port C register structure.
Definition: Nano100Series.h:11697
LED5_ON
#define LED5_ON
Definition: NuEdu-Basic01_LED.c:35
LED3_ON
#define LED3_ON
Definition: NuEdu-Basic01_LED.c:33
GPIO_PMD_OUTPUT
#define GPIO_PMD_OUTPUT
Definition: gpio.h:38
LED7_OFF
#define LED7_OFF
Definition: NuEdu-Basic01_LED.c:46
LED4_OFF
#define LED4_OFF
Definition: NuEdu-Basic01_LED.c:43
BIT9
#define BIT9
Bit 9 mask of an 32 bit integer.
Definition: Nano100Series.h:11878
PE
#define PE
Pointer to GPIO port E register structure.
Definition: Nano100Series.h:11699
LED2_ON
#define LED2_ON
Definition: NuEdu-Basic01_LED.c:32
PB
#define PB
Pointer to GPIO port B register structure.
Definition: Nano100Series.h:11696
LED1_OFF
#define LED1_OFF
Definition: NuEdu-Basic01_LED.c:40
GPIO_SetMode
void GPIO_SetMode(GPIO_T *gpio, uint32_t u32PinMask, uint32_t u32Mode)
Set GPIO operation mode.
Definition: gpio.c:40
BIT10
#define BIT10
Bit 10 mask of an 32 bit integer.
Definition: Nano100Series.h:11879