GithubHelp home page GithubHelp logo

arduino-drivers's Introduction

arduino-drivers

Hardware and IC driver collection for use with Arduino

Usage

#include <Wire.h>

#include "audio/AK5558.h"
#include "audio/CS4270.h"
#include "audio/DS1882.h"
#include "audio/MAX9744.h"
#include "audio/MSGEQ7.h"
#include "bluetooth/BM62.h"
#include "io/buttonled.h"
#include "io/PCAL6408A.h"

#define SERIAL_TIMEOUT_MILLISECONDS (1000U)
#define SERIAL_BAUD_RATE (115200U)
#define I2C_CLOCK_RATE   (400000U)

// define the digital I/O for various drivers
#define PCAL6408A_INT_L ( 2U)
#define BUTTON_PIN      ( 3U)
#define AK5558_RESET_L  ( 4U)
#define LED_PIN         ( 5U)
#define PCAL6408A_RST_L ( 6U)
#define DS1882_EN_N     ( 7U)
#define RST_N           ( 8U)
#define STROBE          ( 9U)
#define RESET           (10U)
#define CS4270_RST_N    (11U)
#define MUTE            (12U)
#define SHDN            (13U)
#define IND_A2DP_N      (14U)
#define PRGM_SENSE_N    (17U)
#define DC_OUT          ( A1)

#define MSGEQ7_INPUT_PULLUP_ON_DC_OUT (false)
#define MSGEQ7_SIGNAL_BAND_COUNT      ((uint8_t)7U)
#define MSGEQ7_ZERO_SIGNAL_LEVEL      ((uint16_t)400U)

// create BM62 driver object
BM62::BM62 bluetooth(PRGM_SENSE_N, RST_N, IND_A2DP_N, &Serial);

// create MSGEQ7 driver object
MSGEQ7::MSGEQ7 spectrum(STROBE, DC_OUT, RESET, MSGEQ7_INPUT_PULLUP_ON_DC_OUT);

// create MAX9744 driver object
MAX9744::MAX9744 amplifier(MAX9744_DEFAULT_I2CADDR, MUTE, SHDN, &Wire);

// create DS1882 driver object
DS1882::DS1882 digipot(DS1882_DEFAULT_I2CADDR, DS1882_EN_N, &Wire);

// create CS4270 driver object
CS4270::CS4270 codec70(CS4270_DEFAULT_I2CADDR, CS4270_RST_N, &Wire);

// create AK5558 driver object
AK5558::AK5558 ADC58(AK5558_DEFAULT_I2CADDR, AK5558_RESET_L, &Wire);

// create PCAL6308A driver object
PCAL6408A::PCAL6408A Gpio(PCAL6408A_DEFAULT_I2CADDR, PCAL6408A_RST_L, PCAL6408A_INT_L, &Wire);

// create LED and LED+button objects for S1 and S2 user interface switches
ButtonLED::LED led(LED_PIN);
ButtonLED::ButtonLED ledbutton(BUTTON_PIN, led);

void setup() {
  // initialize serial console and set baud rate
  Serial.setTimeout(SERIAL_TIMEOUT_MILLISECONDS);
  Serial.begin(SERIAL_BAUD_RATE);

  // initialize Wire library and set clock rate to 400 kHz
  Wire.begin();
  Wire.setClock(I2C_CLOCK_RATE);

  // example driver initialization goes here
  bluetooth.init();
  spectrum.init();
  amplifier.init();
  digipot.init();
  codec70.init();
  ADC58.init();
  !Gpio.init();
  ledbutton.init();
}

void loop() {
    // main code goes here
}

arduino-drivers's People

Contributors

vulcu avatar

Watchers

 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.