mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-14 18:40:37 +00:00
fix conflict of BIT() macro
This commit is contained in:
parent
d192868d62
commit
1f2901e8b1
@ -1358,7 +1358,7 @@ static int32_t ch341_set_baudrate (cdch_interface_t* p_cdc, uint32_t baud_rate,
|
||||
* inverted.
|
||||
*/
|
||||
if ( p_cdc->ch34x.version > 0x27 ) {
|
||||
val = (val | BIT(7));
|
||||
val = (val | TU_BIT(7));
|
||||
}
|
||||
|
||||
return ch341_write_reg ( p_cdc, CH341_REG_DIVISOR << 8 | CH341_REG_PRESCALER, val, complete_cb, user_data );
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define BIT(nr) ( (uint32_t)1 << (nr) )
|
||||
//#define BIT(nr) ( (uint32_t)1 << (nr) )
|
||||
|
||||
#define CH34X_BUFFER_SIZE 2
|
||||
|
||||
@ -93,20 +93,17 @@
|
||||
#define CH341_LCR_CS6 0x01
|
||||
#define CH341_LCR_CS5 0x00
|
||||
|
||||
#define CH341_QUIRK_LIMITED_PRESCALER BIT(0)
|
||||
#define CH341_QUIRK_SIMULATE_BREAK BIT(1)
|
||||
#define CH341_QUIRK_LIMITED_PRESCALER TU_BIT(0)
|
||||
#define CH341_QUIRK_SIMULATE_BREAK TU_BIT(1)
|
||||
|
||||
#define CH341_CLKRATE 48000000
|
||||
#define CH341_CLK_DIV(ps, fact) (1 << (12 - 3 * (ps) - (fact)))
|
||||
#define CH341_MIN_RATE(ps) (CH341_CLKRATE / (CH341_CLK_DIV((ps), 1) * 512))
|
||||
|
||||
/* Supported range is 46 to 3000000 bps. */
|
||||
#define CH341_MIN_BPS DIV_ROUND_UP(CH341_CLKRATE, CH341_CLK_DIV(0, 0) * 256)
|
||||
#define CH341_MIN_BPS TU_DIV_CEIL(CH341_CLKRATE, CH341_CLK_DIV(0, 0) * 256)
|
||||
#define CH341_MAX_BPS (CH341_CLKRATE / (CH341_CLK_DIV(3, 0) * 2))
|
||||
|
||||
#define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP
|
||||
#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
|
||||
|
||||
// error codes
|
||||
#define EINVAL 22 /* Invalid argument */
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#define TU_ARRAY_SIZE(_arr) ( sizeof(_arr) / sizeof(_arr[0]) )
|
||||
#define TU_MIN(_x, _y) ( ( (_x) < (_y) ) ? (_x) : (_y) )
|
||||
#define TU_MAX(_x, _y) ( ( (_x) > (_y) ) ? (_x) : (_y) )
|
||||
#define TU_DIV_CEIL(n, d) (((n) + (d) - 1) / (d))
|
||||
|
||||
#define TU_U16(_high, _low) ((uint16_t) (((_high) << 8) | (_low)))
|
||||
#define TU_U16_HIGH(_u16) ((uint8_t) (((_u16) >> 8) & 0x00ff))
|
||||
|
Loading…
x
Reference in New Issue
Block a user