mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-27 19:41:16 +00:00
more fixes
This commit is contained in:
parent
6f89eeea6b
commit
0e1449c458
@ -56,7 +56,7 @@ void bootloader_jump(void) {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
void keyboard_pre_init_kb(void) {
|
||||
void keyboard_pre_init_user(void) {
|
||||
#if HAL_USE_SPI == TRUE
|
||||
spi_init();
|
||||
#endif
|
||||
|
@ -24,65 +24,17 @@
|
||||
|
||||
/* ============ Function Prototypes ================== */
|
||||
|
||||
|
||||
#define PBIT(PORT, LINE) ((PAL_PORT(LINE) == PORT) ? (1 << PAL_PAD(LINE)) : 0)
|
||||
#define PAFIO_L(PORT, LINE, AF) (((PAL_PORT(LINE) == PORT) && (PAL_PAD(LINE) < 8)) ? (AF << (PAL_PAD(LINE) << 2)) : 0)
|
||||
#define PAFIO_H(PORT, LINE, AF) (((PAL_PORT(LINE) == PORT) && (PAL_PAD(LINE) >= 8)) ? (AF << ((PAL_PAD(LINE) - 8) << 2)) : 0)
|
||||
#define PAFIO(PORT, N, LINE, AF) ((N) ? PAFIO_H(PORT, LINE, AF) : PAFIO_L(PORT, LINE, AF))
|
||||
|
||||
#define OUT_BITS(PORT) (\
|
||||
PBIT(PORT, LINE_ROW1 ) | \
|
||||
PBIT(PORT, LINE_ROW2 ) | \
|
||||
PBIT(PORT, LINE_ROW3 ) | \
|
||||
PBIT(PORT, LINE_ROW4 ) | \
|
||||
PBIT(PORT, LINE_ROW5 ) | \
|
||||
0)
|
||||
#define OUT_BITS(PORT) (PBIT(PORT, LINE_ROW1) | PBIT(PORT, LINE_ROW2) | PBIT(PORT, LINE_ROW3) | PBIT(PORT, LINE_ROW4) | PBIT(PORT, LINE_ROW5) | 0)
|
||||
|
||||
#define IN_BITS(PORT) (\
|
||||
PBIT(PORT, LINE_COL1) | \
|
||||
PBIT(PORT, LINE_COL2) | \
|
||||
PBIT(PORT, LINE_COL3) | \
|
||||
PBIT(PORT, LINE_COL4) | \
|
||||
PBIT(PORT, LINE_COL5) | \
|
||||
PBIT(PORT, LINE_COL6) | \
|
||||
PBIT(PORT, LINE_COL7) | \
|
||||
PBIT(PORT, LINE_COL8) | \
|
||||
PBIT(PORT, LINE_COL9) | \
|
||||
PBIT(PORT, LINE_COL10)| \
|
||||
PBIT(PORT, LINE_COL11)| \
|
||||
PBIT(PORT, LINE_COL12)| \
|
||||
PBIT(PORT, LINE_COL13)| \
|
||||
PBIT(PORT, LINE_COL14)| \
|
||||
0)
|
||||
#define IN_BITS(PORT) (PBIT(PORT, LINE_COL1) | PBIT(PORT, LINE_COL2) | PBIT(PORT, LINE_COL3) | PBIT(PORT, LINE_COL4) | PBIT(PORT, LINE_COL5) | PBIT(PORT, LINE_COL6) | PBIT(PORT, LINE_COL7) | PBIT(PORT, LINE_COL8) | PBIT(PORT, LINE_COL9) | PBIT(PORT, LINE_COL10) | PBIT(PORT, LINE_COL11) | PBIT(PORT, LINE_COL12) | PBIT(PORT, LINE_COL13) | PBIT(PORT, LINE_COL14) | 0)
|
||||
|
||||
// Alternate Functions
|
||||
#define AF_BITS(PORT, N) (\
|
||||
PAFIO(PORT, N, LINE_UART_RX, AFIO_USART)| \
|
||||
PAFIO(PORT, N, LINE_UART_TX, AFIO_USART)| \
|
||||
PAFIO(PORT, N, LINE_BT_UART_TX, AFIO_USART)| \
|
||||
PAFIO(PORT, N, LINE_BT_UART_RX, AFIO_USART)| \
|
||||
PAFIO(PORT, N, LINE_ROW1, AFIO_GPIO) | \
|
||||
PAFIO(PORT, N, LINE_ROW2, AFIO_GPIO) | \
|
||||
PAFIO(PORT, N, LINE_ROW3, AFIO_GPIO) | \
|
||||
PAFIO(PORT, N, LINE_ROW4, AFIO_GPIO) | \
|
||||
PAFIO(PORT, N, LINE_ROW5, AFIO_GPIO) | \
|
||||
PAFIO(PORT, N, LINE_COL1, AFIO_GPIO) | \
|
||||
PAFIO(PORT, N, LINE_COL2, AFIO_GPIO) | \
|
||||
PAFIO(PORT, N, LINE_COL3, AFIO_GPIO) | \
|
||||
PAFIO(PORT, N, LINE_COL4, AFIO_GPIO) | \
|
||||
PAFIO(PORT, N, LINE_COL5, AFIO_GPIO) | \
|
||||
PAFIO(PORT, N, LINE_COL6, AFIO_GPIO) | \
|
||||
PAFIO(PORT, N, LINE_COL7, AFIO_GPIO) | \
|
||||
PAFIO(PORT, N, LINE_COL8, AFIO_GPIO) | \
|
||||
PAFIO(PORT, N, LINE_COL9, AFIO_GPIO) | \
|
||||
PAFIO(PORT, N, LINE_COL10, AFIO_GPIO) | \
|
||||
PAFIO(PORT, N, LINE_COL11, AFIO_GPIO) | \
|
||||
PAFIO(PORT, N, LINE_COL12, AFIO_GPIO) | \
|
||||
PAFIO(PORT, N, LINE_COL13, AFIO_GPIO) | \
|
||||
PAFIO(PORT, N, LINE_COL14, AFIO_GPIO) | \
|
||||
0)
|
||||
|
||||
|
||||
#define AF_BITS(PORT, N) (PAFIO(PORT, N, LINE_UART_RX, AFIO_USART) | PAFIO(PORT, N, LINE_UART_TX, AFIO_USART) | PAFIO(PORT, N, LINE_BT_UART_TX, AFIO_USART) | PAFIO(PORT, N, LINE_BT_UART_RX, AFIO_USART) | PAFIO(PORT, N, LINE_ROW1, AFIO_GPIO) | PAFIO(PORT, N, LINE_ROW2, AFIO_GPIO) | PAFIO(PORT, N, LINE_ROW3, AFIO_GPIO) | PAFIO(PORT, N, LINE_ROW4, AFIO_GPIO) | PAFIO(PORT, N, LINE_ROW5, AFIO_GPIO) | PAFIO(PORT, N, LINE_COL1, AFIO_GPIO) | PAFIO(PORT, N, LINE_COL2, AFIO_GPIO) | PAFIO(PORT, N, LINE_COL3, AFIO_GPIO) | PAFIO(PORT, N, LINE_COL4, AFIO_GPIO) | PAFIO(PORT, N, LINE_COL5, AFIO_GPIO) | PAFIO(PORT, N, LINE_COL6, AFIO_GPIO) | PAFIO(PORT, N, LINE_COL7, AFIO_GPIO) | PAFIO(PORT, N, LINE_COL8, AFIO_GPIO) | PAFIO(PORT, N, LINE_COL9, AFIO_GPIO) | PAFIO(PORT, N, LINE_COL10, AFIO_GPIO) | PAFIO(PORT, N, LINE_COL11, AFIO_GPIO) | PAFIO(PORT, N, LINE_COL12, AFIO_GPIO) | PAFIO(PORT, N, LINE_COL13, AFIO_GPIO) | PAFIO(PORT, N, LINE_COL14, AFIO_GPIO) | 0)
|
||||
|
||||
/**
|
||||
* @brief PAL setup.
|
||||
@ -91,89 +43,77 @@
|
||||
*/
|
||||
const PALConfig pal_default_config = {
|
||||
// GPIO A
|
||||
.setup[0] = {
|
||||
.DIR = OUT_BITS(IOPORTA),
|
||||
.INE = IN_BITS(IOPORTA),
|
||||
.PU = IN_BITS(IOPORTA),
|
||||
.PD = 0x0000,
|
||||
.OD = 0x0000,
|
||||
.DRV = 0x0000,
|
||||
.LOCK = 0x0000,
|
||||
.OUT = 0x0000,
|
||||
.CFG[0] = AF_BITS(IOPORTA, 0),
|
||||
.CFG[1] = AF_BITS(IOPORTA, 1),
|
||||
},
|
||||
.setup[0] =
|
||||
{
|
||||
.DIR = OUT_BITS(IOPORTA),
|
||||
.INE = IN_BITS(IOPORTA),
|
||||
.PU = IN_BITS(IOPORTA),
|
||||
.PD = 0x0000,
|
||||
.OD = 0x0000,
|
||||
.DRV = 0x0000,
|
||||
.LOCK = 0x0000,
|
||||
.OUT = 0x0000,
|
||||
.CFG[0] = AF_BITS(IOPORTA, 0),
|
||||
.CFG[1] = AF_BITS(IOPORTA, 1),
|
||||
},
|
||||
// GPIO B
|
||||
.setup[1] = {
|
||||
.DIR = OUT_BITS(IOPORTB),
|
||||
.INE = IN_BITS(IOPORTB),
|
||||
.PU = IN_BITS(IOPORTB),
|
||||
.PD = 0x0000,
|
||||
.OD = 0x0000,
|
||||
.DRV = 0x0000,
|
||||
.LOCK = 0x0000,
|
||||
.OUT = 0x0000,
|
||||
.CFG[0] = AF_BITS(IOPORTB, 0),
|
||||
.CFG[1] = AF_BITS(IOPORTB, 1),
|
||||
},
|
||||
.setup[1] =
|
||||
{
|
||||
.DIR = OUT_BITS(IOPORTB),
|
||||
.INE = IN_BITS(IOPORTB),
|
||||
.PU = IN_BITS(IOPORTB),
|
||||
.PD = 0x0000,
|
||||
.OD = 0x0000,
|
||||
.DRV = 0x0000,
|
||||
.LOCK = 0x0000,
|
||||
.OUT = 0x0000,
|
||||
.CFG[0] = AF_BITS(IOPORTB, 0),
|
||||
.CFG[1] = AF_BITS(IOPORTB, 1),
|
||||
},
|
||||
// GPIO C
|
||||
.setup[2] = {
|
||||
.DIR = OUT_BITS(IOPORTC),
|
||||
.INE = IN_BITS(IOPORTC),
|
||||
.PU = IN_BITS(IOPORTC),
|
||||
.PD = 0x0000,
|
||||
.OD = 0x0000,
|
||||
.DRV = 0x0000,
|
||||
.LOCK = 0x0000,
|
||||
.OUT = 0x0000,
|
||||
.CFG[0] = AF_BITS(IOPORTC, 0),
|
||||
.CFG[1] = AF_BITS(IOPORTC, 1),
|
||||
},
|
||||
.setup[2] =
|
||||
{
|
||||
.DIR = OUT_BITS(IOPORTC),
|
||||
.INE = IN_BITS(IOPORTC),
|
||||
.PU = IN_BITS(IOPORTC),
|
||||
.PD = 0x0000,
|
||||
.OD = 0x0000,
|
||||
.DRV = 0x0000,
|
||||
.LOCK = 0x0000,
|
||||
.OUT = 0x0000,
|
||||
.CFG[0] = AF_BITS(IOPORTC, 0),
|
||||
.CFG[1] = AF_BITS(IOPORTC, 1),
|
||||
},
|
||||
// GPIO D
|
||||
.setup[3] = {
|
||||
.DIR = OUT_BITS(IOPORTD),
|
||||
.INE = IN_BITS(IOPORTD),
|
||||
.PU = IN_BITS(IOPORTD),
|
||||
.PD = 0x0000,
|
||||
.OD = 0x0000,
|
||||
.DRV = 0x0000,
|
||||
.LOCK = 0x0000,
|
||||
.OUT = 0x0000,
|
||||
.CFG[0] = AF_BITS(IOPORTD, 0),
|
||||
.CFG[1] = AF_BITS(IOPORTD, 1),
|
||||
},
|
||||
.setup[3] =
|
||||
{
|
||||
.DIR = OUT_BITS(IOPORTD),
|
||||
.INE = IN_BITS(IOPORTD),
|
||||
.PU = IN_BITS(IOPORTD),
|
||||
.PD = 0x0000,
|
||||
.OD = 0x0000,
|
||||
.DRV = 0x0000,
|
||||
.LOCK = 0x0000,
|
||||
.OUT = 0x0000,
|
||||
.CFG[0] = AF_BITS(IOPORTD, 0),
|
||||
.CFG[1] = AF_BITS(IOPORTD, 1),
|
||||
},
|
||||
.ESSR[0] = 0x00000000,
|
||||
.ESSR[1] = 0x00000000,
|
||||
};
|
||||
|
||||
const ioline_t row_list[MATRIX_ROWS] = {
|
||||
LINE_ROW1,
|
||||
LINE_ROW2,
|
||||
LINE_ROW3,
|
||||
LINE_ROW4,
|
||||
LINE_ROW5,
|
||||
LINE_ROW1, LINE_ROW2, LINE_ROW3, LINE_ROW4, LINE_ROW5,
|
||||
};
|
||||
|
||||
const ioline_t col_list[MATRIX_COLS] = {
|
||||
LINE_COL1,
|
||||
LINE_COL2,
|
||||
LINE_COL3,
|
||||
LINE_COL4,
|
||||
LINE_COL5,
|
||||
LINE_COL6,
|
||||
LINE_COL7,
|
||||
LINE_COL8,
|
||||
LINE_COL9,
|
||||
LINE_COL10,
|
||||
LINE_COL11,
|
||||
LINE_COL12,
|
||||
LINE_COL13,
|
||||
LINE_COL14,
|
||||
LINE_COL1, LINE_COL2, LINE_COL3, LINE_COL4, LINE_COL5, LINE_COL6, LINE_COL7, LINE_COL8, LINE_COL9, LINE_COL10, LINE_COL11, LINE_COL12, LINE_COL13, LINE_COL14,
|
||||
};
|
||||
|
||||
void __early_init(void) {
|
||||
ht32_clock_init();
|
||||
}
|
||||
void __early_init(void) {}
|
||||
|
||||
void boardInit(void) {
|
||||
}
|
||||
void early_hardware_init_pre(void) { ht32_clock_init(); }
|
||||
|
||||
void board_init(void) {}
|
||||
|
||||
void boardInit(void) {}
|
||||
|
@ -14,8 +14,7 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H
|
||||
#define BOARD_H
|
||||
#pragma once
|
||||
/*
|
||||
* Setup for Anne Pro 2 board.
|
||||
*/
|
||||
@ -24,54 +23,52 @@
|
||||
* Board identifier.
|
||||
*/
|
||||
#define ANNEPRO2
|
||||
#define BOARD_NAME "Anne Pro 2"
|
||||
#define BOARD_NAME "Anne Pro 2"
|
||||
|
||||
#define HT32F52342
|
||||
|
||||
#define FLASH_SIZE (0x10000 - 0x4000) // 64kB - 16kB
|
||||
#define FLASH_SIZE (0x10000 - 0x4000) // 64kB - 16kB
|
||||
|
||||
/*
|
||||
* I/O
|
||||
*/
|
||||
|
||||
#define LINE_UART_TX PAL_LINE(IOPORTB, 0) // Master TX, LED RX
|
||||
#define LINE_UART_RX PAL_LINE(IOPORTB, 1) // Master RX, LED TX
|
||||
#define LINE_UART_TX PAL_LINE(IOPORTB, 0) // Master TX, LED RX
|
||||
#define LINE_UART_RX PAL_LINE(IOPORTB, 1) // Master RX, LED TX
|
||||
|
||||
#define LINE_BT_UART_TX PAL_LINE(IOPORTA, 4) // Master TX, BLE RX
|
||||
#define LINE_BT_UART_RX PAL_LINE(IOPORTA, 5) // Master RX, BLE TX
|
||||
#define LINE_BT_UART_TX PAL_LINE(IOPORTA, 4) // Master TX, BLE RX
|
||||
#define LINE_BT_UART_RX PAL_LINE(IOPORTA, 5) // Master RX, BLE TX
|
||||
|
||||
// outputs (rows are pulled low)
|
||||
#define LINE_ROW1 PAL_LINE(IOPORTC, 2)
|
||||
#define LINE_ROW2 PAL_LINE(IOPORTC, 1)
|
||||
#define LINE_ROW3 PAL_LINE(IOPORTB, 5)
|
||||
#define LINE_ROW4 PAL_LINE(IOPORTB, 4)
|
||||
#define LINE_ROW5 PAL_LINE(IOPORTC, 3)
|
||||
#define LINE_ROW1 PAL_LINE(IOPORTC, 2)
|
||||
#define LINE_ROW2 PAL_LINE(IOPORTC, 1)
|
||||
#define LINE_ROW3 PAL_LINE(IOPORTB, 5)
|
||||
#define LINE_ROW4 PAL_LINE(IOPORTB, 4)
|
||||
#define LINE_ROW5 PAL_LINE(IOPORTC, 3)
|
||||
|
||||
// inputs (columns are sampled)
|
||||
#define LINE_COL1 PAL_LINE(IOPORTC, 4)
|
||||
#define LINE_COL2 PAL_LINE(IOPORTC, 5)
|
||||
#define LINE_COL3 PAL_LINE(IOPORTB, 10)
|
||||
#define LINE_COL4 PAL_LINE(IOPORTB, 11)
|
||||
#define LINE_COL5 PAL_LINE(IOPORTC, 0)
|
||||
#define LINE_COL6 PAL_LINE(IOPORTA, 15)
|
||||
#define LINE_COL7 PAL_LINE(IOPORTA, 8)
|
||||
#define LINE_COL8 PAL_LINE(IOPORTA, 10)
|
||||
#define LINE_COL9 PAL_LINE(IOPORTA, 11)
|
||||
#define LINE_COL1 PAL_LINE(IOPORTC, 4)
|
||||
#define LINE_COL2 PAL_LINE(IOPORTC, 5)
|
||||
#define LINE_COL3 PAL_LINE(IOPORTB, 10)
|
||||
#define LINE_COL4 PAL_LINE(IOPORTB, 11)
|
||||
#define LINE_COL5 PAL_LINE(IOPORTC, 0)
|
||||
#define LINE_COL6 PAL_LINE(IOPORTA, 15)
|
||||
#define LINE_COL7 PAL_LINE(IOPORTA, 8)
|
||||
#define LINE_COL8 PAL_LINE(IOPORTA, 10)
|
||||
#define LINE_COL9 PAL_LINE(IOPORTA, 11)
|
||||
// PORTA 12,13 conflict with SWD
|
||||
#define LINE_COL10 PAL_LINE(IOPORTA, 12)
|
||||
#define LINE_COL11 PAL_LINE(IOPORTA, 13)
|
||||
#define LINE_COL12 PAL_LINE(IOPORTA, 14)
|
||||
#define LINE_COL13 PAL_LINE(IOPORTB, 2)
|
||||
#define LINE_COL14 PAL_LINE(IOPORTB, 3)
|
||||
#define LINE_COL10 PAL_LINE(IOPORTA, 12)
|
||||
#define LINE_COL11 PAL_LINE(IOPORTA, 13)
|
||||
#define LINE_COL12 PAL_LINE(IOPORTA, 14)
|
||||
#define LINE_COL13 PAL_LINE(IOPORTB, 2)
|
||||
#define LINE_COL14 PAL_LINE(IOPORTB, 3)
|
||||
|
||||
#if !defined(_FROM_ASM_)
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void boardInit(void);
|
||||
#ifdef __cplusplus
|
||||
# endif
|
||||
void boardInit(void);
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _FROM_ASM_ */
|
||||
|
||||
#endif /* BOARD_H */
|
||||
# endif
|
||||
#endif /* _FROM_ASM_ */
|
@ -14,8 +14,7 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H
|
||||
#define BOARD_H
|
||||
#pragma once
|
||||
/*
|
||||
* Setup for Anne Pro 2 board.
|
||||
*/
|
||||
@ -71,5 +70,3 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
#endif /* _FROM_ASM_ */
|
||||
|
||||
#endif /* BOARD_H */
|
||||
|
@ -27,7 +27,3 @@
|
||||
#define MATRIX_ROWS 5
|
||||
#define MATRIX_COLS 14
|
||||
// layer size: MATRIX_ROWS * MATRIX_COLS * sizeof(uint16_t) = 144 bytes
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCE 5
|
||||
|
||||
|
@ -28,9 +28,6 @@
|
||||
#define MATRIX_COLS 14
|
||||
// layer size: MATRIX_ROWS * MATRIX_COLS * sizeof(uint16_t) = 144 bytes
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCE 5
|
||||
|
||||
#if defined(ANNEPRO2_EEPROM)
|
||||
// SPI Config
|
||||
#define SPI_DRIVER SPID1
|
||||
|
@ -13,9 +13,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _MCUCONF_H_
|
||||
#define _MCUCONF_H_
|
||||
#pragma once
|
||||
|
||||
#include "nvic.h"
|
||||
|
||||
@ -68,4 +66,4 @@
|
||||
#define HT32_SPI1_IRQ_PRIORITY 9
|
||||
#endif
|
||||
|
||||
#endif /* _MCUCONF_H_ */
|
||||
|
||||
|
@ -6,8 +6,7 @@
|
||||
* shine's clang formatting).
|
||||
*/
|
||||
|
||||
#ifndef PROTOCOL_INCLUDED
|
||||
#define PROTOCOL_INCLUDED
|
||||
#pragma once
|
||||
#include <inttypes.h>
|
||||
|
||||
#define PROTOCOL_SD SD0
|
||||
@ -110,5 +109,3 @@ extern void protoSilence(protocol_t *proto);
|
||||
|
||||
/* Transmit message */
|
||||
extern void protoTx(uint8_t cmd, const unsigned char *buf, int payloadSize, int retries);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user