Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 5 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /** |
1 | /** |
2 | ****************************************************************************** |
2 | ****************************************************************************** |
3 | * @file stm32f1xx_hal_irda.h |
3 | * @file stm32f1xx_hal_irda.h |
4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
5 | * @version V1.0.1 |
5 | * @version V1.0.4 |
6 | * @date 31-July-2015 |
6 | * @date 29-April-2016 |
7 | * @brief Header file of IRDA HAL module. |
7 | * @brief Header file of IRDA HAL module. |
8 | ****************************************************************************** |
8 | ****************************************************************************** |
9 | * @attention |
9 | * @attention |
10 | * |
10 | * |
11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
11 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
12 | * |
12 | * |
13 | * Redistribution and use in source and binary forms, with or without modification, |
13 | * Redistribution and use in source and binary forms, with or without modification, |
14 | * are permitted provided that the following conditions are met: |
14 | * are permitted provided that the following conditions are met: |
15 | * 1. Redistributions of source code must retain the above copyright notice, |
15 | * 1. Redistributions of source code must retain the above copyright notice, |
16 | * this list of conditions and the following disclaimer. |
16 | * this list of conditions and the following disclaimer. |
Line 442... | Line 442... | ||
442 | #define IRDA_CR3_REG_INDEX 3 |
442 | #define IRDA_CR3_REG_INDEX 3 |
443 | 443 | ||
444 | #define IRDA_DIV(__PCLK__, __BAUD__) (((__PCLK__)*25)/(4*(__BAUD__))) |
444 | #define IRDA_DIV(__PCLK__, __BAUD__) (((__PCLK__)*25)/(4*(__BAUD__))) |
445 | #define IRDA_DIVMANT(__PCLK__, __BAUD__) (IRDA_DIV((__PCLK__), (__BAUD__))/100) |
445 | #define IRDA_DIVMANT(__PCLK__, __BAUD__) (IRDA_DIV((__PCLK__), (__BAUD__))/100) |
446 | #define IRDA_DIVFRAQ(__PCLK__, __BAUD__) (((IRDA_DIV((__PCLK__), (__BAUD__)) - (IRDA_DIVMANT((__PCLK__), (__BAUD__)) * 100)) * 16 + 50) / 100) |
446 | #define IRDA_DIVFRAQ(__PCLK__, __BAUD__) (((IRDA_DIV((__PCLK__), (__BAUD__)) - (IRDA_DIVMANT((__PCLK__), (__BAUD__)) * 100)) * 16 + 50) / 100) |
- | 447 | /* UART BRR = mantissa + overflow + fraction |
|
- | 448 | = (UART DIVMANT << 4) + (UART DIVFRAQ & 0xF0) + (UART DIVFRAQ & 0x0F) */ |
|
447 | #define IRDA_BRR(__PCLK__, __BAUD__) ((IRDA_DIVMANT((__PCLK__), (__BAUD__)) << 4)|(IRDA_DIVFRAQ((__PCLK__), (__BAUD__)) & 0x0F)) |
449 | #define IRDA_BRR(_PCLK_, _BAUD_) (((IRDA_DIVMANT((_PCLK_), (_BAUD_)) << 4) + \ |
- | 450 | (IRDA_DIVFRAQ((_PCLK_), (_BAUD_)) & 0xF0)) + \ |
|
- | 451 | (IRDA_DIVFRAQ((_PCLK_), (_BAUD_)) & 0x0F)) |
|
448 | 452 | ||
449 | /** Ensure that IRDA Baud rate is less or equal to maximum value |
453 | /** Ensure that IRDA Baud rate is less or equal to maximum value |
450 | * __BAUDRATE__: specifies the IRDA Baudrate set by the user. |
454 | * __BAUDRATE__: specifies the IRDA Baudrate set by the user. |
451 | * The maximum Baud Rate is 115200bps |
455 | * The maximum Baud Rate is 115200bps |
452 | * Returns : True or False |
456 | * Returns : True or False |