OSDN Git Service

First commitment for the BlackTank LPC1769.
[blacktank/blacktank.git] / testpin.c
1 /**
2  * @file testpin.c
3  * @author Shinichiro Nakamura
4  * @brief テストピン制御ライブラリの実装。
5  */
6
7 #include <LPC17xx.h>
8 #include "testpin.h"
9
10 #define TP1_PIN_NUM 25
11 #define TP2_PIN_NUM 26
12
13 void testpin_init(void)
14 {
15     LPC_GPIO1->FIODIR |= (1 << TP1_PIN_NUM);
16     LPC_GPIO1->FIODIR |= (1 << TP2_PIN_NUM);
17 }
18
19 void testpin_tp1_write(uint8_t on)
20 {
21     if (on) {
22         LPC_GPIO1->FIOPIN |= (1 << TP1_PIN_NUM);
23     } else {
24         LPC_GPIO1->FIOPIN &= ~(1 << TP1_PIN_NUM);
25     }
26 }
27
28 void testpin_tp2_write(uint8_t on)
29 {
30     if (on) {
31         LPC_GPIO1->FIOPIN |= (1 << TP2_PIN_NUM);
32     } else {
33         LPC_GPIO1->FIOPIN &= ~(1 << TP2_PIN_NUM);
34     }
35 }
36
37 void testpin_tp1_toggle(void)
38 {
39     LPC_GPIO1->FIOPIN ^= (1 << TP1_PIN_NUM);
40 }
41
42 void testpin_tp2_toggle(void)
43 {
44     LPC_GPIO1->FIOPIN ^= (1 << TP2_PIN_NUM);
45 }
46