Use BOARD_SW[23]_GPIO{_PIN} macros wherever possible.
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
#include "include/board/board.h"
|
||||||
#include "fsl_gpio.h"
|
#include "fsl_gpio.h"
|
||||||
#include "usb_device_config.h"
|
#include "usb_device_config.h"
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
@@ -15,7 +16,7 @@ static usb_device_hid_keyboard_struct_t UsbKeyboardDevice;
|
|||||||
static usb_status_t UsbKeyboardAction(void)
|
static usb_status_t UsbKeyboardAction(void)
|
||||||
{
|
{
|
||||||
UsbKeyboardDevice.buffer[2] = 0x00U;
|
UsbKeyboardDevice.buffer[2] = 0x00U;
|
||||||
if (!GPIO_ReadPinInput(GPIOB, 17U)) {
|
if (!GPIO_ReadPinInput(BOARD_SW3_GPIO, BOARD_SW3_GPIO_PIN)) {
|
||||||
UsbKeyboardDevice.buffer[2] = KEY_A;
|
UsbKeyboardDevice.buffer[2] = KEY_A;
|
||||||
}
|
}
|
||||||
return USB_DeviceHidSend(UsbCompositeDevice.keyboardHandle, USB_KEYBOARD_ENDPOINT_ID,
|
return USB_DeviceHidSend(UsbCompositeDevice.keyboardHandle, USB_KEYBOARD_ENDPOINT_ID,
|
||||||
|
|||||||
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
|
#include "include/board/board.h"
|
||||||
#include "fsl_gpio.h"
|
#include "fsl_gpio.h"
|
||||||
#include "usb_device_config.h"
|
#include "usb_device_config.h"
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
@@ -15,7 +16,7 @@ static usb_status_t UsbMouseAction(void)
|
|||||||
{
|
{
|
||||||
UsbMouseDevice.buffer[1] = 0U;
|
UsbMouseDevice.buffer[1] = 0U;
|
||||||
UsbMouseDevice.buffer[2] = 0U;
|
UsbMouseDevice.buffer[2] = 0U;
|
||||||
if (!GPIO_ReadPinInput(GPIOC, 1U)) {
|
if (!GPIO_ReadPinInput(BOARD_SW2_GPIO, BOARD_SW2_GPIO_PIN)) {
|
||||||
UsbMouseDevice.buffer[2] = 1U;
|
UsbMouseDevice.buffer[2] = 1U;
|
||||||
}
|
}
|
||||||
return USB_DeviceHidSend(UsbCompositeDevice.mouseHandle, USB_MOUSE_ENDPOINT_ID,
|
return USB_DeviceHidSend(UsbCompositeDevice.mouseHandle, USB_MOUSE_ENDPOINT_ID,
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include "fsl_common.h"
|
#include "fsl_common.h"
|
||||||
#include "fsl_port.h"
|
#include "fsl_port.h"
|
||||||
|
#include "board.h"
|
||||||
|
|
||||||
void BOARD_InitPins(void)
|
void BOARD_InitPins(void)
|
||||||
{
|
{
|
||||||
@@ -43,9 +44,9 @@ void BOARD_InitPins(void)
|
|||||||
switchConfig.pullSelect = kPORT_PullUp;
|
switchConfig.pullSelect = kPORT_PullUp;
|
||||||
switchConfig.mux = kPORT_MuxAsGpio;
|
switchConfig.mux = kPORT_MuxAsGpio;
|
||||||
CLOCK_EnableClock(kCLOCK_PortC);
|
CLOCK_EnableClock(kCLOCK_PortC);
|
||||||
PORT_SetPinConfig(PORTC, 1U, &switchConfig);
|
PORT_SetPinConfig(BOARD_SW2_PORT, BOARD_SW2_GPIO_PIN, &switchConfig);
|
||||||
|
|
||||||
// Set up SW3.
|
// Set up SW3.
|
||||||
CLOCK_EnableClock(kCLOCK_PortB);
|
CLOCK_EnableClock(kCLOCK_PortB);
|
||||||
PORT_SetPinConfig(PORTB, 17U, &switchConfig);
|
PORT_SetPinConfig(BOARD_SW3_PORT, BOARD_SW3_GPIO_PIN, &switchConfig);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user