Stefan Schuermans commited on 2012-02-12 18:24:53
Showing 3 changed files, with 15 additions and 11 deletions.
... | ... |
@@ -1,13 +1,15 @@ |
1 | 1 |
#include "cyc_cnt.h" |
2 | 2 |
|
3 |
+static volatile unsigned int *const cyc_cnt_ptr = |
|
4 |
+ (volatile unsigned int *)0x80001000; |
|
5 |
+ |
|
3 | 6 |
/** |
4 | 7 |
* @brief read cycle counter |
5 | 8 |
* @return cycle counter value |
6 | 9 |
*/ |
7 | 10 |
unsigned int cyc_cnt_read(void) |
8 | 11 |
{ |
9 |
- volatile unsigned int *p_cyc_cnt = (volatile unsigned int *)0x80001000; |
|
10 |
- return *p_cyc_cnt; |
|
12 |
+ return *cyc_cnt_ptr; |
|
11 | 13 |
} |
12 | 14 |
|
13 | 15 |
/** |
... | ... |
@@ -1,14 +1,16 @@ |
1 | 1 |
#include "cyc_cnt.h" |
2 | 2 |
#include "lcd.h" |
3 | 3 |
|
4 |
+static volatile unsigned char *const lcd_ptr = |
|
5 |
+ (volatile unsigned char *)0x80000100; |
|
6 |
+ |
|
4 | 7 |
/** |
5 | 8 |
* @brief set data to LCD |
6 | 9 |
* @param[in] data data to LCD |
7 | 10 |
*/ |
8 | 11 |
void lcd_set_data(unsigned char data) |
9 | 12 |
{ |
10 |
- volatile unsigned char *p_lcd_d = (volatile unsigned char *)0x80000100; |
|
11 |
- *p_lcd_d = data; |
|
13 |
+ lcd_ptr[0] = data; |
|
12 | 14 |
} |
13 | 15 |
|
14 | 16 |
/** |
... | ... |
@@ -17,8 +19,7 @@ void lcd_set_data(unsigned char data) |
17 | 19 |
*/ |
18 | 20 |
void lcd_set_e(unsigned char state) |
19 | 21 |
{ |
20 |
- volatile unsigned char *p_lcd_e = (volatile unsigned char *)0x80000101; |
|
21 |
- *p_lcd_e = state; |
|
22 |
+ lcd_ptr[1] = state; |
|
22 | 23 |
} |
23 | 24 |
|
24 | 25 |
/** |
... | ... |
@@ -27,8 +28,7 @@ void lcd_set_e(unsigned char state) |
27 | 28 |
*/ |
28 | 29 |
void lcd_set_rs(unsigned char state) |
29 | 30 |
{ |
30 |
- volatile unsigned char *p_lcd_rs = (volatile unsigned char *)0x80000102; |
|
31 |
- *p_lcd_rs = state; |
|
31 |
+ lcd_ptr[2] = state; |
|
32 | 32 |
} |
33 | 33 |
|
34 | 34 |
/** |
... | ... |
@@ -38,7 +38,7 @@ void lcd_set_rs(unsigned char state) |
38 | 38 |
void lcd_set_rw(unsigned char state) |
39 | 39 |
{ |
40 | 40 |
volatile unsigned char *p_lcd_rw = (volatile unsigned char *)0x80000103; |
41 |
- *p_lcd_rw = state; |
|
41 |
+ lcd_ptr[3] = state; |
|
42 | 42 |
} |
43 | 43 |
|
44 | 44 |
/** set LCD to 4 bit mode */ |
... | ... |
@@ -1,12 +1,14 @@ |
1 | 1 |
#include "leds.h" |
2 | 2 |
|
3 |
+static volatile unsigned char *const leds_ptr = |
|
4 |
+ (volatile unsigned char *)0x80000000; |
|
5 |
+ |
|
3 | 6 |
/** |
4 | 7 |
* @brief set state of LEDS |
5 | 8 |
* @param[in] state LED state |
6 | 9 |
*/ |
7 | 10 |
void leds_set_state(unsigned char state) |
8 | 11 |
{ |
9 |
- volatile unsigned char *p_leds = (volatile unsigned char *)0x80000000; |
|
10 |
- *p_leds = state; |
|
12 |
+ *leds_ptr = state; |
|
11 | 13 |
} |
12 | 14 |
|
13 | 15 |