Skip to content

Commit 5858cfb

Browse files
committed
Changed the pin numbers to int
1 parent 718f4a7 commit 5858cfb

File tree

13 files changed

+103
-172
lines changed

13 files changed

+103
-172
lines changed

examples/Example10_TransmitARGOS3ZEWithPrediction/Example10_TransmitARGOS3ZEWithPrediction.ino

+8-8
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ ARTIC_R2 myARTIC;
9595
SFE_UBLOX_GPS myGPS;
9696

9797
// Pin assignments for the SparkFun Thing Plus - Artemis
98-
uint8_t CS_Pin = 24;
99-
uint8_t GAIN8_Pin = 3;
100-
uint8_t GAIN16_Pin = 4;
101-
uint8_t BOOT_Pin = 5;
102-
uint8_t INT1_Pin = 6;
103-
uint8_t INT2_Pin = 7;
104-
uint8_t RESET_Pin = 8;
105-
uint8_t PWR_EN_Pin = 9;
98+
int CS_Pin = 24;
99+
int GAIN8_Pin = 3;
100+
int GAIN16_Pin = 4;
101+
int BOOT_Pin = 5;
102+
int INT1_Pin = 6;
103+
int INT2_Pin = 7;
104+
int RESET_Pin = 8;
105+
int PWR_EN_Pin = 9;
106106

107107
// Loop Steps - these are used by the switch/case in the main loop
108108
// This structure makes it easy to jump between any of the steps

examples/Example11_TransmitARGOS3WithPrediction/Example11_TransmitARGOS3WithPrediction.ino

+8-8
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ ARTIC_R2 myARTIC;
9898
SFE_UBLOX_GPS myGPS;
9999

100100
// Pin assignments for the SparkFun Thing Plus - Artemis
101-
uint8_t CS_Pin = 24;
102-
uint8_t GAIN8_Pin = 3;
103-
uint8_t GAIN16_Pin = 4;
104-
uint8_t BOOT_Pin = 5;
105-
uint8_t INT1_Pin = 6;
106-
uint8_t INT2_Pin = 7;
107-
uint8_t RESET_Pin = 8;
108-
uint8_t PWR_EN_Pin = 9;
101+
int CS_Pin = 24;
102+
int GAIN8_Pin = 3;
103+
int GAIN16_Pin = 4;
104+
int BOOT_Pin = 5;
105+
int INT1_Pin = 6;
106+
int INT2_Pin = 7;
107+
int RESET_Pin = 8;
108+
int PWR_EN_Pin = 9;
109109

110110
// Loop Steps - these are used by the switch/case in the main loop
111111
// This structure makes it easy to jump between any of the steps

examples/Example12_TransmitARGOS2WithPrediction/Example12_TransmitARGOS2WithPrediction.ino

+8-8
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ ARTIC_R2 myARTIC;
9898
SFE_UBLOX_GPS myGPS;
9999

100100
// Pin assignments for the SparkFun Thing Plus - Artemis
101-
uint8_t CS_Pin = 24;
102-
uint8_t GAIN8_Pin = 3;
103-
uint8_t GAIN16_Pin = 4;
104-
uint8_t BOOT_Pin = 5;
105-
uint8_t INT1_Pin = 6;
106-
uint8_t INT2_Pin = 7;
107-
uint8_t RESET_Pin = 8;
108-
uint8_t PWR_EN_Pin = 9;
101+
int CS_Pin = 24;
102+
int GAIN8_Pin = 3;
103+
int GAIN16_Pin = 4;
104+
int BOOT_Pin = 5;
105+
int INT1_Pin = 6;
106+
int INT2_Pin = 7;
107+
int RESET_Pin = 8;
108+
int PWR_EN_Pin = 9;
109109

110110
// Loop Steps - these are used by the switch/case in the main loop
111111
// This structure makes it easy to jump between any of the steps

examples/Example1_FirmwareVersion/Example1_FirmwareVersion.ino

+8-8
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ ARTIC_R2 myARTIC;
4242

4343
// Pin assignments for the SparkFun Thing Plus - Artemis
4444
// (Change these if required)
45-
uint8_t CS_Pin = 24;
46-
uint8_t GAIN8_Pin = 3;
47-
uint8_t GAIN16_Pin = 4;
48-
uint8_t BOOT_Pin = 5;
49-
uint8_t INT1_Pin = 6;
50-
uint8_t INT2_Pin = 7;
51-
uint8_t RESET_Pin = 8;
52-
uint8_t PWR_EN_Pin = 9;
45+
int CS_Pin = 24;
46+
int GAIN8_Pin = 3;
47+
int GAIN16_Pin = 4;
48+
int BOOT_Pin = 5;
49+
int INT1_Pin = 6;
50+
int INT2_Pin = 7;
51+
int RESET_Pin = 8;
52+
int PWR_EN_Pin = 9;
5353

5454
voidsetup()
5555
{

examples/Example2_FirmwareStatus/Example2_FirmwareStatus.ino

+8-10
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,14 @@ ARTIC_R2 myARTIC;
4242

4343
// Pin assignments for the SparkFun Thing Plus - Artemis
4444
// (Change these if required)
45-
uint8_t CS_Pin = 24;
46-
uint8_t GAIN8_Pin = 3;
47-
uint8_t GAIN16_Pin = 4;
48-
uint8_t BOOT_Pin = 5;
49-
uint8_t INT1_Pin = 6;
50-
uint8_t INT2_Pin = 7;
51-
uint8_t RESET_Pin = 8;
52-
uint8_t PWR_EN_Pin = 9;
53-
54-
unsignedlong beginFinishedAt; // Keep a record of millis() when .begin finished
45+
int CS_Pin = 24;
46+
int GAIN8_Pin = 3;
47+
int GAIN16_Pin = 4;
48+
int BOOT_Pin = 5;
49+
int INT1_Pin = 6;
50+
int INT2_Pin = 7;
51+
int RESET_Pin = 8;
52+
int PWR_EN_Pin = 9;
5553

5654
voidsetup()
5755
{

examples/Example3_ReadSettings/Example3_ReadSettings.ino

+8-10
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,14 @@ ARTIC_R2 myARTIC;
3737

3838
// Pin assignments for the SparkFun Thing Plus - Artemis
3939
// (Change these if required)
40-
uint8_t CS_Pin = 24;
41-
uint8_t GAIN8_Pin = 3;
42-
uint8_t GAIN16_Pin = 4;
43-
uint8_t BOOT_Pin = 5;
44-
uint8_t INT1_Pin = 6;
45-
uint8_t INT2_Pin = 7;
46-
uint8_t RESET_Pin = 8;
47-
uint8_t PWR_EN_Pin = 9;
48-
49-
unsignedlong beginFinishedAt; // Keep a record of millis() when .begin finished
40+
int CS_Pin = 24;
41+
int GAIN8_Pin = 3;
42+
int GAIN16_Pin = 4;
43+
int BOOT_Pin = 5;
44+
int INT1_Pin = 6;
45+
int INT2_Pin = 7;
46+
int RESET_Pin = 8;
47+
int PWR_EN_Pin = 9;
5048

5149
voidsetup()
5250
{

examples/Example4_SatelliteDetection/Example4_SatelliteDetection.ino

+8-8
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ ARTIC_R2 myARTIC;
4343

4444
// Pin assignments for the SparkFun Thing Plus - Artemis
4545
// (Change these if required)
46-
uint8_t CS_Pin = 24;
47-
uint8_t GAIN8_Pin = 3;
48-
uint8_t GAIN16_Pin = 4;
49-
uint8_t BOOT_Pin = 5;
50-
uint8_t INT1_Pin = 6;
51-
uint8_t INT2_Pin = 7;
52-
uint8_t RESET_Pin = 8;
53-
uint8_t PWR_EN_Pin = 9;
46+
int CS_Pin = 24;
47+
int GAIN8_Pin = 3;
48+
int GAIN16_Pin = 4;
49+
int BOOT_Pin = 5;
50+
int INT1_Pin = 6;
51+
int INT2_Pin = 7;
52+
int RESET_Pin = 8;
53+
int PWR_EN_Pin = 9;
5454

5555
voidsetup()
5656
{

examples/Example5_ReceiveOneMessage/Example5_ReceiveOneMessage.ino

+8-8
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ ARTIC_R2 myARTIC;
4444

4545
// Pin assignments for the SparkFun Thing Plus - Artemis
4646
// (Change these if required)
47-
uint8_t CS_Pin = 24;
48-
uint8_t GAIN8_Pin = 3;
49-
uint8_t GAIN16_Pin = 4;
50-
uint8_t BOOT_Pin = 5;
51-
uint8_t INT1_Pin = 6;
52-
uint8_t INT2_Pin = 7;
53-
uint8_t RESET_Pin = 8;
54-
uint8_t PWR_EN_Pin = 9;
47+
int CS_Pin = 24;
48+
int GAIN8_Pin = 3;
49+
int GAIN16_Pin = 4;
50+
int BOOT_Pin = 5;
51+
int INT1_Pin = 6;
52+
int INT2_Pin = 7;
53+
int RESET_Pin = 8;
54+
int PWR_EN_Pin = 9;
5555

5656
voidsetup()
5757
{

examples/Example6_ReceiveOneMessageWithFiltering/Example6_ReceiveOneMessageWithFiltering.ino

+8-8
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ const uint32_t PLATFORM_ID = 0x00000000; // Update this with your Platform ID
5151
ARTIC_R2 myARTIC;
5252

5353
// Pin assignments for the SparkFun Thing Plus - Artemis
54-
uint8_t CS_Pin = 24;
55-
uint8_t GAIN8_Pin = 3;
56-
uint8_t GAIN16_Pin = 4;
57-
uint8_t BOOT_Pin = 5;
58-
uint8_t INT1_Pin = 6;
59-
uint8_t INT2_Pin = 7;
60-
uint8_t RESET_Pin = 8;
61-
uint8_t PWR_EN_Pin = 9;
54+
int CS_Pin = 24;
55+
int GAIN8_Pin = 3;
56+
int GAIN16_Pin = 4;
57+
int BOOT_Pin = 5;
58+
int INT1_Pin = 6;
59+
int INT2_Pin = 7;
60+
int RESET_Pin = 8;
61+
int PWR_EN_Pin = 9;
6262

6363
voidsetup()
6464
{

examples/Example7_ContinuousReceiveWithAOPParsing/Example7_ContinuousReceiveWithAOPParsing.ino

+8-8
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ ARTIC_R2 myARTIC;
4848

4949
// Pin assignments for the SparkFun Thing Plus - Artemis
5050
// (Change these if required)
51-
uint8_t CS_Pin = 24;
52-
uint8_t GAIN8_Pin = 3;
53-
uint8_t GAIN16_Pin = 4;
54-
uint8_t BOOT_Pin = 5;
55-
uint8_t INT1_Pin = 6;
56-
uint8_t INT2_Pin = 7;
57-
uint8_t RESET_Pin = 8;
58-
uint8_t PWR_EN_Pin = 9;
51+
int CS_Pin = 24;
52+
int GAIN8_Pin = 3;
53+
int GAIN16_Pin = 4;
54+
int BOOT_Pin = 5;
55+
int INT1_Pin = 6;
56+
int INT2_Pin = 7;
57+
int RESET_Pin = 8;
58+
int PWR_EN_Pin = 9;
5959

6060
voidsetup()
6161
{

examples/Example8_ContinuousReceiveWithAbort/Example8_ContinuousReceiveWithAbort.ino

+8-8
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ ARTIC_R2 myARTIC;
5151

5252
// Pin assignments for the SparkFun Thing Plus - Artemis
5353
// (Change these if required)
54-
uint8_t CS_Pin = 24;
55-
uint8_t GAIN8_Pin = 3;
56-
uint8_t GAIN16_Pin = 4;
57-
uint8_t BOOT_Pin = 5;
58-
uint8_t INT1_Pin = 6;
59-
uint8_t INT2_Pin = 7;
60-
uint8_t RESET_Pin = 8;
61-
uint8_t PWR_EN_Pin = 9;
54+
int CS_Pin = 24;
55+
int GAIN8_Pin = 3;
56+
int GAIN16_Pin = 4;
57+
int BOOT_Pin = 5;
58+
int INT1_Pin = 6;
59+
int INT2_Pin = 7;
60+
int RESET_Pin = 8;
61+
int PWR_EN_Pin = 9;
6262

6363
voidsetup()
6464
{

src/SparkFun_ARGOS_ARTIC_R2_Arduino_Library.cpp

+6-68
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#include"SparkFun_ARGOS_ARTIC_R2_Arduino_Library.h"
2828

29-
boolean ARTIC_R2::begin(uint8_t user_CSPin, uint8_t user_RSTPin, uint8_t user_BOOTPin, uint8_t user_PWRENPin, uint8_t user_INT1Pin, uint8_t user_INT2Pin, uint8_t user_GAIN8Pin, uint8_t user_GAIN16Pin, uint32_t spiPortSpeed, SPIClass &spiPort)
29+
boolean ARTIC_R2::begin(int user_CSPin, int user_RSTPin, int user_BOOTPin, int user_PWRENPin, int user_INT1Pin, int user_INT2Pin, int user_GAIN8Pin, int user_GAIN16Pin, unsignedlong spiPortSpeed, SPIClass &spiPort)
3030
{
3131
if (_printDebug == true)
3232
_debugPort->println(F("begin: ARTIC is starting..."));
@@ -83,8 +83,11 @@ boolean ARTIC_R2::begin(uint8_t user_CSPin, uint8_t user_RSTPin, uint8_t user_BO
8383
delay(ARTIC_R2_TX_POWER_ON_DELAY_MS);
8484
}
8585

86+
delay(ARTIC_R2_POWER_ON_DELAY_MS); // Make sure the power has been turned off for at least ARTIC_R2_POWER_ON_DELAY_MS
87+
8688
enableARTICpower(); // Enable power for the ARTIC R2
87-
delay(ARTIC_R2_POWER_ON_DELAY_MS);
89+
90+
delay(ARTIC_R2_POWER_ON_DELAY_MS); // Wait for ARTIC_R2_POWER_ON_DELAY_MS
8891

8992
// Now ramp up the TX gain to 24, if the _gain8 and _gain16 pins are defined, to reduce the current surge
9093
if ((_gain8 >= 0) && (_gain16 >= 0))
@@ -938,7 +941,7 @@ ARTIC_R2_MCU_Command_Result ARTIC_R2::sendConfigurationCommand(uint8_t command)
938941
else
939942
{
940943
clearInterrupts(3); // Clear both interrupts - because we probably should?
941-
944+
942945
return ARTIC_R2_MCU_COMMAND_UNCERTAIN; // Hopefully this is impossible?
943946
}
944947
}
@@ -3986,68 +3989,3 @@ boolean ARTIC_R2::printAOPbulletin(bulletin_data_t bulletin, Stream &port)
39863989
else
39873990
returnfalse;
39883991
}
3989-
3990-
// Write word to the external flash memory.
3991-
// *** This is pure guesswork! ***
3992-
// Returns true if write was attempted.
3993-
// Returns false if firmware version is < ARTIC006
3994-
boolean ARTIC_R2::writeToFlashMemory(uint32_t word)
3995-
{
3996-
// Check that we are using firmware ARTIC006 or later
3997-
if (ARTIC_R2_FIRMWARE_VERSION < 6)
3998-
{
3999-
if (_printDebug == true)
4000-
_debugPort->println("writeToFlashMemory: not supported by this firmware!");
4001-
4002-
returnfalse; // Abort! ARTIC004 does not support this.
4003-
}
4004-
4005-
// Prepare a burstmode write to MEM_LOC_FLASH_PROG_BUFFER in XMEM
4006-
ARTIC_R2_Burstmode_Register burstmode; // Prepare the burstmode register configuration
4007-
burstmode.BURSTMODE_REGISTER = 0x00000000; // Clear all unused bits
4008-
burstmode.BURSTMODE_REGISTER_BITS.BURSTMODE_REG_SPI_ADDR = ARTIC_R2_BURSTMODE_REG_WRITE;
4009-
burstmode.BURSTMODE_REGISTER_BITS.BURSTMODE_START_ADDR = MEM_LOC_FLASH_PROG_BUFFER;
4010-
burstmode.BURSTMODE_REGISTER_BITS.BURST_R_RW_MODE = ARTIC_R2_WRITE_BURST;
4011-
burstmode.BURSTMODE_REGISTER_BITS.BURST_MEM_SEL = ARTIC_R2_X_MEMORY;
4012-
burstmode.BURSTMODE_REGISTER_BITS.BURST_MODE_ON = 1;
4013-
4014-
configureBurstmodeRegister(burstmode); // Configure the burstmode register
4015-
4016-
delayMicroseconds(_delay24cycles); // Wait for 24 clock cycles
4017-
4018-
write24BitWord(word); // Write the word
4019-
4020-
delayMicroseconds(_delay24cycles); // Wait for 24 clock cycles
4021-
4022-
// Read the data back again and debug-print it
4023-
4024-
burstmode.BURSTMODE_REGISTER = 0x00000000; // Clear all unused bits
4025-
burstmode.BURSTMODE_REGISTER_BITS.BURSTMODE_REG_SPI_ADDR = ARTIC_R2_BURSTMODE_REG_WRITE;
4026-
burstmode.BURSTMODE_REGISTER_BITS.BURSTMODE_START_ADDR = MEM_LOC_FLASH_PROG_BUFFER;
4027-
burstmode.BURSTMODE_REGISTER_BITS.BURST_R_RW_MODE = ARTIC_R2_READ_BURST;
4028-
burstmode.BURSTMODE_REGISTER_BITS.BURST_MEM_SEL = ARTIC_R2_X_MEMORY;
4029-
burstmode.BURSTMODE_REGISTER_BITS.BURST_MODE_ON = 1;
4030-
4031-
configureBurstmodeRegister(burstmode); // Configure the burstmode register
4032-
4033-
delayMicroseconds(_delay24cycles); // Wait for 24 clock cycles
4034-
4035-
uint8_t buffer[3]; // Buffer for the SPI data
4036-
uint8_t *ptr = buffer; // Pointer to the buffer
4037-
4038-
readMultipleWords(ptr, 24, 1); // Read 1 24-bit word
4039-
4040-
delayMicroseconds(_delay24cycles); // Wait for 24 clock cycles - just in case we need to do another burst mode transfer straight away
4041-
4042-
if (_printDebug == true)
4043-
{
4044-
_debugPort->print("writeToFlashMemory: MEM_LOC_FLASH_PROG_BUFFER contains 0x");
4045-
if (buffer[0] < 0x10) _debugPort->print("0");
4046-
_debugPort->print(buffer[0], HEX);
4047-
if (buffer[1] < 0x10) _debugPort->print("0");
4048-
_debugPort->print(buffer[1], HEX);
4049-
if (buffer[2] < 0x10) _debugPort->print("0");
4050-
_debugPort->println(buffer[2], HEX);
4051-
}
4052-
returntrue;
4053-
}

src/SparkFun_ARGOS_ARTIC_R2_Arduino_Library.h

+9-12
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ class ARTIC_R2
429429
{
430430
public:
431431
// The maximum SPI clock speed for ARTIC read operations from the X/Y/IO memory is 1.25MHz, so let's play safe and default to 1MHz
432-
boolean begin(uint8_t user_CSPin, uint8_t user_RSTPin, uint8_t user_BOOTPin, uint8_t user_PWRENPin, uint8_t user_INT1Pin, uint8_t user_INT2Pin, uint8_t user_GAIN8Pin = -1, uint8_t user_GAIN16Pin = -1, uint32_t spiPortSpeed = 1000000, SPIClass &spiPort = SPI);
432+
boolean begin(int user_CSPin, int user_RSTPin, int user_BOOTPin, int user_PWRENPin, int user_INT1Pin, int user_INT2Pin, int user_GAIN8Pin = -1, int user_GAIN16Pin = -1, unsignedlong spiPortSpeed = 1000000, SPIClass &spiPort = SPI);
433433

434434
voidenableDebugging(Stream &debugPort = Serial); //Turn on debug printing. If user doesn't specify then Serial will be used.
435435

@@ -534,24 +534,21 @@ class ARTIC_R2
534534
uint32_tconvertGPSTimeToEpoch(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second); // Convert GPS date & time to epoch
535535
boolean printAOPbulletin(bulletin_data_t bulletin, Stream &port = Serial); // Pretty-print the AOP bulletin
536536

537-
// Write to flash memory. *** This is pure guesswork! ***
538-
boolean writeToFlashMemory(uint32_t word); // Write word to the external flash memory. Returns true if write was attempted.
539-
540537
private:
541538
//Variables
542539
Stream *_debugPort; //The stream to send debug messages to if enabled. Usually Serial.
543540
boolean _printDebug = false; //Flag to print debugging variables
544541

545542
SPIClass *_spiPort; // The generic connection to user's chosen SPI hardware
546543
unsignedlong _spiPortSpeed; // Optional user defined port speed
547-
uint8_t _cs; // ARTIC R2 SPI Chip Select
548-
uint8_t _rst; // ARTIC R2 Reset pin
549-
uint8_t _boot; // ARTIC R2 Boot pin
550-
uint8_t _pwr_en; // Pull this pin low to enable power for the ARTIC R2
551-
uint8_t _int1; // ARTIC R2 Interrupt 1 pin
552-
uint8_t _int2; // ARTIC R2 Interrupt 2 pin
553-
uint8_t _gain8 = -1; // Pull this pin high to _disable_ the x8 RF gain
554-
uint8_t _gain16 = -1; // Pull this pin high to _disable_ the x16 RF gain
544+
int _cs; // ARTIC R2 SPI Chip Select
545+
int _rst; // ARTIC R2 Reset pin
546+
int _boot; // ARTIC R2 Boot pin
547+
int _pwr_en; // Pull this pin low to enable power for the ARTIC R2
548+
int _int1; // ARTIC R2 Interrupt 1 pin
549+
int _int2; // ARTIC R2 Interrupt 2 pin
550+
int _gain8 = -1; // Pull this pin high to _disable_ the x8 RF gain
551+
int _gain16 = -1; // Pull this pin high to _disable_ the x16 RF gain
555552

556553
// The user has to wait for the duration of 24 SPI clock cycles after configuring the burst read mode, before starting the first read.
557554
// This allows some time for the internal memory access block to retrieve the first data sample.

0 commit comments

Comments
 (0)
close