Extract PIT related macros to the newly created peripherals/pit.h
This commit is contained in:
@@ -30,7 +30,7 @@ void PIT_I2C_WATCHDOG_HANDLER(void)
|
|||||||
|
|
||||||
prevWatchdogCounter = I2C_Watchdog;
|
prevWatchdogCounter = I2C_Watchdog;
|
||||||
|
|
||||||
PIT_ClearStatusFlags(PIT, kPIT_Chnl_0, PIT_TFLG_TIF_MASK);
|
PIT_ClearStatusFlags(PIT, PIT_I2C_WATCHDOG_CHANNEL, PIT_TFLG_TIF_MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitI2cWatchdog(void)
|
void InitI2cWatchdog(void)
|
||||||
@@ -38,8 +38,8 @@ void InitI2cWatchdog(void)
|
|||||||
pit_config_t pitConfig;
|
pit_config_t pitConfig;
|
||||||
PIT_GetDefaultConfig(&pitConfig);
|
PIT_GetDefaultConfig(&pitConfig);
|
||||||
PIT_Init(PIT, &pitConfig);
|
PIT_Init(PIT, &pitConfig);
|
||||||
PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, USEC_TO_COUNT(I2C_WATCHDOG_INTERVAL_USEC, PIT_SOURCE_CLOCK));
|
PIT_SetTimerPeriod(PIT, PIT_I2C_WATCHDOG_CHANNEL, USEC_TO_COUNT(I2C_WATCHDOG_INTERVAL_USEC, PIT_SOURCE_CLOCK));
|
||||||
PIT_EnableInterrupts(PIT, kPIT_Chnl_0, kPIT_TimerInterruptEnable);
|
PIT_EnableInterrupts(PIT, PIT_I2C_WATCHDOG_CHANNEL, kPIT_TimerInterruptEnable);
|
||||||
EnableIRQ(PIT_I2C_WATCHDOG_IRQ_ID);
|
EnableIRQ(PIT_I2C_WATCHDOG_IRQ_ID);
|
||||||
PIT_StartTimer(PIT, kPIT_Chnl_0);
|
PIT_StartTimer(PIT, PIT_I2C_WATCHDOG_CHANNEL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
#ifndef __I2C_WATCHDOG_H__
|
#ifndef __I2C_WATCHDOG_H__
|
||||||
#define __I2C_WATCHDOG_H__
|
#define __I2C_WATCHDOG_H__
|
||||||
|
|
||||||
|
// Includes:
|
||||||
|
|
||||||
|
#include "peripherals/pit.h"
|
||||||
|
|
||||||
// Macros:
|
// Macros:
|
||||||
|
|
||||||
#define I2C_WATCHDOG_INTERVAL_USEC 100000
|
#define I2C_WATCHDOG_INTERVAL_USEC 100000
|
||||||
|
|
||||||
#define PIT_I2C_WATCHDOG_HANDLER PIT0_IRQHandler
|
|
||||||
#define PIT_I2C_WATCHDOG_IRQ_ID PIT0_IRQn
|
|
||||||
#define PIT_SOURCE_CLOCK CLOCK_GetFreq(kCLOCK_BusClk)
|
|
||||||
|
|
||||||
// Variables:
|
// Variables:
|
||||||
|
|
||||||
extern uint32_t I2cWatchdog_RecoveryCounter;
|
extern uint32_t I2cWatchdog_RecoveryCounter;
|
||||||
|
|||||||
@@ -3,17 +3,13 @@
|
|||||||
|
|
||||||
// Includes:
|
// Includes:
|
||||||
|
|
||||||
|
#include "peripherals/pit.h"
|
||||||
#include "right_key_matrix.h"
|
#include "right_key_matrix.h"
|
||||||
|
|
||||||
// Macros:
|
// Macros:
|
||||||
|
|
||||||
#define KEY_SCANNER_INTERVAL_USEC (1000 / RIGHT_KEY_MATRIX_ROWS_NUM)
|
#define KEY_SCANNER_INTERVAL_USEC (1000 / RIGHT_KEY_MATRIX_ROWS_NUM)
|
||||||
|
|
||||||
#define PIT_KEY_SCANNER_HANDLER PIT1_IRQHandler
|
|
||||||
#define PIT_KEY_SCANNER_IRQ_ID PIT1_IRQn
|
|
||||||
#define PIT_KEY_SCANNER_CHANNEL kPIT_Chnl_1
|
|
||||||
#define PIT_SOURCE_CLOCK CLOCK_GetFreq(kCLOCK_BusClk)
|
|
||||||
|
|
||||||
// Functions:
|
// Functions:
|
||||||
|
|
||||||
void InitKeyScanner(void);
|
void InitKeyScanner(void);
|
||||||
|
|||||||
16
right/src/peripherals/pit.h
Normal file
16
right/src/peripherals/pit.h
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#ifndef __PIT_H__
|
||||||
|
#define __PIT_H__
|
||||||
|
|
||||||
|
// Macros:
|
||||||
|
|
||||||
|
#define PIT_SOURCE_CLOCK CLOCK_GetFreq(kCLOCK_BusClk)
|
||||||
|
|
||||||
|
#define PIT_I2C_WATCHDOG_HANDLER PIT0_IRQHandler
|
||||||
|
#define PIT_I2C_WATCHDOG_IRQ_ID PIT0_IRQn
|
||||||
|
#define PIT_I2C_WATCHDOG_CHANNEL kPIT_Chnl_0
|
||||||
|
|
||||||
|
#define PIT_KEY_SCANNER_HANDLER PIT1_IRQHandler
|
||||||
|
#define PIT_KEY_SCANNER_IRQ_ID PIT1_IRQn
|
||||||
|
#define PIT_KEY_SCANNER_CHANNEL kPIT_Chnl_1
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user