diff --git a/include/led.h b/include/led.h index 2631563c..6527e879 100644 --- a/include/led.h +++ b/include/led.h @@ -37,5 +37,8 @@ extern TaskHandle_t ledLoopTask; void rgb_set_color(uint16_t hue); void blink_LED(uint16_t set_color, uint16_t set_blinkduration); void ledLoop(void *parameter); +#if (HAS_LED != NOT_A_PIN) +void switch_LED(uint8_t state); +#endif #endif \ No newline at end of file diff --git a/include/main.h b/include/main.h index 9c74aef5..f7284720 100644 --- a/include/main.h +++ b/include/main.h @@ -12,5 +12,6 @@ #include "beacon_array.h" #include "ota.h" #include "irqhandler.h" +#include "led.h" #endif \ No newline at end of file diff --git a/include/spisend.h b/include/spisend.h index 750a3c20..70cc4437 100644 --- a/include/spisend.h +++ b/include/spisend.h @@ -1,9 +1,34 @@ #ifndef _SPISEND_H #define _SPISEND_H +#include "globals.h" +#include "spi.h" + extern TaskHandle_t SpiTask; extern QueueHandle_t SPISendQueue; +/* + * Process data in SPI send queue + */ void spi_loop(void *pvParameters); +/* +* initialize local SPI wire interface +*/ +void hal_spi_init(); + +/* + * Perform SPI write transaction on local SPI wire interface + * - write the command byte 'cmd' + * - write 'len' bytes out of 'buf' + */ +void hal_spi_write(uint8_t cmd, const uint8_t* buf, int len); + +/* + * Perform SPI read transaction on local SPI wire interface + * - read the command byte 'cmd' + * - read 'len' bytes into 'buf' + */ +void hal_spi_read(uint8_t cmd, uint8_t* buf, int len); + #endif \ No newline at end of file diff --git a/lib/arduino-lmic-master/.gitignore b/lib/arduino-lmic-mcci-v2.2.2/.gitignore similarity index 100% rename from lib/arduino-lmic-master/.gitignore rename to lib/arduino-lmic-mcci-v2.2.2/.gitignore diff --git a/lib/arduino-lmic-master/.hgignore b/lib/arduino-lmic-mcci-v2.2.2/.hgignore similarity index 100% rename from lib/arduino-lmic-master/.hgignore rename to lib/arduino-lmic-mcci-v2.2.2/.hgignore diff --git a/lib/arduino-lmic-master/HOWTO-ADD-REGION.md b/lib/arduino-lmic-mcci-v2.2.2/HOWTO-ADD-REGION.md similarity index 100% rename from lib/arduino-lmic-master/HOWTO-ADD-REGION.md rename to lib/arduino-lmic-mcci-v2.2.2/HOWTO-ADD-REGION.md diff --git a/lib/arduino-lmic-master/LICENSE b/lib/arduino-lmic-mcci-v2.2.2/LICENSE similarity index 100% rename from lib/arduino-lmic-master/LICENSE rename to lib/arduino-lmic-mcci-v2.2.2/LICENSE diff --git a/lib/arduino-lmic-master/README.md b/lib/arduino-lmic-mcci-v2.2.2/README.md similarity index 100% rename from lib/arduino-lmic-master/README.md rename to lib/arduino-lmic-mcci-v2.2.2/README.md diff --git a/lib/arduino-lmic-master/doc/LMiC-v1.6.docx b/lib/arduino-lmic-mcci-v2.2.2/doc/LMiC-v1.6.docx similarity index 100% rename from lib/arduino-lmic-master/doc/LMiC-v1.6.docx rename to lib/arduino-lmic-mcci-v2.2.2/doc/LMiC-v1.6.docx diff --git a/lib/arduino-lmic-master/doc/LMiC-v1.6.pdf b/lib/arduino-lmic-mcci-v2.2.2/doc/LMiC-v1.6.pdf similarity index 100% rename from lib/arduino-lmic-master/doc/LMiC-v1.6.pdf rename to lib/arduino-lmic-mcci-v2.2.2/doc/LMiC-v1.6.pdf diff --git a/lib/arduino-lmic-master/doc/README.txt b/lib/arduino-lmic-mcci-v2.2.2/doc/README.txt similarity index 100% rename from lib/arduino-lmic-master/doc/README.txt rename to lib/arduino-lmic-mcci-v2.2.2/doc/README.txt diff --git a/lib/arduino-lmic-master/doc/release-notes.txt b/lib/arduino-lmic-mcci-v2.2.2/doc/release-notes.txt similarity index 100% rename from lib/arduino-lmic-master/doc/release-notes.txt rename to lib/arduino-lmic-mcci-v2.2.2/doc/release-notes.txt diff --git a/lib/arduino-lmic-master/library.properties b/lib/arduino-lmic-mcci-v2.2.2/library.properties similarity index 100% rename from lib/arduino-lmic-master/library.properties rename to lib/arduino-lmic-mcci-v2.2.2/library.properties diff --git a/lib/arduino-lmic-master/src/aes/ideetron/AES-128_V10.cpp b/lib/arduino-lmic-mcci-v2.2.2/src/aes/ideetron/AES-128_V10.cpp similarity index 100% rename from lib/arduino-lmic-master/src/aes/ideetron/AES-128_V10.cpp rename to lib/arduino-lmic-mcci-v2.2.2/src/aes/ideetron/AES-128_V10.cpp diff --git a/lib/arduino-lmic-master/src/aes/lmic.c b/lib/arduino-lmic-mcci-v2.2.2/src/aes/lmic.c similarity index 100% rename from lib/arduino-lmic-master/src/aes/lmic.c rename to lib/arduino-lmic-mcci-v2.2.2/src/aes/lmic.c diff --git a/lib/arduino-lmic-master/src/aes/other.c b/lib/arduino-lmic-mcci-v2.2.2/src/aes/other.c similarity index 100% rename from lib/arduino-lmic-master/src/aes/other.c rename to lib/arduino-lmic-mcci-v2.2.2/src/aes/other.c diff --git a/lib/arduino-lmic-master/src/hal/hal.cpp b/lib/arduino-lmic-mcci-v2.2.2/src/hal/hal.cpp similarity index 100% rename from lib/arduino-lmic-master/src/hal/hal.cpp rename to lib/arduino-lmic-mcci-v2.2.2/src/hal/hal.cpp diff --git a/lib/arduino-lmic-master/src/hal/hal.h b/lib/arduino-lmic-mcci-v2.2.2/src/hal/hal.h similarity index 100% rename from lib/arduino-lmic-master/src/hal/hal.h rename to lib/arduino-lmic-mcci-v2.2.2/src/hal/hal.h diff --git a/lib/arduino-lmic-master/src/lmic.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic.h diff --git a/lib/arduino-lmic-master/src/lmic/config.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/config.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/config.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/config.h diff --git a/lib/arduino-lmic-master/src/lmic/hal.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/hal.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/hal.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/hal.h diff --git a/lib/arduino-lmic-master/src/lmic/lmic.c b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic.c similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic.c rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic.c diff --git a/lib/arduino-lmic-master/src/lmic/lmic.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic.h diff --git a/lib/arduino-lmic-master/src/lmic/lmic_as923.c b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_as923.c similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic_as923.c rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_as923.c diff --git a/lib/arduino-lmic-master/src/lmic/lmic_au921.c b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_au921.c similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic_au921.c rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_au921.c diff --git a/lib/arduino-lmic-master/src/lmic/lmic_bandplan.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_bandplan.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic_bandplan.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_bandplan.h diff --git a/lib/arduino-lmic-master/src/lmic/lmic_bandplan_as923.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_bandplan_as923.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic_bandplan_as923.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_bandplan_as923.h diff --git a/lib/arduino-lmic-master/src/lmic/lmic_bandplan_au921.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_bandplan_au921.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic_bandplan_au921.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_bandplan_au921.h diff --git a/lib/arduino-lmic-master/src/lmic/lmic_bandplan_eu868.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_bandplan_eu868.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic_bandplan_eu868.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_bandplan_eu868.h diff --git a/lib/arduino-lmic-master/src/lmic/lmic_bandplan_in866.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_bandplan_in866.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic_bandplan_in866.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_bandplan_in866.h diff --git a/lib/arduino-lmic-master/src/lmic/lmic_bandplan_us915.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_bandplan_us915.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic_bandplan_us915.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_bandplan_us915.h diff --git a/lib/arduino-lmic-master/src/lmic/lmic_config_preconditions.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_config_preconditions.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic_config_preconditions.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_config_preconditions.h diff --git a/lib/arduino-lmic-master/src/lmic/lmic_eu868.c b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_eu868.c similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic_eu868.c rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_eu868.c diff --git a/lib/arduino-lmic-master/src/lmic/lmic_eu_like.c b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_eu_like.c similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic_eu_like.c rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_eu_like.c diff --git a/lib/arduino-lmic-master/src/lmic/lmic_eu_like.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_eu_like.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic_eu_like.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_eu_like.h diff --git a/lib/arduino-lmic-master/src/lmic/lmic_in866.c b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_in866.c similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic_in866.c rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_in866.c diff --git a/lib/arduino-lmic-master/src/lmic/lmic_us915.c b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_us915.c similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic_us915.c rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_us915.c diff --git a/lib/arduino-lmic-master/src/lmic/lmic_us_like.c b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_us_like.c similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic_us_like.c rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_us_like.c diff --git a/lib/arduino-lmic-master/src/lmic/lmic_us_like.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_us_like.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic_us_like.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_us_like.h diff --git a/lib/arduino-lmic-master/src/lmic/lmic_util.c b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_util.c similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic_util.c rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_util.c diff --git a/lib/arduino-lmic-master/src/lmic/lmic_util.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_util.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lmic_util.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lmic_util.h diff --git a/lib/arduino-lmic-master/src/lmic/lorabase.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lorabase.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lorabase.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lorabase.h diff --git a/lib/arduino-lmic-master/src/lmic/lorabase_as923.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lorabase_as923.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lorabase_as923.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lorabase_as923.h diff --git a/lib/arduino-lmic-master/src/lmic/lorabase_au921.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lorabase_au921.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lorabase_au921.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lorabase_au921.h diff --git a/lib/arduino-lmic-master/src/lmic/lorabase_eu868.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lorabase_eu868.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lorabase_eu868.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lorabase_eu868.h diff --git a/lib/arduino-lmic-master/src/lmic/lorabase_in866.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lorabase_in866.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lorabase_in866.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lorabase_in866.h diff --git a/lib/arduino-lmic-master/src/lmic/lorabase_us915.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/lorabase_us915.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/lorabase_us915.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/lorabase_us915.h diff --git a/lib/arduino-lmic-master/src/lmic/oslmic.c b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/oslmic.c similarity index 100% rename from lib/arduino-lmic-master/src/lmic/oslmic.c rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/oslmic.c diff --git a/lib/arduino-lmic-master/src/lmic/oslmic.h b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/oslmic.h similarity index 100% rename from lib/arduino-lmic-master/src/lmic/oslmic.h rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/oslmic.h diff --git a/lib/arduino-lmic-master/src/lmic/radio.c b/lib/arduino-lmic-mcci-v2.2.2/src/lmic/radio.c similarity index 100% rename from lib/arduino-lmic-master/src/lmic/radio.c rename to lib/arduino-lmic-mcci-v2.2.2/src/lmic/radio.c diff --git a/platformio.ini b/platformio.ini index e0ccb21c..a21e5d4a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -29,7 +29,7 @@ description = Paxcounter is a proof-of-concept ESP32 device for metering passeng [common] ; for release_version use max. 10 chars total, use any decimal format like "a.b.c" -release_version = 1.6.51 +release_version = 1.6.54 ; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running! ; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose debug_level = 0 diff --git a/src/hal/heltecv2.h b/src/hal/heltecv2.h index a97a6d3c..6d48f05f 100644 --- a/src/hal/heltecv2.h +++ b/src/hal/heltecv2.h @@ -25,7 +25,7 @@ #define LORA_MOSI (27) #define LORA_RST (14) #define LORA_IO0 (26) -#define LORA_IO1 (34) -#define LORA_IO2 (35) +#define LORA_IO1 (35) +#define LORA_IO2 (34) #endif \ No newline at end of file diff --git a/src/led.cpp b/src/led.cpp index 76195523..8e3b7ed8 100644 --- a/src/led.cpp +++ b/src/led.cpp @@ -87,6 +87,28 @@ void rgb_set_color(uint16_t hue) {} #endif +#if (HAS_LED != NOT_A_PIN) + +void switch_LED(uint8_t state) { + if (state == LED_ON) { + // switch LED on +#ifdef LED_ACTIVE_LOW + digitalWrite(HAS_LED, LOW); +#else + digitalWrite(HAS_LED, HIGH); +#endif + } else if (state == LED_OFF) { + // switch LED off +#ifdef LED_ACTIVE_LOW + digitalWrite(HAS_LED, HIGH); +#else + digitalWrite(HAS_LED, LOW); +#endif + } +} + +#endif + #if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED) void blink_LED(uint16_t set_color, uint16_t set_blinkduration) { @@ -98,7 +120,8 @@ void blink_LED(uint16_t set_color, uint16_t set_blinkduration) { void ledLoop(void *parameter) { while (1) { - // Custom blink running always have priority other LoRaWAN led management + // Custom blink running always have priority other LoRaWAN led + // management if (LEDBlinkStarted && LEDBlinkDuration) { // Custom blink is finished, let this order, avoid millis() overflow if ((millis() - LEDBlinkStarted) >= LEDBlinkDuration) { @@ -154,20 +177,14 @@ void ledLoop(void *parameter) { if (LEDState != previousLEDState) { if (LEDState == LED_ON) { rgb_set_color(LEDColor); - -#ifdef LED_ACTIVE_LOW - digitalWrite(HAS_LED, LOW); -#else - digitalWrite(HAS_LED, HIGH); + // if we have only single LED we use it to blink for status +#ifndef HAS_RGB_LED + switch_LED(LED_ON); #endif - } else { rgb_set_color(COLOR_NONE); - -#ifdef LED_ACTIVE_LOW - digitalWrite(HAS_LED, HIGH); -#else - digitalWrite(HAS_LED, LOW); +#ifndef HAS_RGB_LED + switch_LED(LED_OFF); #endif } previousLEDState = LEDState; diff --git a/src/main.cpp b/src/main.cpp index 1cceb71f..af5fdd4c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -96,7 +96,12 @@ void setup() { #if (HAS_LED != NOT_A_PIN) pinMode(HAS_LED, OUTPUT); strcat_P(features, " LED"); +// switch on power LED if we have 2 LEDs, else use it for status +#ifdef HAS_RGB_LED + switch_LED(LED_ON); #endif +#endif + #ifdef HAS_RGB_LED rgb_set_color(COLOR_PINK); strcat_P(features, " RGB"); diff --git a/src/payload.cpp b/src/payload.cpp index 38c2df76..a1d6e580 100644 --- a/src/payload.cpp +++ b/src/payload.cpp @@ -48,6 +48,7 @@ void PayloadConvert::addConfig(configData_t value) { buffer[cursor++] = value.vendorfilter; buffer[cursor++] = value.rgblum; buffer[cursor++] = value.gpsmode; + buffer[cursor++] = value.monitormode; memcpy(buffer + cursor, value.version, 10); cursor += 10; } diff --git a/src/rcommand.cpp b/src/rcommand.cpp index ab82deaa..37460d86 100644 --- a/src/rcommand.cpp +++ b/src/rcommand.cpp @@ -105,7 +105,10 @@ void set_countmode(uint8_t val[]) { ESP_LOGW( TAG, "Remote command: set counter mode called with invalid parameter(s)"); + return; } + reset_counters(); // clear macs + get_salt(); // get new salt } void set_screensaver(uint8_t val[]) { diff --git a/src/spisend.cpp b/src/spisend.cpp index 57da9287..6d28f5a8 100644 --- a/src/spisend.cpp +++ b/src/spisend.cpp @@ -1,6 +1,6 @@ #ifdef HAS_SPI -#include "globals.h" +#include "spisend.h" // Local logging tag static const char TAG[] = "main"; @@ -13,18 +13,60 @@ TaskHandle_t SpiTask; // SPI feed Task void spi_loop(void *pvParameters) { + uint8_t buf[32]; + configASSERT(((uint32_t)pvParameters) == 1); // FreeRTOS check while (1) { + // check if data to send on SPI interface if (xQueueReceive(SPISendQueue, &SendBuffer, (TickType_t)0) == pdTRUE) { + hal_spi_write(SendBuffer.MessagePort, SendBuffer.Message, + SendBuffer.MessageSize); ESP_LOGI(TAG, "%d bytes sent to SPI", SendBuffer.MessageSize); } - vTaskDelay(2 / portTICK_PERIOD_MS); // yield to CPU - } // end of infinite loop + // check if command is received on SPI command port, then call interpreter + hal_spi_read(RCMDPORT, buf, 32); + if (buf[0]) + rcommand(buf, sizeof(buf)); + + vTaskDelay(2 / portTICK_PERIOD_MS); // yield to CPU + } // end of infinite loop vTaskDelete(NULL); // shoud never be reached } // spi_loop() +// SPI hardware abstraction layer + +void hal_spi_init() { SPI.begin(SCK, MISO, MOSI, SS); } + +void hal_spi_trx(uint8_t port, uint8_t *buf, int len, uint8_t is_read) { + + SPISettings settings(1E6, MSBFIRST, SPI_MODE0); + SPI.beginTransaction(settings); + digitalWrite(SS, 0); + + SPI.transfer(port); + + for (uint8_t i = 0; i < len; i++) { + uint8_t *p = buf + i; + uint8_t data = is_read ? 0x00 : *p; + data = SPI.transfer(data); + if (is_read) + *p = data; + } + + digitalWrite(SS, 1); + SPI.endTransaction(); +} + +void hal_spi_write(uint8_t port, const uint8_t *buf, int len) { + hal_spi_trx(port, (uint8_t *)buf, len, 0); +} + +void hal_spi_read(uint8_t port, uint8_t *buf, int len) { + hal_spi_trx(port, buf, len, 1); +} + #endif // HAS_SPI \ No newline at end of file