mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-01-23 05:41:05 -05:00
remove whitespaces and tabs
This commit is contained in:
parent
2014923966
commit
7019cd9048
@ -7,7 +7,7 @@
|
||||
CH554 main frequency modification, delay function definition
|
||||
Serial port 0 and serial port 1 initialization
|
||||
Serial port 0 and serial port 1 transceiver subfunctions
|
||||
Watchdog initialization
|
||||
Watchdog initialization
|
||||
*******************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
@ -20,8 +20,8 @@
|
||||
* Description : CH554 clock selection and configuration function, Fsys 6MHz is used by default, FREQ_SYS can be passed
|
||||
CLOCK_CFG configuration, the formula is as follows:
|
||||
Fsys = (Fosc * 4 / (CLOCK_CFG & MASK_SYS_CK_SEL); the specific clock needs to be configured by yourself
|
||||
*******************************************************************************/
|
||||
void CfgFsys( )
|
||||
*******************************************************************************/
|
||||
void CfgFsys( )
|
||||
{
|
||||
SAFE_MOD = 0x55;
|
||||
SAFE_MOD = 0xAA;
|
||||
@ -31,19 +31,19 @@ void CfgFsys( )
|
||||
#if FREQ_SYS == 32000000
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x07; // 32MHz
|
||||
#elif FREQ_SYS == 24000000
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x06; // 24MHz
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x06; // 24MHz
|
||||
#elif FREQ_SYS == 16000000
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x05; // 16MHz
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x05; // 16MHz
|
||||
#elif FREQ_SYS == 12000000
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x04; // 12MHz
|
||||
#elif FREQ_SYS == 6000000
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x03; // 6MHz
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x03; // 6MHz
|
||||
#elif FREQ_SYS == 3000000
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x02; // 3MHz
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x02; // 3MHz
|
||||
#elif FREQ_SYS == 750000
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x01; // 750KHz
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x01; // 750KHz
|
||||
#elif FREQ_SYS == 187500
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x00; // 187.5MHz
|
||||
CLOCK_CFG = CLOCK_CFG & ~ MASK_SYS_CK_SEL | 0x00; // 187.5MHz
|
||||
#else
|
||||
#warning FREQ_SYS invalid or not set
|
||||
#endif
|
||||
@ -59,7 +59,7 @@ void CfgFsys( )
|
||||
* Input : UNIT16 n
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
*******************************************************************************/
|
||||
void mDelayuS( uint16_t n ) // Delay in uS
|
||||
{
|
||||
#ifdef FREQ_SYS
|
||||
@ -129,7 +129,7 @@ void mDelaymS( uint16_t n ) //
|
||||
#endif
|
||||
-- n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if SDCC < 370
|
||||
void putchar(char c)
|
||||
@ -200,4 +200,4 @@ void gpio_unset(uint8_t pin) {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ inline void UART1Setup()
|
||||
U1SM0 = 0; //UART1选择8位数据位
|
||||
U1SMOD = 1; //快速模式
|
||||
U1REN = 1; //使能接收
|
||||
// should correct for rounding in SBAUD1 calculation
|
||||
// should correct for rounding in SBAUD1 calculation
|
||||
SBAUD1 = 256 - FREQ_SYS/16/UART1_BAUD;
|
||||
}
|
||||
|
||||
@ -181,4 +181,4 @@ inline void CH554WDTFeed(uint8_t tim)
|
||||
// Set pin p1.4 and p1.5 to GPIO output mode.
|
||||
void gpio_init();
|
||||
void gpio_set(uint8_t pin);
|
||||
void gpio_unset(uint8_t pin);
|
||||
void gpio_unset(uint8_t pin);
|
||||
|
@ -645,15 +645,15 @@ main()
|
||||
UpPoint2_Busy = 1;
|
||||
|
||||
// Should according to the USB-spec check if
|
||||
// length == 64, if so we should send a
|
||||
// zero-length USB packet. This is very
|
||||
// unlikley to happen.
|
||||
// length == 64, if so we should send a
|
||||
// zero-length USB packet. This is very
|
||||
// unlikley to happen.
|
||||
}
|
||||
}
|
||||
}
|
||||
// Should have a timeout if the transfer for some reason
|
||||
// fails to reset UpPoint2_Busy. But does not seem to
|
||||
// happen.
|
||||
// Should have a timeout if the transfer for some reason
|
||||
// fails to reset UpPoint2_Busy. But does not seem to
|
||||
// happen.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user