diff --git a/HGD4_reversed/boards/hgd6.json b/HGD4_reversed/boards/hgd6.json new file mode 100644 index 0000000..b670a90 --- /dev/null +++ b/HGD4_reversed/boards/hgd6.json @@ -0,0 +1,51 @@ +{ + "build": { + "arduino":{ + "ldscript": "nrf52_xxaa.ld" + }, + "core": "nRF5", + "cpu": "cortex-m4", + "extra_flags": "-DARDUINO_NRF52_DK", + "f_cpu": "64000000L", + "mcu": "nrf52840", + "variant": "nRF52DK", + "zephyr": { + "variant": "nrf52840dk_nrf52840" + } + }, + "connectivity": [ + "bluetooth" + ], + "debug": { + "default_tools": [ + "jlink" + ], + "jlink_device": "nRF52840_xxAA", + "onboard_tools": [ + "cmsis-dap", + "jlink" + ], + "svd_path": "nrf52840.svd" + }, + "frameworks": [ + "arduino", + "mbed", + "zephyr" + ], + "name": "HGD6 nRF52840", + "upload": { + "maximum_ram_size": 262144, + "maximum_size": 1048576, + "protocol": "jlink", + "protocols": [ + "jlink", + "nrfjprog", + "stlink", + "blackmagic", + "cmsis-dap", + "mbed" + ] + }, + "url": "https://unknown.org", + "vendor": "Unknown" + } \ No newline at end of file diff --git a/HGD4_reversed/platformio.ini b/HGD4_reversed/platformio.ini index 7a75c3f..4149e47 100644 --- a/HGD4_reversed/platformio.ini +++ b/HGD4_reversed/platformio.ini @@ -10,7 +10,7 @@ [env:nrf52840_dk] platform = nordicnrf52 -board = nrf52840_dk +board = hgd6 framework = arduino board_build.variants_dir = variants board_build.variant = hgd6 @@ -18,3 +18,5 @@ lib_deps = adafruit/Adafruit Unified Sensor@^1.1.15 adafruit/Adafruit LIS3DH@^1.3.0 sparkfun/SparkFun Ambient Light Sensor Arduino Library@^1.0.4 +build_unflags = "-DNRF52" +build_flags = "-DNRF52840_XXAA" \ No newline at end of file diff --git a/HGD4_reversed/src/main.cpp b/HGD4_reversed/src/main.cpp index 75ff6a7..fb7b417 100644 --- a/HGD4_reversed/src/main.cpp +++ b/HGD4_reversed/src/main.cpp @@ -43,16 +43,30 @@ void setup() { Wire.begin(); //set i2c pins pinMode(15, OUTPUT); - //initial watchdog feeding, necessary to avoid reset. this has to be in this position because otherwise i2c dies + //needed for some boards in1_handler(); } +int ptt = 34; + void loop() { Serial.println("loop"); - busscan(); - measuretemp(); - lightsense(); - delay(1000); + pinMode(29,OUTPUT); + digitalWrite(29,HIGH); + + pinMode(34,OUTPUT); + digitalWrite(34,HIGH); + delay(600); + digitalWrite(34,LOW); + delay(600); + //testallpins(); + //measuretemp(); + //lightsense(); + //pinMode(ptt,OUTPUT); + //digitalWrite(ptt,HIGH); + //delay(100); + //digitalWrite(ptt,LOW); + //delay(100); } void test1pin(int i,int d){ @@ -155,14 +169,17 @@ void busscan(){ } void testallpins(){ - for (size_t i = 0; i < 64; i++){ + for (size_t i = 36; i < 64; i++){ if(i != 2 && i != 29){ Serial.println(String(i)); - pinMode(i, OUTPUT); - digitalWrite(i, HIGH); - delay(50); - digitalWrite(i, LOW); - delay(50); + for (size_t j= 0; j < 50; j++) + { + pinMode(i, OUTPUT); + digitalWrite(i, HIGH); + delay(50); + digitalWrite(i, LOW); + delay(50); + } } } -} +} \ No newline at end of file diff --git a/HGD4_reversed/variants/hgd6/variant.h b/HGD4_reversed/variants/hgd6/variant.h index d9db839..2581cb4 100644 --- a/HGD4_reversed/variants/hgd6/variant.h +++ b/HGD4_reversed/variants/hgd6/variant.h @@ -1,26 +1,10 @@ -/* - Copyright (c) 2014-2015 Arduino LLC. All right reserved. - Copyright (c) 2016 Sandeep Mistry All right reserved. - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - #ifndef _VARIANT_GENERIC_ #define _VARIANT_GENERIC_ #include "nrf.h" + #include "nrf_peripherals.h" -/** Master clock frequency */ #if defined(NRF52_SERIES) #define VARIANT_MCK (64000000ul) #else @@ -81,19 +65,19 @@ static const uint8_t A5 = PIN_A5 ; * Serial interfaces */ // Serial -#define PIN_SERIAL_RX (17) // P0.00 -#define PIN_SERIAL_TX (22) // P0.01 +#define PIN_SERIAL_RX (32) +#define PIN_SERIAL_TX (33) /* * SPI Interfaces */ #define SPI_INTERFACES_COUNT 1 -#define PIN_SPI_MISO (12) // P0.22 -#define PIN_SPI_MOSI (41) // P0.23 -#define PIN_SPI_SCK (24) // P0.24 +#define PIN_SPI_MISO (12) +#define PIN_SPI_MOSI (41) +#define PIN_SPI_SCK (24) -static const uint8_t SS = 25 ; // P0.25 +static const uint8_t SS = 25 ; static const uint8_t MOSI = PIN_SPI_MOSI ; static const uint8_t MISO = PIN_SPI_MISO ; static const uint8_t SCK = PIN_SPI_SCK ;