Skip to content

Commit

Permalink
Updated TODO-s
Browse files Browse the repository at this point in the history
  • Loading branch information
StrahinjaJacimovic committed Dec 10, 2024
1 parent 00a99d2 commit f6be761
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f6be761

Please sign in to comment.