summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/usbd_cdc_interface.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-03-22 18:34:16 +0000
committerDamien George <damien.p.george@gmail.com>2014-03-22 18:34:16 +0000
commit0119fc7532c573bd596fb6173b4d36ef5260027a (patch)
tree34b58be58b793d55b8c08ddd36608bef9b4823f7 /stmhal/usbd_cdc_interface.c
parent626f6b813375a2a67d110cf8f240fe829d5887e4 (diff)
downloadmicropython-0119fc7532c573bd596fb6173b4d36ef5260027a.tar.gz
micropython-0119fc7532c573bd596fb6173b4d36ef5260027a.zip
stmhal: Servo driver can move at a given speed.
Diffstat (limited to 'stmhal/usbd_cdc_interface.c')
-rw-r--r--stmhal/usbd_cdc_interface.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/stmhal/usbd_cdc_interface.c b/stmhal/usbd_cdc_interface.c
index 5116ce860e..e190e34793 100644
--- a/stmhal/usbd_cdc_interface.c
+++ b/stmhal/usbd_cdc_interface.c
@@ -66,7 +66,7 @@ static int user_interrupt_char = VCP_CHAR_NONE;
static void *user_interrupt_data = NULL;
/* TIM handler declaration */
-TIM_HandleTypeDef USBD_CDC_TimHandle;
+TIM_HandleTypeDef USBD_CDC_TIM3_Handle;
/* USB handler declaration */
extern USBD_HandleTypeDef hUSBDDevice;
@@ -132,7 +132,7 @@ static int8_t CDC_Itf_Init(void)
/*##-4- Start the TIM Base generation in interrupt mode ####################*/
/* Start Channel1 */
- if(HAL_TIM_Base_Start_IT(&USBD_CDC_TimHandle) != HAL_OK)
+ if(HAL_TIM_Base_Start_IT(&USBD_CDC_TIM3_Handle) != HAL_OK)
{
/* Starting Error */
}
@@ -250,8 +250,7 @@ static int8_t CDC_Itf_Control(uint8_t cmd, uint8_t* pbuf, uint16_t length) {
* @param htim: TIM handle
* @retval None
*/
-void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
-{
+void USBD_CDC_HAL_TIM_PeriodElapsedCallback(void) {
uint32_t buffptr;
uint32_t buffsize;
@@ -388,7 +387,7 @@ int USBD_CDC_RxGet(void) {
static void TIM_Config(void)
{
/* Set TIMx instance */
- USBD_CDC_TimHandle.Instance = USBD_CDC_TIMx;
+ USBD_CDC_TIM3_Handle.Instance = USBD_CDC_TIMx;
/* Initialize TIM3 peripheral as follow:
+ Period = 10000 - 1
@@ -396,11 +395,11 @@ static void TIM_Config(void)
+ ClockDivision = 0
+ Counter direction = Up
*/
- USBD_CDC_TimHandle.Init.Period = (USBD_CDC_POLLING_INTERVAL*1000) - 1;
- USBD_CDC_TimHandle.Init.Prescaler = 84-1;
- USBD_CDC_TimHandle.Init.ClockDivision = 0;
- USBD_CDC_TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
- if(HAL_TIM_Base_Init(&USBD_CDC_TimHandle) != HAL_OK)
+ USBD_CDC_TIM3_Handle.Init.Period = (USBD_CDC_POLLING_INTERVAL*1000) - 1;
+ USBD_CDC_TIM3_Handle.Init.Prescaler = 84-1;
+ USBD_CDC_TIM3_Handle.Init.ClockDivision = 0;
+ USBD_CDC_TIM3_Handle.Init.CounterMode = TIM_COUNTERMODE_UP;
+ if(HAL_TIM_Base_Init(&USBD_CDC_TIM3_Handle) != HAL_OK)
{
/* Initialization Error */
}