2021-04-20 10:54:10 +01:00
|
|
|
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <climits>
|
2021-07-20 10:05:24 +01:00
|
|
|
#include "pico/stdlib.h"
|
2021-04-20 10:54:10 +01:00
|
|
|
|
|
|
|
#define PIMORONI_I2C_DEFAULT_INSTANCE i2c0
|
|
|
|
#define PIMORONI_SPI_DEFAULT_INSTANCE spi0
|
|
|
|
|
|
|
|
namespace pimoroni {
|
2021-05-17 11:08:23 +01:00
|
|
|
static const unsigned int PIN_UNUSED = INT_MAX; // Intentionally INT_MAX to avoid overflowing MicroPython's int type
|
2021-04-20 10:54:10 +01:00
|
|
|
|
|
|
|
// I2C
|
2021-05-17 11:08:23 +01:00
|
|
|
static const unsigned int I2C_DEFAULT_BAUDRATE = 400000;
|
2021-04-20 10:54:10 +01:00
|
|
|
static const unsigned int I2C_DEFAULT_SDA = 20;
|
|
|
|
static const unsigned int I2C_DEFAULT_SCL = 21;
|
|
|
|
static const unsigned int I2C_DEFAULT_INT = 22;
|
|
|
|
|
|
|
|
static const unsigned int I2C_BG_SDA = 4;
|
|
|
|
static const unsigned int I2C_BG_SCL = 5;
|
|
|
|
static const unsigned int I2C_BG_INT = 3;
|
|
|
|
|
|
|
|
// SPI
|
|
|
|
static const unsigned int SPI_DEFAULT_MOSI = 19;
|
|
|
|
static const unsigned int SPI_DEFAULT_MISO = 16;
|
|
|
|
static const unsigned int SPI_DEFAULT_SCK = 18;
|
|
|
|
|
|
|
|
static const unsigned int SPI_BG_FRONT_PWM = 20;
|
|
|
|
static const unsigned int SPI_BG_FRONT_CS = 17;
|
|
|
|
|
|
|
|
static const unsigned int SPI_BG_BACK_PWM = 21;
|
|
|
|
static const unsigned int SPI_BG_BACK_CS = 22;
|
|
|
|
|
|
|
|
enum BG_SPI_SLOT {
|
|
|
|
BG_SPI_FRONT,
|
2021-06-05 18:58:23 +01:00
|
|
|
BG_SPI_BACK,
|
|
|
|
PICO_EXPLORER_ONBOARD
|
2021-04-20 10:54:10 +01:00
|
|
|
};
|
2021-05-14 18:12:37 +01:00
|
|
|
|
|
|
|
enum BOARD {
|
|
|
|
BREAKOUT_GARDEN,
|
|
|
|
PICO_EXPLORER
|
|
|
|
};
|
2021-07-20 10:05:24 +01:00
|
|
|
|
|
|
|
enum Polarity {
|
|
|
|
ACTIVE_LOW = 0,
|
|
|
|
ACTIVE_HIGH = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
inline uint32_t millis() {
|
|
|
|
return to_ms_since_boot(get_absolute_time());
|
|
|
|
}
|
2021-04-20 10:54:10 +01:00
|
|
|
}
|