Git Product home page Git Product logo

radiuno's People

Contributors

aklomp avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

radiuno's Issues

si4735: model status byte as a bitfield

Model the si4735's status byte as a bitfield, for convenient access to all of the fields. This firmware does not need to be portable, so the usual objections against bitfields do not apply.

uart: add blocking function to get the next char

Add a blocking function to get the next character from the UART. The current implementation is nonblocking (polling), which is inefficient.

This also enables a cleanup: the rx FIFO no longer needs to be exported globally.

cmd: factor commands into separate files, autoregister them

  • Move each command implementation into a separate standalone file. This clearly bounds each command, and allows for more elaborate logic than would be appropriate for a single monolithic command file.
  • Register the commands by appending them to a linked list in a constructor function. This means that commands can be added to or removed from the codebase without having to update a master list somewhere. Commands are self-registering.

Seek: fix broken cancellation

Pressing Ctrl-C in the terminal during an active seek will interrupt the seek loop and throw the user back at the prompt, but it will not actually send a cancel seek command to the chip. The result is that the chip keeps seeking in the background, instead of keeping the frequency at the time of cancellation.

Fix this by sending the proper cancellation command to the chip.

si4735: model tune flags as a bitfield

Model the si4735's tune flags as a bitfield, for convenient access to all of the fields. This firmware does not need to be portable, so the usual objections against bitfields do not apply.

Code cleanups

Do a round of code cleanups:

  • Change the buffer type in readline.c to char *, so that the returned buffer is compatible with the standard string functions, that all expect char pointers.
  • In the headers, mark all functions as extern.
  • Source files include their own headers, to make sure that the declarations stay in sync with the implementations.
  • Header files include type headers for all types that it uses in declarations.

Makefile: add link-time optimization

Add the -flto flag to the general flags in the Makefile to enable link-time optimization. This will reduce the size of the firmware image by inlining functions across compilation units.

banner: compile the banner as an object file

Compile the banner as an object file instead of including it in the source code as a printf string. Escaping the slashes distorts the banner, and it is nicer to place resources in a separate file.

readline.c: keep one line of history

Keep one line of history in the Readline module, and allow the user to access this line with the up arrow.

Can be implemented in an elegant way with double buffering?

cmd: seek: refactor

Refactor the seek command implementation, which is fairly complex and contains an oversized function (seek_status). Simplify the code by breaking it up into smaller functions.

Makefile: switch to Picocom

Switch to picocom in the Makefile from the cumbersome and arcane minicom. This is a personal preference.

Also fix a related issue in readline.c: picocom sends backspace as keycode 127 (DEL), not 8 (BS). Fix this by recognizing 127 as a backspace.

si4735: track chip bootup mode, pick correct command

Track the chip's powerup mode (FM or AM/SW/LW) in the si4735 module. Use this information to choose the correct version (FM/AM) of the chip command.

This also lets us move a lot of mode-dependent commands to the si4735 module, because it now has the context to construct the right command for its mode.

si4735: use bitfields for all flagfields

Replace all shift-and-mask operations with bitfields. They are less error prone and more readable than using a shift and a mask, have no adverse performance impact, and using them has no portability impact because the code is linked to a single platform.

Properly mark variables used by ISRs as volatile

Fix a bug that manifests itself at higher optimization levels: variables that are modified in interrupt handlers are not marked volatile. At higher optimization levels, the compiler will assume that the variables cannot be externally modified, and this assumption results in a nonfunctional image.

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.