aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-07-31 21:00:26 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2015-07-31 21:00:32 +0200
commit455775a4a028c886d4d32dc816d57dff5bfae8aa (patch)
treed6e2e1996d90e4df05087d1706b42c75934ba1a2
parent930b9e23ab981251e0cbd839c5a2f3a769c3fb47 (diff)
downloadtrygvisio_soil_moisture-455775a4a028c886d4d32dc816d57dff5bfae8aa.tar.gz
trygvisio_soil_moisture-455775a4a028c886d4d32dc816d57dff5bfae8aa.tar.bz2
trygvisio_soil_moisture-455775a4a028c886d4d32dc816d57dff5bfae8aa.tar.xz
trygvisio_soil_moisture-455775a4a028c886d4d32dc816d57dff5bfae8aa.zip
o Adding Board #4.
-rw-r--r--app.cpp6
-rw-r--r--config-check.h1
-rw-r--r--trygvisio_soil_moisture.ino35
3 files changed, 34 insertions, 8 deletions
diff --git a/app.cpp b/app.cpp
index 30160dc..8780f0f 100644
--- a/app.cpp
+++ b/app.cpp
@@ -12,6 +12,8 @@
#define SENSOR_COUNT 4
#elif SM_BOARD_VERSION == 3
#define SENSOR_COUNT 1
+#elif SM_BOARD_VERSION == 4
+#define SENSOR_COUNT 0
#else
#error "SM_BOARD_VERSION must be set to a valid value. See config-check.h"
#endif
@@ -20,7 +22,6 @@
#define EEPROM_MAGIC 0xa5
-// See http://redbearlab.com/blendmicro/ for pins.
struct sm_sensor {
uint8_t a_pin;
uint8_t d1_pin;
@@ -34,6 +35,7 @@ struct sm_sensor {
// A Pin, D1 Pin, D2 Pin, Value, Warning Value, Update Interval, Length of Name, Name
#if SM_BOARD_VERSION == 1
+// See http://redbearlab.com/blendmicro/ for pins.
{ 8, 3, 5, 0, 200, 3000, 9, "Sensor #1"},
{ 10, 11, 12, 0, 200, 5000, 9, "Sensor #2"},
#elif SM_BOARD_VERSION == 2
@@ -43,6 +45,8 @@ struct sm_sensor {
{ A3, 11, 12, 0, 200, 3000, 3, "bar"},
#elif SM_BOARD_VERSION == 3
{ A0, 1, 2, 0, 200, 3000, 3, "0"},
+#elif SM_BOARD_VERSION == 4
+// TODO: add some sensors
#endif
};
diff --git a/config-check.h b/config-check.h
index 63e9b95..077d391 100644
--- a/config-check.h
+++ b/config-check.h
@@ -36,6 +36,7 @@
* 1: prototype-a, the hand assembled PCB
* 2: prototype-b, the china produced PCB
* 3: attiny85
+ * 4: OLIMEXINO-32U4
*
* No default, has to be specified in config.h
*/
diff --git a/trygvisio_soil_moisture.ino b/trygvisio_soil_moisture.ino
index a43ea26..5c1a152 100644
--- a/trygvisio_soil_moisture.ino
+++ b/trygvisio_soil_moisture.ino
@@ -123,13 +123,17 @@ static void setup_rf() {
else {
aci_state.aci_setup_info.services_pipe_type_mapping = NULL;
}
- aci_state.aci_setup_info.number_of_pipes = NUMBER_OF_PIPES;
- aci_state.aci_setup_info.setup_msgs = (hal_aci_data_t*)setup_msgs;
- aci_state.aci_setup_info.num_setup_msgs = NB_SETUP_MESSAGES;
+ aci_state.aci_setup_info.number_of_pipes = NUMBER_OF_PIPES;
+ aci_state.aci_setup_info.setup_msgs = (hal_aci_data_t*)setup_msgs;
+ aci_state.aci_setup_info.num_setup_msgs = NB_SETUP_MESSAGES;
// Tell the ACI library, the MCU to nRF8001 pin connections.
// The Active pin is optional and can be marked UNUSED
-// aci_state.aci_pins.board_name = REDBEARLAB_SHIELD_V2;
+
+ // SPI_CLOCK_DIV8 = 2MHz SPI speed
+ // SPI_CLOCK_DIV16 = 1MHz SPI speed
+
+#ifdef ARDUINO_BLEND_MICRO
aci_state.aci_pins.board_name = REDBEARLAB_SHIELD_V1_1;
aci_state.aci_pins.reqn_pin = 6;
aci_state.aci_pins.rdyn_pin = 7;
@@ -137,15 +141,32 @@ static void setup_rf() {
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
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.reset_pin = UNUSED;
aci_state.aci_pins.active_pin = UNUSED;
aci_state.aci_pins.optional_chip_sel_pin = UNUSED;
aci_state.aci_pins.interface_is_interrupt = false;
aci_state.aci_pins.interrupt_number = 4;
+#error wat
+#elif ARDUINO_AVR_LEONARDO // Assumes OLIMEXINO-32U4 and UEXT
+ aci_state.aci_pins.board_name = BOARD_DEFAULT;
+ aci_state.aci_pins.reqn_pin = 2;
+ aci_state.aci_pins.rdyn_pin = 13;
+ aci_state.aci_pins.mosi_pin = MOSI;
+ aci_state.aci_pins.miso_pin = MISO;
+ aci_state.aci_pins.sck_pin = SCK;
+
+ aci_state.aci_pins.spi_clock_divider = SPI_CLOCK_DIV8;
+ aci_state.aci_pins.reset_pin = 3;
+ aci_state.aci_pins.active_pin = UNUSED;
+ aci_state.aci_pins.optional_chip_sel_pin = UNUSED;
+
+ aci_state.aci_pins.interface_is_interrupt = false;
+// aci_state.aci_pins.interrupt_number = 4;
+#else
+#error unknown board type
+#endif
// 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