@ -35,10 +35,7 @@
# define MAX_PORT_B_PIN_NO 15
# define MAX_PORT_B_PIN_NO 15
# define MAX_PORT_F_PIN_NO 1
# define MAX_PORT_F_PIN_NO 1
/*! Pin number typedef enum. It contains all the available pins */
typedef enum
typedef enum
{
{
// NAME = BASE ADDR | PORT | PIN NO
// NAME = BASE ADDR | PORT | PIN NO
@ -72,11 +69,16 @@ typedef enum
pinF1 = 0x20 | 1 /*!< Port: F Pin: 1 -> Port F Mask | Pin Mask */
pinF1 = 0x20 | 1 /*!< Port: F Pin: 1 -> Port F Mask | Pin Mask */
} pinNo_t ;
} pinNo_t ;
/**List of all possible port base addresses. This is used for the funcionality of of pin.h*/
static const uint32_t portBase_Addr_List [ MAX_N_PORTS_COUNT ] = {
static const uint32_t portBase_Addr_List [ MAX_N_PORTS_COUNT ] = {
GPIOA_BASE ,
GPIOA_BASE , //!< Base address Port A
GPIOB_BASE ,
GPIOB_BASE , //!< Base address Port B
GPIOF_BASE } ;
GPIOF_BASE //!< Base address Port F
} ;
/*! This is a bitmap list of all possible alternative functions for each pin.
* 1 means that there is an alternative function available and 0 for none . Tis is used
* for the functionality in pin . h */
static const uint8_t altFunc_List [ MAX_N_PORTS_COUNT ] [ MAX_PORT_PINS_COUNT ] = {
static const uint8_t altFunc_List [ MAX_N_PORTS_COUNT ] [ MAX_PORT_PINS_COUNT ] = {
{ // PORT A
{ // PORT A
0 b01110000 , //PA0
0 b01110000 , //PA0
@ -135,7 +137,10 @@ static const uint8_t altFunc_List[MAX_N_PORTS_COUNT][MAX_PORT_PINS_COUNT] = {
} ;
} ;
/*! Enum for awailable timer DS Page: 12 (block diagaram) The order of the enums is very important and should not be changed as it is used ofr table indexing */
/**
* Enum for awailable timer DS Page : 12 ( block diagaram ) The order of the enums is very important
* and should not be changed as it is used ofr table indexing
* */
typedef enum {
typedef enum {
timer_1 , /*!< Advanced control 16-bit timer with PWM capability RM Page: 320 */
timer_1 , /*!< Advanced control 16-bit timer with PWM capability RM Page: 320 */
timer_2 , /*!< General purpose 32-bit timer RM Page: 393 */
timer_2 , /*!< General purpose 32-bit timer RM Page: 393 */
@ -145,7 +150,9 @@ typedef enum {
timer_17 /*!< General purpose 16-bit timer RM Page: 480 */
timer_17 /*!< General purpose 16-bit timer RM Page: 480 */
} timerNo_t ;
} timerNo_t ;
/*! Enum for awailable clok sources RM Page: 95 */
/**
* Enum for awailable clok sources RM Page : 95
* */
typedef enum {
typedef enum {
HSI , /*!< High speed internal */
HSI , /*!< High speed internal */
HSE , /*!< High speed external */
HSE , /*!< High speed external */
@ -153,6 +160,9 @@ typedef enum {
LSE /*!< Low speed External */
LSE /*!< Low speed External */
} clkSources_t ;
} clkSources_t ;
/**
* Timer base addresslist of all available timers
* */
static const uint32_t timerBase_Addr_List [ MAX_TIMER_CHANNEL_COUNT ] = {
static const uint32_t timerBase_Addr_List [ MAX_TIMER_CHANNEL_COUNT ] = {
TIM1_BASE ,
TIM1_BASE ,
TIM2_BASE ,
TIM2_BASE ,
@ -162,6 +172,9 @@ static const uint32_t timerBase_Addr_List[MAX_TIMER_CHANNEL_COUNT] = {
TIM17_BASE
TIM17_BASE
} ;
} ;
/**
* RCC clock enabcke bit position for the given register
* */
static const uint8_t timerBus_En_bitPos [ MAX_TIMER_CHANNEL_COUNT ] = {
static const uint8_t timerBus_En_bitPos [ MAX_TIMER_CHANNEL_COUNT ] = {
RCC_APB2ENR_TIM1EN_Pos ,
RCC_APB2ENR_TIM1EN_Pos ,
RCC_APB1ENR_TIM2EN_Pos ,
RCC_APB1ENR_TIM2EN_Pos ,