/* -------- INTERNAL FEATURES -------- */
-#define LED_CONFIG() (P1DIR |= BIT6)
-#define LED_ON() (P1OUT |= BIT6)
-#define LED_OFF() (P1OUT &= ~BIT6)
-#define LED_READ() (P1OUT & BIT6)
-#define LED_TOGGLE() (P1OUT ^= BIT6)
-
-#define CONNECTED_LED_CONFIG() (P1DIR |= BIT0)
-#define CONNECTED_LED_ON() (P1OUT |= BIT0)
-#define CONNECTED_LED_OFF() (P1OUT &= ~BIT0)
+#define GREEN_LED_CONFIG() (P1DIR |= BIT6)
+#define GREEN_LED_ON() (P1OUT |= BIT6)
+#define GREEN_LED_OFF() (P1OUT &= ~BIT6)
+#define GREEN_LED_READ() (P1OUT & BIT6)
+#define GREEN_LED_TOGGLE() (P1OUT ^= BIT6)
+
+#define RED_LED_CONFIG() (P1DIR |= BIT0)
+#define RED_LED_ON() (P1OUT |= BIT0)
+#define RED_LED_OFF() (P1OUT &= ~BIT0)
+#define RED_LED_READ() (P1OUT & BIT0)
+#define RED_LED_TOGGLE() (P1OUT ^= BIT0)
#define BUTTON_CONFIG() (P1DIR &= ~BIT3, P1REN |= BIT3, P1OUT |= BIT3, P1IES |= BIT3);
#define BUTTON_ENABLE() (P1IFG &= ~BIT3, P1IE |= BIT3)
}
void Hal_connected(void) {
- CONNECTED_LED_ON();
}
void Hal_debugOn(uint8_t line) {
}
void Hal_disconnected(void) {
- CONNECTED_LED_OFF();
}
void Hal_init(void) {
/* setup LEDs */
- LED_CONFIG();
- LED_OFF();
- CONNECTED_LED_CONFIG();
- CONNECTED_LED_OFF();
+ GREEN_LED_CONFIG();
+ GREEN_LED_OFF();
+ RED_LED_CONFIG();
+ RED_LED_OFF();
/* setup debug pins */
}
}
-void Hal_ledOn(void) {
- LED_ON();
+void Hal_greenLedOn(void) {
+ GREEN_LED_ON();
+}
+
+void Hal_greenLedOff(void) {
+ GREEN_LED_OFF();
+}
+
+bool Hal_greenLedRead(void) {
+ return GREEN_LED_READ();
+}
+
+void Hal_greenLedToggle(void) {
+ GREEN_LED_TOGGLE();
+}
+
+void Hal_redLedOn(void) {
+ RED_LED_ON();
}
-void Hal_ledOff(void) {
- LED_OFF();
+void Hal_redLedOff(void) {
+ RED_LED_OFF();
}
-bool Hal_ledRead(void) {
- return LED_READ();
+bool Hal_redLedRead(void) {
+ return RED_LED_READ();
}
-void Hal_ledToggle(void) {
- LED_TOGGLE();
+void Hal_redLedToggle(void) {
+ RED_LED_TOGGLE();
}
void Hal_tickStart(uint16_t msecs, Hal_Handler handler) {
* This example HAL is intentionally simple. The implementation is limited to:
*
* BUTTON -- a single button that when pressed will cause an interrupt.
- * CONNECTED_LED -- an LED that is controlled inside the HAL to indicate connection to a central.
* DEBUG -- two debug GPIOs that are available as outputs from the EAP and under user control.
* DELAY -- a delay routine that can delay by n milliseconds.
* INIT -- set the hardware up to its initial state
*
* Called whenever the MCM peripheral connects to a central.
*
- * Turns on the CONNECTED_LED to show connectivity to the central
* Could do other things associated with connection to the central.
*
* Inputs:
* Returns:
* None
*
- * Side Effects:
- * CONNECTED_LED on.
- *
**/
extern void Hal_connected(void);
/**
*
* Called whenever the MCM peripheral disconnects from a central.
*
- * Turns off the CONNECTED_LED to show lack of connectivity to the central
* Could do other things associated with connection to the central.
*
* Inputs:
* Returns:
* None
*
- * Side Effects:
- * CONNECTED_LED off.
- *
**/
extern void Hal_disconnected(void);
/**
* User LED off.
*
**/
-extern void Hal_ledOff(void);
+extern void Hal_greenLedOff(void);
+extern void Hal_redLedOff(void);
/**
* --------- Hal_ledOn ---------
*
* User LED on.
*
**/
-extern void Hal_ledOn(void);
+extern void Hal_greenLedOn(void);
+extern void Hal_redLedOn(void);
/**
* --------- Hal_ledRead ---------
*
* None
*
**/
-extern bool Hal_ledRead(void);
+extern bool Hal_greenLedRead(void);
+extern bool Hal_redLedRead(void);
/**
* --------- Hal_ledToggle ---------
*
* User LED toggles state.
*
**/
-extern void Hal_ledToggle(void);
+extern void Hal_greenLedToggle(void);
+extern void Hal_redLedToggle(void);
/**
* --------- Hal_tickStart ---------
*