This project aims to create a Brushed Electronic Speed Controller (ESC) using KiCad. The ESC is designed to control the speed of a brushed DC motor using pulse-width modulation (PWM) signals.
To get started with this project, follow these steps:
- Clone this repository to your local machine.
git clone https://github.com/CosmopilotHQ/ESC-Firmware.git
Port manipulation is a method used to directly control the state of GPIO (General Purpose Input/Output). Instead of using digitalWrite() and digitalRead() functions, which are higher-level abstractions, port manipulation accesses the hardware registers directly.
To clear a bit in a register, you typically perform a bitwise AND operation between the register and the complement of a bitmask that has the desired bit set.
register &= ~(1 << bit_position);
To set a bit in a register, you typically perform a bitwise OR operation between the register and a bitmask that has the desired bit set.
register |= (1 << bit_position);
-
Setting Pin as Output
DDRD |= (1 << PD5);
-
Turning Pin High
PORTB |= (1 << PD5);
-
Turning Pin Low
PORTB &= ~(1 << PD5);
This project is licensed under the GNU General Public License v3.0. You can find more details in the LICENSE file.