From f6be7613795121b8c3372970d198a7f6372fa982 Mon Sep 17 00:00:00 2001 From: strahi-linux Date: Tue, 10 Dec 2024 14:31:43 +0100 Subject: [PATCH] Updated TODO-s --- .../spi_master/implementation_2/hal_ll_spi_master.c | 12 ++++++++---- .../pic18/src/tim/implementation_2/hal_ll_tim.c | 7 ++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/targets/pic_8bit/mikroe/pic18/src/spi_master/implementation_2/hal_ll_spi_master.c b/targets/pic_8bit/mikroe/pic18/src/spi_master/implementation_2/hal_ll_spi_master.c index 27b17f90e..cc2e673ca 100644 --- a/targets/pic_8bit/mikroe/pic18/src/spi_master/implementation_2/hal_ll_spi_master.c +++ b/targets/pic_8bit/mikroe/pic18/src/spi_master/implementation_2/hal_ll_spi_master.c @@ -600,9 +600,11 @@ static uint8_t hal_ll_spi_master_transfer_bare_metal(hal_ll_spi_master_hw_specif set_reg_bit(hal_ll_hw_reg->hal_ll_spi1_con2_reg_addr, HAL_LL_SPI_MASTER_SPI1CON2_RXR); // Write user-defined data ('hal_ll_spi_master_read_bare_metal' procedure will send dummy data). - // TODO - Check if this works - // *((volatile uint8_t *)hal_ll_hw_reg->hal_ll_spi1_txb_reg_addr) = (uint8_t)data_buffer; + #ifdef __XC8__ write_reg(hal_ll_hw_reg->hal_ll_spi1_txb_reg_addr, data_buffer); + #else + *((volatile uint8_t *)hal_ll_hw_reg->hal_ll_spi1_txb_reg_addr) = (uint8_t)data_buffer; + #endif // Wait for transfer counter to be decremented to zero. while (!(check_reg_bit(hal_ll_hw_reg->hal_ll_spi1_intf_reg_addr , HAL_LL_SPI_MASTER_SPI1INTF_TCZIF))); @@ -617,9 +619,11 @@ static uint8_t hal_ll_spi_master_transfer_bare_metal(hal_ll_spi_master_hw_specif clear_reg_bit(hal_ll_hw_reg->hal_ll_spi1_intf_reg_addr, HAL_LL_SPI_MASTER_SPI1INTF_SRMTIF); // Return read data. - // TODO - Check if this works - // return *((volatile uint8_t *)hal_ll_hw_reg->hal_ll_spi1_rxb_reg_addr); + #ifdef __XC8__ return read_reg(hal_ll_hw_reg->hal_ll_spi1_rxb_reg_addr); + #else + return *((volatile uint8_t *)hal_ll_hw_reg->hal_ll_spi1_rxb_reg_addr); + #endif } static void hal_ll_spi_master_write_bare_metal(hal_ll_spi_master_hw_specifics_map_t *map, uint8_t * __generic_ptr write_data_buffer, size_t write_data_length) { diff --git a/targets/pic_8bit/mikroe/pic18/src/tim/implementation_2/hal_ll_tim.c b/targets/pic_8bit/mikroe/pic18/src/tim/implementation_2/hal_ll_tim.c index d42f6761c..de7abc3a6 100644 --- a/targets/pic_8bit/mikroe/pic18/src/tim/implementation_2/hal_ll_tim.c +++ b/targets/pic_8bit/mikroe/pic18/src/tim/implementation_2/hal_ll_tim.c @@ -556,15 +556,16 @@ hal_ll_err_t hal_ll_tim_set_duty( handle_t *handle, float duty_ratio ) { tmp_duty = duty_ratio * 100; tmp_max_period = hal_ll_tim_hw_specifics_map_local->max_period; - // TODO - Check if this works _convert_8bit_to_10bit( tmp_max_period, max_period ); max_duty = ( ( float )max_period / 100 ) * tmp_duty; - // *( uint16_t * )hal_ll_hw_reg->hal_ccprl_reg_addr = max_duty; - // TODO - Check if this works + #ifdef __XC8__ write_reg(hal_ll_hw_reg->hal_ccprl_reg_addr, max_duty & 0xFF); write_reg(hal_ll_hw_reg->hal_ccprl_reg_addr, (max_duty & 0xFF00) >> 8); + #else + *( uint16_t * )hal_ll_hw_reg->hal_ccprl_reg_addr = max_duty; + #endif return HAL_LL_TIM_SUCCESS; }