forked from meshack-mbuvi/SPH336_Jan2015
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathled_blinker.h
61 lines (50 loc) · 1.1 KB
/
led_blinker.h
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
/*
* led_blinker.h
*
* Created on: Mar 7, 2015
* Author: allela_roy
*/
#ifndef LED_BLINKER_H_
#define LED_BLINKER_H_
#include <stdio.h>
void led_blinker(int byte1){
//int E1, E2, E3, E4;
//byte1 = byte_checker();
int n, c, k;
int LED[4];
n = byte1;
for (c = 3; c >= 0; c--)
{
k = n >> c;
if (k & 1)
LED[c] = 1;
else
LED[c] = 0;
}
/*E1 = LED[0];
E2 = LED[1];
E3 = LED[2];
E4 = LED[3];*/
/* if (E1==1){
GPIOA->PDDR.bit_reg.bit11 = on;}
else{
GPIOA->PDDR.bit_reg.bit11 = off;}
if (E2==1){
GPIOA->PDDR.bit_reg.bit28 = on;}
else{
GPIOA->PDDR.bit_reg.bit28 = off;}
if (E3==1){
GPIOA->PDDR.bit_reg.bit29 = on;}
else{
GPIOA->PDDR.bit_reg.bit29 = off; }
if (E4==1){
GPIOA->PDDR.bit_reg.bit10 = on; }
else{
GPIOA->PDDR.bit_reg.bit10 = off; }*/
GPIOA->PDDR.bit_reg.bit11 = LED[0];
GPIOA->PDDR.bit_reg.bit28 = LED[1];
GPIOA->PDDR.bit_reg.bit29 = LED[2];
GPIOA->PDDR.bit_reg.bit10 = LED[3];
//puts((uint8_t*)(n,"\r\n"));
}
#endif /* LED_BLINKER_H_ */