Skip to content
forked from soypat/cyw43439

Driver for the Wifi+bluetooth integrated circuit on the pico.

License

Notifications You must be signed in to change notification settings

cl0wder/cyw43439

 
 

Repository files navigation

cyw43439

Driver for the Wifi+bluetooth integrated circuit on the pico.

Contributions

PRs welcome! Please read most recent developments on this issue before contributing.

Development

Compile and flash the development program to the currently connected Pico W by running:

tinygo flash -monitor -target=pico ./shelltest/.

After the program is done flashing it will enter shell-mode communications with the Pico W. One has several commands they can run from there on out.

To initialize the board type in the following shell command and press enter

$i0

A shell command is composed of 4 parts and serves the purpose of debugging:

  1. $: While in shell-mode the program waits for the $ character before parsing input.
  2. The next character after the $ is the "command" character.
  3. After the "command" is the number argument, which may not have effect in some commands
  4. The Enter or newline.

All commands must have these 4 parts

To develop add a command under the TestShellmode function (switch statement). This command will probably contain a function or action with the CYW43439 you wish to test.

FYI

Peripheral side APIs

Examples:

  • APA102 addressable LED strip.
    • Here is the Go driver: well programmed and simple. Follows good practices like storing buffers in-struct as arrays (buf field) to avoid heap allocations and encouraging better CPU memory access patterns.
    • I could not find a high quality C or C++ driver, there seems to be a different driver for each microcontroller. Here's an ESP8266 driver for the APA102 which seemed reasonably well programmed.
  • Wifinina SPI driver for ESP32 wifi with TCP/IP.

Microcontroller side APIs

The CYW43439 driver will have minimal microcontroller side API code, though it does not hurt to read up a little bit on it.

It may be of interest to the reader to know a bit of how one ports microcontroller specific code from C to Go. This code is characterized by the heavy use of volatile memory registers and data structures that map peripheral functionality directly to these segments of volatile memory.

For the case of the RP2040 (the raspberry pi's pico microcontroller) one can find most of microcontroller specific code in the TinyGo machine package- Look for filenames starting with machine_rp2040. In the author's opinion one of the cleanest peripheral API's is the RP2040's I2C driver, which you may find in machine_rp2040_i2c.go in said package.

The C counterparts are in the pico-sdk's rp2_common directory. The I2C counterpart includes the header file with function signatures and type definitions... and more interestingly, the actual code under hardware_i2c/i2c.c. Do note the port is almost direct. Some functions have been grouped differently and have slightly different signatures in the Go version.

The PWM API is much more closely matched between the C and Go version, albeit much simpler.

Go and TinyGo Ethernet/IP/TCP stack comparisons

stack comparison

About

Driver for the Wifi+bluetooth integrated circuit on the pico.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%