summaryrefslogtreecommitdiff
path: root/fiken_status_panel.ino
diff options
context:
space:
mode:
Diffstat (limited to 'fiken_status_panel.ino')
-rw-r--r--fiken_status_panel.ino25
1 files changed, 16 insertions, 9 deletions
diff --git a/fiken_status_panel.ino b/fiken_status_panel.ino
index 35b3d40..82c4671 100644
--- a/fiken_status_panel.ino
+++ b/fiken_status_panel.ino
@@ -1,5 +1,4 @@
#include <SPI.h>
-#include <Watchdog.h>
#include <lib_aci.h>
#include <aci_setup.h>
@@ -48,8 +47,11 @@ void setup() {
delay(1000);
#endif
- Serial.println(F("setup()"));
+ setup_rf();
+}
+void setup_rf() {
+ Serial.println(F("setup_rf()"));
// Point ACI data structures to the the setup data that the nRFgo studio generated for the nRF8001
if (NULL != services_pipe_type_mapping) {
aci_state.aci_setup_info.services_pipe_type_mapping = &services_pipe_type_mapping[0];
@@ -93,7 +95,7 @@ static bool setup_required = false;
static void aci_loop() {
uint8_t pipe_number;
-
+
// We enter the if statement only when there is a ACI event available to be processed
if (lib_aci_event_get(&aci_state, &aci_data)) {
aci_evt_t * aci_evt;
@@ -302,16 +304,19 @@ void loop() {
if (!rf_started) {
static int count = 0;
count++;
+ /*
if(count == 3) {
- Serial.println(F("RF did not start, resetting"));
-
- asm volatile ("jmp 0");
+ Serial.println(F("RF did not start, resetting RF"));
+ // asm volatile ("jmp 0");
+ // lib_aci_pin_reset();
+ setup_rf();
count = 0;
return;
} else {
Serial.println(F("waiting for RF to start"));
}
+ */
}
else if (!setup_required) {
value++;
@@ -319,7 +324,7 @@ void loop() {
Serial.print(F("value="));
Serial.println(value, HEX);
- show_pipes();
+ // show_pipes();
}
}
}
@@ -334,7 +339,9 @@ void show_pipes() {
}
}
-bool send_ctrl(uint8_t *data, uint8_t len) {
+bool send_ctrl(fsp_res *res) {
+ uint8_t *data = (uint8_t *)res;
+ uint8_t len = 2 + res->len;
bool status = false;
Serial.print(F("send_ctrl, len="));
@@ -343,7 +350,7 @@ bool send_ctrl(uint8_t *data, uint8_t len) {
Serial.println(aci_state.data_credit_available, DEC);
Serial.print(F("available="));
Serial.println(lib_aci_is_pipe_available(&aci_state, PIPE_FIKEN_STATUS_PANEL_GAUGE_CONTROL_TX), DEC);
-
+
if (lib_aci_is_pipe_available(&aci_state, PIPE_FIKEN_STATUS_PANEL_GAUGE_CONTROL_TX) &&
aci_state.data_credit_available >= 1) {
status = lib_aci_send_data(PIPE_FIKEN_STATUS_PANEL_GAUGE_CONTROL_TX, data, len);