https://github.com/rahji/millis
library to provide millis()-like capability without Arduino.h
https://github.com/rahji/millis
Last synced: 2 months ago
JSON representation
library to provide millis()-like capability without Arduino.h
- Host: GitHub
- URL: https://github.com/rahji/millis
- Owner: rahji
- License: mit
- Created: 2023-05-23T01:10:28.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-23T02:00:29.000Z (about 2 years ago)
- Last Synced: 2025-02-06T02:51:32.614Z (4 months ago)
- Language: C++
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# millis library for Microchip/Atmel AVR microcontrollers
This is a simple library to provide millis()-like capability without using the Arduino framework.
## Installing
I use this module with PlatformIO. Here are a few different ways you can add it to your project:
1. Download the zip file, rename the unzipped folder to `millis` and place it in the `lib` folder of your project
2. Add it as a git submodule by typing the following command while in the `lib` folder: `git submodule add https://github.com/rahji/millis.git`
3. Add it to your `platformio.ini` file as a dependency, as shown below (I think).```ini
lib_deps = https://github.com/rahji/millis.git#v1.0.0
```You'll want to make sure that the `framework = arduino` line is removed from `platformio.ini` and that a `board_build.f_cpu = 8000000L` line is added (with your actual clock speed).
## Usage
`millis_init()` will need to be called near the top of your main program. After that, you can call `millis_get()` to get the number of milliseconds that have passed.
## Some Notes
This isn't really a proper library with features, etc. It basically just sets up the timer registers and supplies a `millis()`-like function. Unless you're using Timer 0, you'll need to tweak the `millis_init()` function.
Also, I have defined the `millis_t` type to be `unsigned int`, but you probably want it to be `unsigned long`.