Skip to content

CosmopilotHQ/ESC-Hardware

Repository files navigation

GitHub Release GitHub License GitHub Repo stars GitHub forks GitHub Issues or Pull Requests Gitpod

Brushed Speed Controller

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.

Getting Started

To get started with this project, follow these steps:

  1. Clone this repository to your local machine.
    git clone https://github.com/CosmopilotHQ/ESC-Hardware.git

Port Manipulation

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.

Clearing a Bit in a Register

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);

Setting a Bit in a Register

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);

Example

  • Setting Pin as Output

    DDRD |= (1 << PD5);
  • Turning Pin High

    PORTB |= (1 << PD5);
  • Turning Pin Low

    PORTB &= ~(1 << PD5);

License

This project is licensed under the GNU General Public License v3.0. You can find more details in the LICENSE file.

Releases

No releases published

Packages

No packages published