Giter VIP home page Giter VIP logo

picostdlib's Introduction

Raspberry Pi Pico SDK for Nim

This library provides the library and build system necessary to write programs for RP2040 based devices (such as the Raspberry Pi Pico) in the Nim programming language

The libary provides wrappers for the original Raspberry Pi Pico SDK. The following features are currently implemented:

  • Automatic project scaffolding using the piconim tool
  • Standard library features such as GPIO, time, ADC, PWM and many more
  • Rudimentary TinyUSB support: USB device, HID and CDC (serial port) classes

Table of Contents

Setup

Building

Examples

Contributing

License

Setup

The following steps will install piconim and create a new project

  1. First, you will need to have the Nim compiler installed. If you don't already have it, consider using choosenim

  2. Since this is just a wrapper for the original pico-sdk, you will need to install the C library dependencies (Step 1 in the quick start section)

  3. From the terminal, run nimble install https://github.com/beef331/picostdlib.

  4. Run piconim init <project-name> to create a new project directory from a template. This will create a new folder, so make sure you are in the parent folder. You can also provide the following options to the subcommand:

    • (--sdk, -s) -> specify the path to a locally installed pico-sdk repository, ex. --sdk:/home/casey/pico-sdk
    • (--nimbase, -n) -> similarly, you can provide the path to a locally installed nimbase.h file. Otherwise, the program attempts to download the file from the nim-lang github repository. ex. -n:/path/to/nimbase.h
    • (--overwrite, -O) -> a flag to specify overwriting an exisiting directory with the <project-name> already created. Be careful with this. ex. piconim myProject --overwrite will replace a folder named myProject

Building

Now you can work on your project. When you are ready to build the .uf2 file (which will be copied to the Raspberry Pi Pico), you can use the build subcommand:

piconim build <main-program>

Where <main-program> is the main module in your src folder. (ex. myProject.nim). You can also specify an output directory, otherwise it will be placed in csource/builds

piconim setup

If a piconim project is cloned fresh, or if git clean is ran, then the csource/build directory will need to be re-generated by CMake. This can be accomplished with the piconim setup command. The setup command takes an optional --sdk argument that works exactly like for the init command, described above.

Examples:

# Run these commands from the project root.

# Re-run CMake, download Pico SDK from Github
piconim setup

# Re-run CMake, use existing SDK
piconim setup --sdk:/home/casey/pico-sdk

Contributing

Please contribute.

picostdlib's People

Contributors

beef331 avatar casey-sk avatar martinix75 avatar auxym avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.