Overview#
The cmsis_gpio_button_toggle_led example show how to use the CMSIS driver interface to operate the LED as GPIO output and operate the GPIO as input with callback supported.
In this example, everytime button is pressed will trigger a interrupt and user callback will be invoked. The user callback print to the console to indicate a button press event is detected.
Supported Boards#
FRDM-KW43
Hardware requirements
Type-C USB cable
FRDM-KW43 Board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect a USB cable between the host PC and the FRDM board J28.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘BUTTON Pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXW70
Hardware requirements
Type-C USB cable
FRDM-MCXW70 Board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect a USB cable between the host PC and the FRDM board J28.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘BUTTON Pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXA287
Hardware requirements
Type-C USB cable
FRDM-MCXA287 board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the type-c and mini USB cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘SW3 is pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXA153
Hardware requirements
Type-C USB cable
FRDM-MCXA153 board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the type-c and mini USB cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘SW3 is pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXA266
Hardware requirements
Type-C USB cable
FRDM-MCXA266 board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the type-c and mini USB cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘SW3 is pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXA344
Hardware requirements
Type-C USB cable
FRDM-MCXA344 board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the type-c and mini USB cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘SW3 is pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXA577
Hardware requirements
Type-C USB cable
FRDM-MCXA577 board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the type-c and mini USB cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘SW3 is pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXA156
Hardware requirements
Type-C USB cable
FRDM-MCXA156 board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the type-c and mini USB cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘SW3 is pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXA366
Hardware requirements
Type-C USB cable
FRDM-MCXA366 board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the type-c and mini USB cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘SW3 is pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXW71
Hardware requirements
Type-C USB cable
FRDM-MCXW71 Board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the type-c and mini USB cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘SW3 is pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXE247
Hardware requirements
USB-C cable
FRDM-MCXE247 Board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the USB-C cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘SW3 is pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
MCX-W71-EVK
Hardware requirements
Type-C USB cable
MCX-W71-EVK Board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the type-c and mini USB cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘SW3 is pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXC041
Hardware requirements
Type-C USB cable
FRDM-MCXC041 board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the type-c and mini USB cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘SW3 is pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXC162
Hardware requirements
Type-C USB cable
FRDM-MCXC162 board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the type-c and mini USB cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘SW3 is pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXN947
Hardware requirements
Type-C USB cable
FRDM-MCXN947 Board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the type-c and mini USB cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘SW3 is pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXN947T
Hardware requirements
Type-C USB cable
FRDM-MCXN947T Board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the type-c and mini USB cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘SW3 is pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXC444
Hardware requirements
Type-C USB cable
FRDM-MCXW71 Board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the type-c and mini USB cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘SW3 is pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXN236
Hardware requirements
Type-C USB cable
FRDM-MCXN236 board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the type-c and mini USB cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘SW3 is pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXC242
Hardware requirements
Type-C USB cable
FRDM-MCXC242 board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the type-c and mini USB cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘SW3 is pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXA174
Hardware requirements
Type-C USB cable
FRDM-MCXA174 board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the type-c and mini USB cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘SW3 is pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXA346
Hardware requirements
Type-C USB cable
FRDM-MCXA346 board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the type-c and mini USB cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW3, then ‘SW3 is pressed’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!
FRDM-MCXL255
Hardware requirements
Type-C USB cable
FRDM-MCXL255 Board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect the type-c and mini USB cable between the PC host and the USB ports on the board.
Open a serial terminal on PC for the serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The following lines are printed to the serial terminal when the demo program is executed. If you press the SW2, then ‘BUTTON Pressed!’ is shown on the terminal window.
CMSIS GPIO Example!
Use Button to toggle LED!
BUTTON Pressed!
BUTTON Pressed!