Skip to content

mikroSDK-2.15.0 #420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 97 commits into from
Aug 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
9a0fcf8
Renesas addition initial
esmaniksic Jun 3, 2025
7cd884a
Merge remote-tracking branch 'origin/master' into new-feature/ra4m1-s…
esmaniksic Jun 3, 2025
287df55
Revert unnecessary files
esmaniksic Jun 3, 2025
3113535
RA4M1 GPIO update
esmaniksic Jun 5, 2025
47d809a
GPIO update, port works
esmaniksic Jun 12, 2025
858b8ee
mcu_defs update
esmaniksic Jun 12, 2025
37069d1
GPIO ongoing, the test in SDK works
esmaniksic Jun 17, 2025
7db9600
Merge remote-tracking branch 'origin/master' into new-feature/ra4m1-s…
esmaniksic Jun 18, 2025
8c8323b
renesas low level update
esmaniksic Jun 19, 2025
0643842
pin names update
esmaniksic Jun 19, 2025
834d0a8
gpio update
esmaniksic Jun 26, 2025
a6cb9b6
gpio test wip
esmaniksic Jun 30, 2025
bfe5768
I2C write initial
esmaniksic Jul 3, 2025
cbba555
Merge remote-tracking branch 'origin/master' into new-feature/ra4m1-s…
esmaniksic Jul 3, 2025
0e95950
I2C update
esmaniksic Jul 7, 2025
4ab3baf
Added initial UART implementation -> RX works
IvanRuzavin Jul 10, 2025
bd815a9
Polling UART works -> interrupts TODO
IvanRuzavin Jul 10, 2025
fbf9551
Added startup info
Jul 10, 2025
85b5c04
Fully functional write and read
esmaniksic Jul 14, 2025
68b4ca4
removed line
esmaniksic Jul 14, 2025
0e19559
I2C removed hardcoded parts
esmaniksic Jul 16, 2025
9eba3a3
ADC initial commit (set for P000; works)
esmaniksic Jul 16, 2025
eeadcbc
Merge remote-tracking branch 'origin/master' into new-feature/ra4m1-uart
IvanRuzavin Jul 17, 2025
8d7bc32
adc update
esmaniksic Jul 17, 2025
6b14ddb
Merge remote-tracking branch 'origin/master' into new-feature/ra4m1-s…
esmaniksic Jul 21, 2025
4f91130
ADC implementation finished
esmaniksic Jul 21, 2025
2762099
RA4M1 PWM proof of concept
esmaniksic Jul 21, 2025
920e6e0
PWM ongoing
esmaniksic Jul 22, 2025
dddb26a
WIP -> interrupts still don't work
IvanRuzavin Jul 23, 2025
3f4c240
Merge remote-tracking branch 'origin/new-feature/ra4m1-sdk-support' i…
IvanRuzavin Jul 23, 2025
d804cd0
GPIO update
esmaniksic Jul 23, 2025
8cad41d
WIP update for SDK implementation
IvanRuzavin Jul 23, 2025
c499409
Merge remote-tracking branch 'origin/new-feature/ra4m1-sdk-support' i…
IvanRuzavin Jul 23, 2025
b04579d
WIP commit -> need to set baud rate dynamically
IvanRuzavin Jul 23, 2025
f461d2f
Finished polling UART and tested all features
IvanRuzavin Jul 24, 2025
3b01f6d
Reverted CMake changes
IvanRuzavin Jul 24, 2025
d3450ab
Reverted all common files that were changed
IvanRuzavin Jul 24, 2025
7edc762
Reverted all common files that were changed #2
IvanRuzavin Jul 24, 2025
91c4a74
Last changes for UART
IvanRuzavin Jul 24, 2025
565892a
Update targets/arm/mikroe/renesas/src/uart/implementation_1/hal_ll_ua…
esmaniksic Jul 24, 2025
cec4d40
Merge pull request #412 from MikroElektronika/new-feature/ra4m1-uart
IvanRuzavin Jul 24, 2025
0e66344
Functional PWM, more testing and prettifying needed
esmaniksic Jul 24, 2025
ee6691d
PWMc ode clean up and B pin test
esmaniksic Jul 24, 2025
8480bbe
Updated baud rate calculations for UART
IvanRuzavin Jul 29, 2025
32e2543
Merge pull request #416 from MikroElektronika/new-feature/ra4m1-uart
IvanRuzavin Jul 29, 2025
2ba6232
SPI done
esmaniksic Jul 29, 2025
2713068
I2C updated, ready for review
esmaniksic Jul 30, 2025
39f935f
comment fix
esmaniksic Jul 30, 2025
20ec401
PWM implementation improved, ready for review
esmaniksic Jul 30, 2025
763395b
Initial changelog added
esmaniksic Jul 30, 2025
f0b21b9
Merge branch 'mikrosdk-2.15.0' into new-feature/ra4m1-sdk-support
esmaniksic Jul 30, 2025
cba99aa
ADC improved
esmaniksic Jul 30, 2025
f10f255
SPI transfer improvements
esmaniksic Jul 30, 2025
d1bb0a0
UART interrupts -> need to set timings when to disable TE bit
IvanRuzavin Jul 30, 2025
d97107b
WIP -> need to make RX interrupt work
Jul 30, 2025
f33e558
1-Wire implementation added
esmaniksic Jul 31, 2025
b73fcad
Merge pull request #417 from MikroElektronika/fix/spi-transfer
StrahinjaJacimovic Jul 31, 2025
5920641
Merge remote-tracking branch 'origin/mikrosdk-2.15.0' into new-featur…
esmaniksic Aug 4, 2025
1d54022
removed rtc, can, dma
esmaniksic Aug 4, 2025
9018076
mcu defs added
esmaniksic Aug 4, 2025
bdac955
RA4M1 update
esmaniksic Aug 4, 2025
b2f5c5d
I2C read issue resolved
esmaniksic Aug 5, 2025
b9ca144
Pin maps update
esmaniksic Aug 5, 2025
9c24a53
Pin maps update
esmaniksic Aug 5, 2025
b43ccfb
pin maps update
esmaniksic Aug 5, 2025
14a15c1
bsp added
esmaniksic Aug 5, 2025
c5896fc
RX interrupt Works -> need to workaroung ORER
Aug 5, 2025
3d6ae36
GPIO description adjustment
esmaniksic Aug 6, 2025
cb1f460
Update targets/arm/mikroe/renesas/include/gpio/hal_ll_gpio.h
esmaniksic Aug 6, 2025
972fc26
Update targets/arm/mikroe/renesas/include/gpio/hal_ll_gpio.h
esmaniksic Aug 6, 2025
28ea464
Update targets/arm/mikroe/renesas/include/i2c/hal_ll_i2c_master.h
esmaniksic Aug 6, 2025
df10d17
Update targets/arm/mikroe/renesas/include/spi_master/hal_ll_spi_master.h
esmaniksic Aug 6, 2025
e1dbfdc
Update targets/arm/mikroe/renesas/include/spi_master/hal_ll_spi_master.h
esmaniksic Aug 6, 2025
7200795
Update targets/arm/mikroe/renesas/include/uart/hal_ll_uart.h
esmaniksic Aug 6, 2025
5cecc99
Update targets/arm/mikroe/renesas/src/gpio/hal_ll_gpio.c
esmaniksic Aug 6, 2025
02c03da
Update targets/arm/mikroe/renesas/src/i2c/implementation_1/hal_ll_i2c…
esmaniksic Aug 6, 2025
31d40d2
WOW RX works
IvanRuzavin Aug 6, 2025
8e26b82
tests folder update
esmaniksic Aug 6, 2025
b012e7a
ring comment
esmaniksic Aug 6, 2025
a4cc5dc
Merge pull request #418 from MikroElektronika/new-feature/ra4m1-sdk-s…
esmaniksic Aug 6, 2025
a68df90
Merge remote-tracking branch 'origin/master' into mikrosdk-2.15.0
esmaniksic Aug 6, 2025
4be1145
version update
esmaniksic Aug 6, 2025
57d2921
Finished prettyfying the UART code
IvanRuzavin Aug 6, 2025
0ce9108
Removed mcu.h from low level
IvanRuzavin Aug 6, 2025
afe6e19
Minor fixes
IvanRuzavin Aug 6, 2025
03f812d
Minor fixes #2
IvanRuzavin Aug 6, 2025
d1634ef
Added mcu defs
IvanRuzavin Aug 6, 2025
54fd411
Merge remote-tracking branch 'origin/mikrosdk-2.15.0' into new-featur…
IvanRuzavin Aug 6, 2025
63cf83a
Fixed mcu defs
IvanRuzavin Aug 6, 2025
f30cff4
Added mcu_reg_addresses for all RA4M1 MCUs
IvanRuzavin Aug 6, 2025
52ed47a
Merge pull request #421 from MikroElektronika/new-feature/ra4m1-uart
esmaniksic Aug 6, 2025
1ab014e
Tested Dual-Mode for UART
IvanRuzavin Aug 6, 2025
7e60d98
Merge remote-tracking branch 'origin/mikrosdk-2.15.0' into new-featur…
IvanRuzavin Aug 6, 2025
73bd8e1
Update targets/arm/mikroe/core/include/hal_ll_core_defines.h
esmaniksic Aug 6, 2025
9c0e705
Merge pull request #422 from MikroElektronika/new-feature/ra4m1-uart
esmaniksic Aug 6, 2025
c5e3a80
Fixes before release
IvanRuzavin Aug 6, 2025
22b1fc9
Merge pull request #423 from MikroElektronika/new-feature/ra4m1-uart
esmaniksic Aug 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions bsp/board/include/boards/clicker_ra4m1/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,39 @@ extern "C"
{
#endif

// Hardware revision number
#define BOARD_REV_MAJOR (1)
#define BOARD_REV_MINOR (01)

#define BOARD_NAME "RA4M1 Clicker"

// Mapping
// Only Bare Metal support is available at the moment
#include "mikrobus.h"

/// Mapping
#define MIKROBUS_1 1
#define MIKROBUS_1_AN GPIO_P000
#define MIKROBUS_1_RST GPIO_P407
#define MIKROBUS_1_CS GPIO_P103
#define MIKROBUS_1_SCK GPIO_P102
#define MIKROBUS_1_MISO GPIO_P100
#define MIKROBUS_1_MOSI GPIO_P101
#define MIKROBUS_1_PWM GPIO_P107
#define MIKROBUS_1_INT GPIO_P302
#define MIKROBUS_1_RX GPIO_P410
#define MIKROBUS_1_TX GPIO_P411
#define MIKROBUS_1_SCL GPIO_P205
#define MIKROBUS_1_SDA GPIO_P206

// LEDs
#define LED_1 GPIO_P409
#define LED_2 GPIO_P408

// Buttons
#define BUTTON_1 GPIO_P304
#define BUTTON_2 GPIO_P301

#define USB_UART_TX HAL_PIN_NC
#define USB_UART_RX HAL_PIN_NC

#ifdef __cplusplus
}
Expand Down
68 changes: 68 additions & 0 deletions changelog/v2.15.0/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<p align="center">
<img src="http://www.mikroe.com/img/designs/beta/logo_small.png?raw=true" alt="MikroElektronika"/>
</p>

---

**[BACK TO MAIN FILE](../../changelog.md)**

---

# `v2.15.0`

+ released: 2025-08-07

## Changes

- [`v2.15.0`](#v2150)
- [Changes](#changes)
- [RENESAS](#renesas)
- [Fixes](#fixes)
- [mikroSDK](#mikrosdk)
- [NEW HARDWARE](#new-hardware)

### <font color=red>RENESAS</font>

**RA4M1 MCUs supported!**

| MCU |
| :------------: |
| R7FA4M1AB3CFP |
| R7FA4M1AB2CLJ |
| R7FA4M1AB3CFM |
| R7FA4M1AB3CNB |
| R7FA4M1AB3CFL |
| R7FA4M1AB3CNE |
| R7FA4M1AB3CNF |

**Supported modules:**

+ ADC (Full module support)
+ SPI (Full module support)
+ UART (Full module support)
+ I2C (Full module support)
+ PWM (Full module support)
+ GPIO (Full module support)
+ 1-Wire (Full module support)

### Fixes

#### mikroSDK

- Fixed the build issue for MCUs STM32C011J6 and STM32C011J4
- Now setups with these MCUs can be successfully created
- SPI transfer API is now also available for the 157 MCUs with AI generated SDK support
- Minor fixes and improvements regarding the SPI transfer API implementation

### NEW HARDWARE

> NOTE:
>> If any new hardware was added to current version, it will be listed here.

Support added for following hardware:

---

**[BACK TO MAIN FILE](../../changelog.md)**

---
4 changes: 3 additions & 1 deletion cmake/utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ function(find_chip_architecture _chip_architecture)
set(${_chip_architecture} "arm" PARENT_SCOPE)
elseif(${MCU_NAME} MATCHES "^(AT)?SAM.*")
set(${_chip_architecture} "arm" PARENT_SCOPE)
elseif(${MCU_NAME} MATCHES "^R7.*")
set(${_chip_architecture} "arm" PARENT_SCOPE)
else()
set(${_chip_architecture} "UNSUPPORTED_CHIP_SELECTED_FOR_FOLLOWING_IMPLEMENTATION" PARENT_SCOPE)
endif()
Expand Down Expand Up @@ -616,7 +618,7 @@ endfunction()
function(core_implementation_select mcu core_implementation)
find_chip_architecture(chip_architecture)
if(${chip_architecture} STREQUAL "arm")
if(${mcu} MATCHES "(^STM32.*)|(^MK.*)|(^TM4C.*)|(^(AT)?SAM.*)")
if(${mcu} MATCHES "(^STM32.*)|(^MK.*)|(^TM4C.*)|(^(AT)?SAM.*|(^R7F.+))")
set(${core_implementation} "core/implementation_1/hal_ll_core.c" PARENT_SCOPE)
else()
set(${core_implementation} "core/implementation_2/hal_ll_core.c" PARENT_SCOPE)
Expand Down
10 changes: 5 additions & 5 deletions drv/lib/src/lib_drv_spi_master/drv_spi_master.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@ err_t spi_master_transfer( spi_master_t *obj, uint8_t *write_data_buffer,
if ( _acquire( obj, false ) != ACQUIRE_FAIL ) {
#if DRV_TO_HAL
return hal_spi_master_transfer( &obj->handle, write_data_buffer,
read_data_buffer,
data_length );
read_data_buffer,
data_length );
#else
hal_spi_master_handle_register_t *hal_handle = ( hal_spi_master_handle_register_t* )hal_is_handle_null( (handle_t *)&obj->handle );
err_t hal_status = HAL_SPI_MASTER_SUCCESS;
Expand Down Expand Up @@ -468,9 +468,9 @@ err_t spi_master_transfer( spi_master_t *obj, uint8_t *write_data_buffer,
hal_handle->init_state = true;
}

hal_status = hal_spi_master_transfer( (handle_t *)&hal_handle, write_data_buffer,
read_data_buffer,
data_length );
hal_status = hal_ll_spi_master_transfer( (handle_t *)&hal_handle, write_data_buffer,
read_data_buffer,
data_length );

if (hal_status == HAL_SPI_MASTER_MODULE_ERROR)
{
Expand Down
2 changes: 2 additions & 0 deletions hal/interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ elseif(${MCU_NAME} MATCHES "(^MK(.+)$)")
set(vendor_id "nxp")
elseif(${MCU_NAME} MATCHES "(^TM4C1(.+)$)")
set(vendor_id "tiva")
elseif(${MCU_NAME} MATCHES "(^R7(.+)$)")
set(vendor_id "renesas")
elseif(${MCU_NAME} MATCHES "(^PIC32(.+)$)")
set(vendor_id "pic32")
elseif(${MCU_NAME} MATCHES "(^PIC18(.+)$)")
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"display-name": "mikroSDK",
"description": "MikroSDK 2.0 is an embedded software development framework designed to simplify and accelerate application development on Mikroe hardware platform, specifically for Click Boards and other extension board drivers, on a broad range of microcontroller vendors and architectures. It includes peripheral libraries and drivers, middleware, board support, and application layer libraries among others.",
"icon": "images/icon-mikroSDK.png",
"manifest-version": "1.0.28"
"manifest-version": "1.0.29"
}
4 changes: 2 additions & 2 deletions platform/mikrosdk_version/include/mikrosdk_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ extern "C"{
* @note changes in minor version indicate that there have been
* significant improvements and/or features added
*/
#define mikroSDK_MINOR_VERSION 14
#define mikroSDK_MINOR_VERSION 15

/**
* @brief mikroSDK_PATCH_VERSION
* @note changes in patch version indicate smaller updates,
* bug fixes and improvements
*/
#define mikroSDK_PATCH_VERSION 6
#define mikroSDK_PATCH_VERSION 0

/**
* @brief mikroSDK_GET_VERSION
Expand Down
4 changes: 4 additions & 0 deletions platform/ring/lib/src/ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ bool ring_buf8_push( ring_buf8_t *ring, uint8_t data_ )
uint8_t ring_buf8_pop( ring_buf8_t *ring )
{
uint8_t result;

// GCC & Clang compiler files for Renesas are not included into the project.
#if ( vendor != renesas )
assert( ring->size > 0 );
#endif

result = ring->buffer[ ring->tail ];
ring->tail = ( ring->tail + 1 ) % ring->capacity;
Expand Down
2 changes: 2 additions & 0 deletions targets/arm/mikroe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ elseif(${MCU_NAME} MATCHES "(^MK(.+)$)")
elseif(${MCU_NAME} MATCHES "(^TM4C1(.+)$)")
## TIVA has only the 71 MCUs already implemented
set(vendor_id "tiva")
elseif(${MCU_NAME} MATCHES "(^R7(.+)$)")
set(vendor_id "renesas")
elseif(${MCU_NAME} MATCHES "(^(AT)?SAM(.+)$)")
set(vendor_id "sam")
else()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,31 @@ hal_ll_err_t hal_ll_spi_master_read( handle_t *handle, uint8_t *read_data_buffer
*/
hal_ll_err_t hal_ll_spi_master_write_then_read( handle_t *handle, uint8_t *write_data_buffer, size_t length_write_data, uint8_t *read_data_buffer, size_t length_read_data );

/**
* @brief Performs simultaneous write and read on SPI bus.
*
* Executes a full-duplex SPI transfer. While writing `write_data_buffer`,
* the incoming bytes from the SPI slave are placed into `read_data_buffer`.
* This function is suitable for devices that require simultaneous
* transmission and reception.
*
* @param[in] handle HAL context object handle.
* @param[in] write_data_buffer Pointer to data to be written to the bus.
* @param[out] read_data_buffer Pointer to buffer where read data will be stored.
* @param[in] data_length Number of bytes to transfer.
*
* @return hal_ll_err_t Returns #HAL_LL_SPI_MASTER_SUCCESS on success,
* otherwise returns #HAL_LL_SPI_MASTER_MODULE_ERROR
* if handle is invalid or data_length is 0.
*
* @note This function assumes the SPI module is already initialized via
* #hal_ll_spi_master_register_handle and #hal_ll_module_configure_spi.
*/
hal_ll_err_t hal_ll_spi_master_transfer( handle_t *handle,
uint8_t *write_data_buffer,
uint8_t *read_data_buffer,
size_t data_length );

/**
* @brief Closes SPI Master HAL and HAL_LOW_LEVEL context object.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,29 @@ static void hal_ll_spi_master_write_bare_metal(hal_ll_spi_master_base_handle_t *
*/
hal_ll_err_t hal_ll_spi_master_write_then_read(handle_t *handle, uint8_t *write_data_buffer, size_t length_write_data, uint8_t *read_data_buffer, size_t length_read_data);

/**
* @brief Perform a simultaneous write and read on the SPI Master bus.
*
* Function performs a full-duplex SPI transfer. Each written byte results in
* a received byte which is optionally stored in the read buffer.
* If the write buffer is NULL, the configured dummy byte will be transmitted.
* If the read buffer is NULL, the received data will be discarded.
*
* @param[in] *map - Object specific context handler.
* @param[in] *write_data_buffer - Pointer to write data buffer.
* If NULL, dummy data will be used.
* @param[out] *read_data_buffer - Pointer to read data buffer.
* If NULL, received data will be discarded.
* @param[in] data_length - Number of bytes to be transferred.
*
* @note TX FIFO is flushed and re-enabled on each byte transfer to ensure proper behavior.
* This implementation uses polling and is blocking.
*/
static void hal_ll_spi_master_transfer_bare_metal ( hal_ll_spi_master_hw_specifics_map_t *map,
uint8_t *write_data_buffer,
uint8_t *read_data_buffer,
size_t data_length );

/**
* @brief Maps new-found module specific values.
*
Expand Down Expand Up @@ -408,6 +431,29 @@ hal_ll_err_t hal_ll_spi_master_write_then_read(handle_t *handle, uint8_t *write_
return HAL_LL_SPI_MASTER_SUCCESS;
}

hal_ll_err_t hal_ll_spi_master_transfer(handle_t *handle,
uint8_t *write_data_buffer,
uint8_t *read_data_buffer,
size_t data_length) {
low_level_handle = hal_ll_spi_master_get_handle;
hal_ll_spi_master_hw_specifics_map_local = hal_ll_get_specifics(hal_ll_spi_master_get_module_state_address);

if (NULL == low_level_handle->hal_ll_spi_master_handle) {
return HAL_LL_SPI_MASTER_MODULE_ERROR;
}

if (!hal_ll_spi_master_hw_specifics_map_local || !data_length) {
return HAL_LL_SPI_MASTER_MODULE_ERROR;
}

hal_ll_spi_master_transfer_bare_metal(hal_ll_spi_master_hw_specifics_map_local,
write_data_buffer,
read_data_buffer,
data_length);

return HAL_LL_SPI_MASTER_SUCCESS;
}

uint32_t hal_ll_spi_master_set_speed(handle_t *handle, uint32_t speed) {
// Get low level HAL handle.
low_level_handle = hal_ll_spi_master_get_handle;
Expand Down Expand Up @@ -479,7 +525,7 @@ void hal_ll_spi_master_close(handle_t* handle) {

// ----------------------------------------------- PRIVATE FUNCTION DEFINITIONS

uint8_t hal_ll_spi_master_transfer_bare_metal(hal_ll_spi_master_base_handle_t *hal_ll_hw_reg, uint8_t data_buffer) {
uint8_t hal_ll_spi_master_transfer_byte_bare_metal(hal_ll_spi_master_base_handle_t *hal_ll_hw_reg, uint8_t data_buffer) {
// Write user-defined data ( 'hal_ll_spi_master_read_bare_metal' procedure will send dummy data ).
*((volatile uint8_t *)&hal_ll_hw_reg->dr) = (uint8_t)data_buffer; // 8-bit data

Expand All @@ -496,7 +542,7 @@ static void hal_ll_spi_master_write_bare_metal( hal_ll_spi_master_base_handle_t
// Write the first data to be transmitted into the SPI_DR register.
for(transfer_counter = 0; transfer_counter < write_data_length; transfer_counter++) {
// If we are good to go ( if the tx buffer value has been shifted to the shift register ), write the data.
hal_ll_spi_master_transfer_bare_metal( hal_ll_hw_reg, write_data_buffer[transfer_counter]);
hal_ll_spi_master_transfer_byte_bare_metal( hal_ll_hw_reg, write_data_buffer[transfer_counter]);
}
}

Expand All @@ -506,7 +552,23 @@ static void hal_ll_spi_master_read_bare_metal(hal_ll_spi_master_base_handle_t *h
// Read the first data to be transmitted into the SPI_DR register.
for(transfer_counter = 0; transfer_counter < read_data_length; transfer_counter++) {
// If we are good to go ( if the value from shift register has been shifted to the rx register ), read the data.
read_data_buffer[transfer_counter] = hal_ll_spi_master_transfer_bare_metal(hal_ll_hw_reg, dummy_data);
read_data_buffer[transfer_counter] = hal_ll_spi_master_transfer_byte_bare_metal(hal_ll_hw_reg, dummy_data);
}
}

static void hal_ll_spi_master_transfer_bare_metal ( hal_ll_spi_master_hw_specifics_map_t *map,
uint8_t *write_data_buffer,
uint8_t *read_data_buffer,
size_t data_length ) {
hal_ll_spi_master_base_handle_t *hal_ll_hw_reg = (hal_ll_spi_master_base_handle_t *)map->base;

for (size_t i = 0; i < data_length; i++) {
uint8_t tx_data = write_data_buffer ? write_data_buffer[i] : map->dummy_data;
uint8_t rx_data = hal_ll_spi_master_transfer_byte_bare_metal(hal_ll_hw_reg, tx_data);

if (read_data_buffer) {
read_data_buffer[i] = rx_data;
}
}
}

Expand Down
Loading