{"id":20999878,"url":"https://github.com/brentseidel/bbs-bbb-ada","last_synced_at":"2025-05-14T23:31:21.370Z","repository":{"id":95368132,"uuid":"51555441","full_name":"BrentSeidel/BBS-BBB-Ada","owner":"BrentSeidel","description":"A collection of Ada sources for working with Linux based embedded computers, such as the BeagleBone Black or Raspberry Pi","archived":false,"fork":false,"pushed_at":"2025-03-10T13:29:57.000Z","size":3898,"stargazers_count":8,"open_issues_count":4,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-03T00:51:50.457Z","etag":null,"topics":["ada","beaglebone-black","embedded-linux","embedded-systems","raspberry-pi"],"latest_commit_sha":null,"homepage":"","language":"Ada","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BrentSeidel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-11T23:33:36.000Z","updated_at":"2025-03-10T13:30:01.000Z","dependencies_parsed_at":"2024-09-16T20:58:44.514Z","dependency_job_id":"ef86a985-7556-4079-9047-dc267aca89c8","html_url":"https://github.com/BrentSeidel/BBS-BBB-Ada","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrentSeidel%2FBBS-BBB-Ada","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrentSeidel%2FBBS-BBB-Ada/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrentSeidel%2FBBS-BBB-Ada/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrentSeidel%2FBBS-BBB-Ada/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BrentSeidel","download_url":"https://codeload.github.com/BrentSeidel/BBS-BBB-Ada/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254248187,"owners_count":22038980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ada","beaglebone-black","embedded-linux","embedded-systems","raspberry-pi"],"created_at":"2024-11-19T08:08:46.294Z","updated_at":"2025-05-14T23:31:16.334Z","avatar_url":"https://github.com/BrentSeidel.png","language":"Ada","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BBS-BBB-Ada\nThis repository contains a collection of Ada sources for working with embedded\nLinux computers such as the BeagleBone Black or the Raspberry Pi, as well as the\nARM based Arduino Due.  Due to differences between platforms and the limited\namount of time I have to work on things, something may work on one platform,\nbut not on another.\n\n[![Alire](https://img.shields.io/endpoint?url=https://alire.ada.dev/badges/bbs_embed_common.json)]\n(https://alire.ada.dev/crates/bbs_embed_common.html)\n\n\n[![Alire](https://img.shields.io/endpoint?url=https://alire.ada.dev/badges/bbs_embed_linux.json)]\n(https://alire.ada.dev/crates/bbs_embed_linux.html)\n\n\n# Notices\n## Note\nAs a result of bringing in the Arduino Due, the non-object oriented interfaces\nwill generally be going away.  They may still exist at a low level, but are\nnot recommended for use.\n\n## Note\nDue to changes in the way that various I/O is handled, these routines are pretty much\nguarenteed not to work on some versions of Linux.  The I2C routines were developed on\nDebian Jessie, Linux V4.1.12-ti-r29 and use Ada 2012.\n\n## Note\nSome of the system files that control I/O are owned by root and do not allow world\nwrite access.  A shell script is provided to set the permissions so that the Ada\nprogram does not need to run as root.\n\n## Note\nI finally got around to developing a centralized units system.  The types for\nmany physical units are now defined in the BBS.units package.  This can be fetched\nfrom the https://github.com/BrentSeidel/BBS-Ada.git repository on GitHub.  While\nthis adds an external dependancy for this repository, the result is that by using\nit, all packages will have access to the same units, conversions, and functions.\n\nAn advantage of this approach is that if you use the proper units in your\ncalculations, the compiler will be able to catch mismatches between feet and\nmeters before you crash your probe into Mars.\n\n## Note\nAnother reoganization is likely in work.  These routines seem to work fairly well on\nLinux based embedded systems.  I am getting interested in trying out Ada on bare\nARM based systems such as the Arduino Due.  It would be nice to be able to re-use\nsome of this software.  The approach that I'm currently thinking of is to use abstract\nbase clases for the various types of I/O such as i2c or gpio.  These would define the\nbasic interface routines for these I/O.  The concrete classes would contain the\nspecific code for these I/O.  Thus, for example, there would be a base gpio class and\nthen a concrete gpio.linux class and a concrete gpio.arduion_due class.  This might not\nbe a big advantage for gpio, but for i2c it would mean that I don't need to update any\nof the routines for the various i2c devices.  This will require a bit of planning and\nexperimentation.\n\n# Contents\n## LEDs\nThis works only on the BeagleBone Black which has four controllable LEDs on the\ncircuit board.  The BBS.embed.LED package contains definitions and routines for\ncontrolling the four built-in LEDs on the board next to the ethernet connector.\n\n## i2c\nThe BBS.embed.i2c package contains a set of objects and routines for reading and\nwriting to devices on I2C buses.  To actually use the I2C bus, you must create\nan object from either the BBS.embed.I2C.Due or BBS.embed.I2C.Linux packages.\n\n**Note** after a bug fix, the I2C interface works on a Raspberry PI 3.  It should\nwork on other models as well.  Just pass \"/dev/null\" as the pin control files.  A\nconfiguration routine has been provided that omits the pin control parameters.\nThe Linux version tested are:\n* Raspberry Pi-3 Linux 4.4.13-v7+ #894 SMP Mon Jun 13 13:13:27 BST 2016 armv7l GNU/Linux\n* Raspberry PI 4 Linux 5.15.0-1033-raspi #36-Ubuntu SMP PREEMPT Thu Jun 22 08:10:31 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux\n\n## i2c subpackages\nSubpackages have been created for the following devices to provide a higher level interface.\n\n### ADS1015\nThis is a four channel 12 bit Analog to Digital Converter.  The four channels\ncan be used individually in a single ended mode.  Channel 0 and 1 can be\npaired for differential measurements.  Channels 0, 1, and 2 can be paired\nwith channel 3 for differential measurements.  The 12 bit value is a signed\ntwos complement format.  This means that for single ended conversions, it\nis effectively 11 bits.\n\n### BME280\nThis chip contains pressure, temperature, and humidity sensors along with calibration\nvalues.  The package contains an object oriented interface to retrieve calibrated\nmeasurements from the sensors.\n\n### BMP180\nThis chip contains a pressure sensor and a temperature sensor along with calibration\nvalues.  The package contains both an object oriented and non-object oriented\ninterface to the sensors to retrieve calibrated measurements.\n\n### L3GD20H\nThis is a gyroscope on a chip.  Routines are provided to configure the chip and to get\nthe rotation around the X, Y, and Z axis.  A routine is also provided to return all\nrotations in a single record.\n\nThe chip also contains an temperature sensor and a routine is provided to access it.\n\n### LSM303DLHC\nThis chip contains a 3 axis accelerometer and a 3 axis magnetometer.  Routines are provided\nto initialize the chip and to return the acceleration or magnetic field for each axis.\nCombined acceleration or magnetic field for all three axis can also be returned.\n\nThe chip also contains a temperature sensor and a routine is provided to access it.\n\n### MCP4725\nThis is a single channel 12 bit DAC.  The fast write and write commands\nhave been tested and work.  The other features are likely to work, but haven't\nbeen tested.\n\n### MCP23008\nThis is an 8 bit I/O expander.  It can be used to add 8 GPIO pins per adapter.\n\n### MCP23017\nThis is a 16 bit I/O expander.  It can be used to add 16 GPIO pins per adapter.\n\n### PCA9685\nThis is a 16 channel, 12 bit PWM controller.  Basic functions seem to work, but\nthis should be considered to be under development and even more experimental than\nevery thing else.  The basic function is available, more features are expected\nto be added as I have time and energy.\n\n### Devices\nThis package contains constants for other devices that do not yet have individual packages.\n\n## GPIO\nThis is an object oriented interface to the GPIO pins.  It allows setting or\ntesting a pin.  This uses the /sys filesystem interface and this is not particularly\nhigh performance.  It should be adequate for lighting indicators or checking the\nstate of switches.\n\nThe GPIO have now been tested to work on a Raspberry PI 3 as well as a BeagleBone\nBlack.  Using the following code to toggle a gpio as fast as possible:\n~~~~\nloop\n   gpio.set(1);\n   gpio.set(0);\nend loop;\n~~~~\n\nI got the following results:\n\n| System | Frequency |\n|--------|-----------|\n| BeagleBone Black | 60 kHz |\n| Raspberry PI 3 | 160 kHz |\n| Raspberry PI 4 | 657 kHz |\n| Arduino Due | 384 kHz |\n\nNote that the times are only approximate and can vary greatly depending on other\nprocessing on the processor.\n\nNote that the Raspberry Pi used the V2 ioctl() interface to GPIO while the BeagleBone\nBlack and Raspberry Pi 3 used the sysfs interface.\n\nBy way of comparison, an Adruino Mega 2560 got 126.6kHz or 128.2kHz (it toggled between\nthe two as I measured it) in a similar tight loop using digitalWrite().\n\n### TB6612\nThis is used to control a stepper moter using 4 GPIO pins.\n\n## PWM\nThis is an object oriented interface to the PWM controllers.  The BeagleBone\nBlack processor has 8 PWM controllers.  Due to the lack of a pinmux structure\nfor P8_28, one of the PWMs is not really usable.  The interface allows control\nof the period (or rate) and the time high (or duty cycle) of the PWM output.\n\n## Analog inputs\nThis is a simple object oriented interface to the analog inputs.  This base\nclass supports 12 bit conversions.  The concrete implementations for Linux or\nArduino Due may support other options.\n\nOn the BeagleBone Black, there are seven analog inputs available and the pins\nthat they are on are fixed purpose.  The A/D converter is a 12 bit converter,\nso the result should be in the range 0..4095.\n\nThe Arduino Due has 16 analog inputs, 12 of which are actually wired up and are\navailable for use.  The A/D converter is a 12 bit converter.\n\n## SPI\nA basic API for the SPI interface is provided.  It does 8 bit reads and writes\nusing the default settings from Linux.  It has been tested on a Raspberry PI 3\nand works well enough to interface with the AdaFruit RA8875 breakout board so\nmore features have not yet been developed.\n\n### RA8875 LCD driver\nThis provides an interface to the RA8875 LCD driver and touchscreen interface.\nIt should be considered to be experimental.  Bugs are to be expected and full\nfunctionality is not provided.  Drawing of most built in geometric shapes is\nsupported.  Text drawing is supported, but occasionally gets garbled.  I am\ntrying to figure this out.  Touch is supported with calibration, but to be\nreally useful will need filtering and debouncing.  If I get ambitious, I may\nbuild a widget set on top of this.\n\n**Note** When using the AdaFruit breakout board with the Raspberry PI 3 (and\nprobably any other 3V system, the power supply needs to be 5V.  The RA8875 itself\nseems to work at 3V, but the backlight driver needs 5V.  This was a pain to debug.\n\n**Note** The RA8875 does not tri-state the MISO line.  Thus it cannot share a SPI\ninterface with other devices without an additional tri-state device.\n\n#### RA8875 Widgets\nThis is currently only a figment of my imagination.  I hope to eventually provide\nsome basic widgets for a touch interface.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrentseidel%2Fbbs-bbb-ada","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrentseidel%2Fbbs-bbb-ada","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrentseidel%2Fbbs-bbb-ada/lists"}