summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fiken_status_panel.ino29
1 files changed, 13 insertions, 16 deletions
diff --git a/fiken_status_panel.ino b/fiken_status_panel.ino
index 9f2126b..22f7f4a 100644
--- a/fiken_status_panel.ino
+++ b/fiken_status_panel.ino
@@ -66,10 +66,8 @@ void setup() {
aci_state.aci_pins.miso_pin = MISO;
aci_state.aci_pins.sck_pin = SCK;
- /*
- * SPI_CLOCK_DIV8 = 2MHz SPI speed
- * SPI_CLOCK_DIV16 = 1MHz SPI speed
- */
+ // SPI_CLOCK_DIV8 = 2MHz SPI speed
+ // SPI_CLOCK_DIV16 = 1MHz SPI speed
aci_state.aci_pins.spi_clock_divider = SPI_CLOCK_DIV8;
aci_state.aci_pins.reset_pin = UNUSED; //4 for Nordic board, UNUSED for REDBEARLAB_SHIELD_V1_1
aci_state.aci_pins.active_pin = UNUSED;
@@ -78,10 +76,10 @@ void setup() {
aci_state.aci_pins.interface_is_interrupt = false; //Interrupts still not available in Chipkit
aci_state.aci_pins.interrupt_number = 4;
- //We reset the nRF8001 here by toggling the RESET line connected to the nRF8001
- //If the RESET line is not available we call the ACI Radio Reset to soft reset the nRF8001
- //then we initialize the data structures required to setup the nRF8001
- //The second parameter is for turning debug printing on for the ACI Commands and Events so they be printed on the Serial
+ // We reset the nRF8001 here by toggling the RESET line connected to the nRF8001
+ // If the RESET line is not available we call the ACI Radio Reset to soft reset the nRF8001
+ // then we initialize the data structures required to setup the nRF8001
+ // The second parameter is for turning debug printing on for the ACI Commands and Events so they be printed on the Serial
lib_aci_init(&aci_state, false);
Serial.println(F("lib_aci_init done"));
}
@@ -106,10 +104,8 @@ static void aci_loop() {
case ACI_DEVICE_STANDBY:
Serial.println(F("ACI_DEVICE_STANDBY"));
- //Looking for an iPhone by sending radio advertisements
- //When an iPhone connects to us we will get an ACI_EVT_CONNECTED event from the nRF8001
if (aci_evt->params.device_started.hw_error) {
- delay(20); //Magic number used to make sure the HW error event is handled correctly.
+ delay(20); // Magic number used to make sure the HW error event is handled correctly.
}
else {
lib_aci_connect(180/* in seconds */, 0x0050 /* advertising interval 50ms*/);
@@ -119,7 +115,7 @@ static void aci_loop() {
case ACI_DEVICE_INVALID:
case ACI_DEVICE_TEST:
case ACI_DEVICE_SLEEP:
- // ignored
+ // Ignored
break;
}
break;
@@ -154,7 +150,8 @@ static void aci_loop() {
timing_change_done = false;
aci_state.data_credit_available = aci_state.data_credit_total;
- // Get the device version of the nRF8001 and store it in the Hardware Revision String
+ // Get the device version of the nRF8001 and store it in the Hardware Revision String.
+ // This will trigger a ACI_CMD_GET_DEVICE_VERSION.
lib_aci_device_version();
break;
@@ -197,9 +194,9 @@ static void aci_loop() {
Serial.print(F(" Pipe Error Code: 0x"));
Serial.println(aci_evt->params.pipe_error.error_code, HEX);
- //Increment the credit available as the data packet was not sent.
- //The pipe error also represents the Attribute protocol Error Response sent from the peer and that should not be counted
- //for the credit.
+ // Increment the credit available as the data packet was not sent.
+ // The pipe error also represents the Attribute protocol Error Response sent from the peer and that should not be counted
+ // for the credit.
if (ACI_STATUS_ERROR_PEER_ATT_ERROR != aci_evt->params.pipe_error.error_code)
{
aci_state.data_credit_available++;