This repository contains a Keil uVision project template designed for the LandTiger development board, featuring the NXP LPC1768 ARM Cortex-M3 microcontroller.
The template provides a clean and modular starting point to develop embedded applications, offering basic functionality to interface with key peripherals such as buttons, leds, timers, and more. It is intended to help streamline development by handling low-level configuration and setup, so you can focus on application logic.
This project was created as part of the Computer Architectures course at Politecnico di Torino, taught by Professor Renato Ferrero.
To get started, clone this repository and open the .uvproj file using Keil uVision. From there, you can begin writing your own firmware or extend the existing peripheral drivers.
The source code is stored in the Source/ directory.
The startup code (ASM and main.c) is in the Source/ directory, while the C code is organized into subdirectories based on functionality:
- button
- led
- rit
- timer
- CMSIS_core: contains the CMSIS core files for the LPC17xx series.
Each subdirectory contains the necessary source files and headers for that functionality:
- [feature].h: the header file for the feature, containing function prototypes and type definitions.
- lib_[feature].c: the source file for the feature, containing the implementation of the functions
- IRQ_[feature].c: the IRQ handler for the feature, if applicable.
The template includes several features that can be used in your application. Each feature has its own directory and is implemented in a modular way, allowing you to include only the features you need.
The following features are included in the template:
- SVC handler
- Button handling
- LED handling
- RIT and button debounce
- Timer handling
Defined in startup_LPC17xx.s, the SVC handler is a special function that handles system calls made by the application. It allows the application to request services from the operating system or the hardware.
The template includes a basic SVC handler that can be customized to handle specific system calls.
The button handling feature provides functions to initialize and manage the buttons on the LandTiger board. It includes:
- Initialization of the GPIO pins connected to the buttons
- Functions to read the state of the buttons
- Interrupt handling for button presses
It can be extended with RIT (Repetitive Interrupt Timer) for debouncing and more advanced button handling.
The LED handling feature provides functions to control the LEDs on the LandTiger board. It includes:
- Initialization of the GPIO pins connected to the LEDs
- Functions to turn on, turn off, and toggle the LEDs
The RIT (Repetitive Interrupt Timer) feature provides a way to handle button debouncing and periodic tasks. It includes:
- Initialization of the RIT peripheral
- Functions to set up the RIT for periodic interrupts
- Debounce logic for button presses
The timer handling feature provides functions to manage hardware timers on the LandTiger board. It includes:
- Initialization of the timer peripheral
- Functions to start, stop, and configure timers
- Interrupt handling for timer events
To use the timer feature:
- Call
TIMER_init()to initialize the timer with the desired parameters. - Use
TIMER_enable()to start the timer. - If the interrupt is enabled, extend the
TIMER0_IRQHandler()orTIMER1_IRQHandler()function to handle timer interrupts.
Contributions are welcome! If you'd like to improve this project, please follow these steps:
- Fork the repository
- Create a new branch for your feature or bugfix
git checkout -b feature/your-feature-name - Commit your changes with clear and concise messages
git commit -m "Add feature: description" - Push to your fork
git push origin feature/your-feature-name - Open a Pull Request with a detailed explanation of your changes
Before submitting a pull request:
- Make sure your code follows the existing style and structure.
- Test your changes on the LandTiger LPC1768 board if applicable.
- Document any new functionality or changes to existing code.