diff --git a/app/app.uvoptx b/app/app.uvoptx
index 3792195..7919f87 100644
--- a/app/app.uvoptx
+++ b/app/app.uvoptx
@@ -751,17 +751,53 @@
0
0
+
+ 7
+ 29
+ 1
+ 0
+ 0
+ 0
+ ..\sdk\modules\nrfx\drivers\src\nrfx_spi.c
+ nrfx_spi.c
+ 0
+ 0
+
+
+ 7
+ 30
+ 1
+ 0
+ 0
+ 0
+ ..\sdk\modules\nrfx\drivers\src\nrfx_spim.c
+ nrfx_spim.c
+ 0
+ 0
+
+
+ 7
+ 31
+ 1
+ 0
+ 0
+ 0
+ ..\sdk\integration\nrfx\legacy\nrf_drv_spi.c
+ nrf_drv_spi.c
+ 0
+ 0
+
nRF_Libraries
- 0
+ 1
0
0
0
8
- 29
+ 32
1
0
0
@@ -773,7 +809,7 @@
8
- 30
+ 33
1
0
0
@@ -785,7 +821,7 @@
8
- 31
+ 34
1
0
0
@@ -797,7 +833,7 @@
8
- 32
+ 35
1
0
0
@@ -809,7 +845,7 @@
8
- 33
+ 36
1
0
0
@@ -821,7 +857,7 @@
8
- 34
+ 37
1
0
0
@@ -833,7 +869,7 @@
8
- 35
+ 38
1
0
0
@@ -845,7 +881,7 @@
8
- 36
+ 39
1
0
0
@@ -857,7 +893,7 @@
8
- 37
+ 40
1
0
0
@@ -869,7 +905,7 @@
8
- 38
+ 41
1
0
0
@@ -881,7 +917,7 @@
8
- 39
+ 42
1
0
0
@@ -893,7 +929,7 @@
8
- 40
+ 43
1
0
0
@@ -905,7 +941,7 @@
8
- 41
+ 44
1
0
0
@@ -917,7 +953,7 @@
8
- 42
+ 45
1
0
0
@@ -929,7 +965,7 @@
8
- 43
+ 46
1
0
0
@@ -941,7 +977,7 @@
8
- 44
+ 47
1
0
0
@@ -953,7 +989,7 @@
8
- 45
+ 48
1
0
0
@@ -965,7 +1001,7 @@
8
- 46
+ 49
1
0
0
@@ -977,7 +1013,7 @@
8
- 47
+ 50
1
0
0
@@ -989,7 +1025,7 @@
8
- 48
+ 51
1
0
0
@@ -1001,7 +1037,7 @@
8
- 49
+ 52
1
0
0
@@ -1013,7 +1049,7 @@
8
- 50
+ 53
1
0
0
@@ -1025,7 +1061,7 @@
8
- 51
+ 54
1
0
0
@@ -1037,7 +1073,7 @@
8
- 52
+ 55
1
0
0
@@ -1049,7 +1085,7 @@
8
- 53
+ 56
1
0
0
@@ -1069,7 +1105,7 @@
0
9
- 54
+ 57
1
0
0
@@ -1081,7 +1117,7 @@
9
- 55
+ 58
1
0
0
@@ -1093,7 +1129,7 @@
9
- 56
+ 59
1
0
0
@@ -1105,7 +1141,7 @@
9
- 57
+ 60
1
0
0
@@ -1117,7 +1153,7 @@
9
- 58
+ 61
1
0
0
@@ -1129,7 +1165,7 @@
9
- 59
+ 62
1
0
0
@@ -1149,7 +1185,7 @@
0
10
- 60
+ 63
1
0
0
@@ -1161,7 +1197,7 @@
10
- 61
+ 64
1
0
0
@@ -1173,7 +1209,7 @@
10
- 62
+ 65
1
0
0
@@ -1193,7 +1229,7 @@
0
11
- 63
+ 66
1
0
0
@@ -1205,7 +1241,7 @@
11
- 64
+ 67
1
0
0
@@ -1217,7 +1253,7 @@
11
- 65
+ 68
1
0
0
@@ -1237,7 +1273,7 @@
0
12
- 66
+ 69
1
0
0
diff --git a/app/app.uvprojx b/app/app.uvprojx
index 323e180..8de1eb1 100644
--- a/app/app.uvprojx
+++ b/app/app.uvprojx
@@ -1624,6 +1624,21 @@
1
..\sdk\modules\nrfx\drivers\src\nrfx_saadc.c
+
+ nrfx_spi.c
+ 1
+ ..\sdk\modules\nrfx\drivers\src\nrfx_spi.c
+
+
+ nrfx_spim.c
+ 1
+ ..\sdk\modules\nrfx\drivers\src\nrfx_spim.c
+
+
+ nrf_drv_spi.c
+ 1
+ ..\sdk\integration\nrfx\legacy\nrf_drv_spi.c
+
@@ -5303,6 +5318,21 @@
1
..\sdk\modules\nrfx\drivers\src\nrfx_saadc.c
+
+ nrfx_spi.c
+ 1
+ ..\sdk\modules\nrfx\drivers\src\nrfx_spi.c
+
+
+ nrfx_spim.c
+ 1
+ ..\sdk\modules\nrfx\drivers\src\nrfx_spim.c
+
+
+ nrf_drv_spi.c
+ 1
+ ..\sdk\integration\nrfx\legacy\nrf_drv_spi.c
+
diff --git a/app/config/sdk_config.h b/app/config/sdk_config.h
index 749e9c8..6c2f440 100644
--- a/app/config/sdk_config.h
+++ b/app/config/sdk_config.h
@@ -3542,7 +3542,7 @@
// NRFX_SPIM_ENABLED - nrfx_spim - SPIM peripheral driver
//==========================================================
#ifndef NRFX_SPIM_ENABLED
-#define NRFX_SPIM_ENABLED 0
+#define NRFX_SPIM_ENABLED 1
#endif
// NRFX_SPIM0_ENABLED - Enable SPIM0 instance
@@ -3768,7 +3768,7 @@
// NRFX_SPI_ENABLED - nrfx_spi - SPI peripheral driver
//==========================================================
#ifndef NRFX_SPI_ENABLED
-#define NRFX_SPI_ENABLED 0
+#define NRFX_SPI_ENABLED 1
#endif
// NRFX_SPI0_ENABLED - Enable SPI0 instance
@@ -5622,7 +5622,7 @@
// SPI_ENABLED - nrf_drv_spi - SPI/SPIM peripheral driver - legacy layer
//==========================================================
#ifndef SPI_ENABLED
-#define SPI_ENABLED 0
+#define SPI_ENABLED 1
#endif
// SPI_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority
@@ -5654,7 +5654,7 @@
// SPI0_ENABLED - Enable SPI0 instance
//==========================================================
#ifndef SPI0_ENABLED
-#define SPI0_ENABLED 0
+#define SPI0_ENABLED 1
#endif
// SPI0_USE_EASY_DMA - Use EasyDMA
diff --git a/app/main.c b/app/main.c
index 31756e9..a534728 100644
--- a/app/main.c
+++ b/app/main.c
@@ -72,13 +72,17 @@ static void test_tx_timer_cb(void* p_context) {
// data++;
// zdatachannel_data_send((uint8_t*)&data, &txlen);
- ZLOGI("adc channel %d %d", adc_module_heart_elect_channel_read_val(), adc_module_battery_channel_read_val());
+ // ZLOGI("adc channel %d %d", adc_module_heart_elect_channel_read_val(), adc_module_battery_channel_read_val());
+ ZLOGI("board_spi_transfer_test")
+ board_spi_transfer_test();
}
static void board_init() {
- adc_module_init();
- adc_module_battery_channel_init(NRF_SAADC_INPUT_VDD);
- adc_module_heart_elect_channel_init(NRF_SAADC_INPUT_AIN2);
+ // adc_module_init();
+ // adc_module_battery_channel_init(NRF_SAADC_INPUT_VDD);
+ // adc_module_heart_elect_channel_init(NRF_SAADC_INPUT_AIN2);
+
+ board_spi_init();
}
int main(void) {
diff --git a/app/src/board.c b/app/src/board.c
index a429f91..101504b 100644
--- a/app/src/board.c
+++ b/app/src/board.c
@@ -144,3 +144,41 @@ void adc_module_heart_elect_channel_init(nrf_saadc_input_t channelpin) {
ZERROR_CHECK(nrfx_saadc_channel_init(1, &channel_config));
}
int16_t adc_module_heart_elect_channel_read_val() { return adc_channel_read_val(1); }
+/*******************************************************************************
+ * SPI *
+ *******************************************************************************/
+#define SPI_MISO_PIN 31
+#define SPI_SS_PIN 20
+#define SPI_SCK_PIN 29
+#define SPI_MOSI_PIN 30
+static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(0); /**< SPI instance. */
+
+// static volatile bool m_spi_translate_done = false;
+// static void spi_event_handler(nrf_drv_spi_evt_t const* p_event, void* p_context) { m_spi_translate_done = true; }
+void board_spi_init() {
+ nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
+ spi_config.ss_pin = NRF_DRV_SPI_PIN_NOT_USED; // NRF_DRV_SPI_PIN_NOT_USED
+ spi_config.miso_pin = SPI_MISO_PIN;
+ spi_config.mosi_pin = SPI_MOSI_PIN;
+ spi_config.sck_pin = SPI_SCK_PIN;
+ ZERROR_CHECK(nrf_drv_spi_init(&spi, &spi_config, NULL, NULL));
+}
+ret_code_t board_spi_transfer(uint8_t const* p_tx_buffer, uint8_t tx_buffer_length, uint8_t* p_rx_buffer, uint8_t rx_buffer_length) {
+ // m_spi_translate_done = false;
+ ZERROR_CHECK(nrf_drv_spi_transfer(&spi, p_tx_buffer, tx_buffer_length, p_rx_buffer, rx_buffer_length));
+ // while (!m_spi_translate_done)
+ // ;
+ return NRF_SUCCESS;
+}
+
+ret_code_t board_spi_transfer_test() {
+ uint8_t tx_data[] = {0x01, 0x02, 0x03};
+ uint8_t rx_data[3];
+ ZERROR_CHECK(board_spi_transfer(tx_data, 3, rx_data, 3));
+}
+
+void screen_init() {}
+void screen_spi_translate_onebyte() {
+
+
+}
\ No newline at end of file
diff --git a/app/src/board.h b/app/src/board.h
index db22952..26c9a64 100644
--- a/app/src/board.h
+++ b/app/src/board.h
@@ -39,4 +39,15 @@ void adc_module_battery_channel_init(nrf_saadc_input_t channelpin);
int16_t adc_module_battery_channel_read_val();
void adc_module_heart_elect_channel_init(nrf_saadc_input_t channelpin);
-int16_t adc_module_heart_elect_channel_read_val();
\ No newline at end of file
+int16_t adc_module_heart_elect_channel_read_val();
+
+/*******************************************************************************
+ * SPI *
+ *******************************************************************************/
+
+void board_spi_init();
+ret_code_t board_spi_transfer(uint8_t const* p_tx_buffer, uint8_t tx_buffer_length, uint8_t* p_rx_buffer, uint8_t rx_buffer_length);
+ret_code_t board_spi_transfer_test();
+
+void screen_init();
+void screen_spi_translate_onebyte();
\ No newline at end of file
diff --git a/libznordic b/libznordic
index 5c809e7..dea8cb2 160000
--- a/libznordic
+++ b/libznordic
@@ -1 +1 @@
-Subproject commit 5c809e793ce8fc2f764a68f1eade7e59f39b1259
+Subproject commit dea8cb28511e92e1566da73974a24f74ec9bcab6