75 lines
1.8 KiB
C
75 lines
1.8 KiB
C
#ifndef ENV
|
|
#define ENV
|
|
#include <Arduino.h>
|
|
#include "driver/rtc_io.h"
|
|
|
|
#include <BLEDevice.h>
|
|
#include <BLEUtils.h>
|
|
#include <BLEScan.h>
|
|
#include <BLEAdvertisedDevice.h>
|
|
|
|
#include <Adafruit_NAU7802.h>
|
|
#include <Adafruit_GFX.h>
|
|
#include <Fonts/FreeSans9pt7b.h>
|
|
|
|
/********************* General ****************************/
|
|
#define BUTTON_PIN_BITMASK(GPIO) (1ULL << GPIO)
|
|
#define WAKEUP_GPIO GPIO_NUM_1
|
|
#define SLEEP_GPIO 1
|
|
|
|
/********************* NAU7802 ****************************/
|
|
|
|
#define LDO NAU7802_3V3
|
|
#define GAIN NAU7802_GAIN_128
|
|
#define SPS NAU7802_RATE_20SPS
|
|
|
|
/****************************** DISPLAY *******************/
|
|
|
|
// any pins can be used
|
|
#define SHARP_SCK 7
|
|
#define SHARP_MOSI 9
|
|
#define SHARP_SS 44
|
|
#define DISPLAY_HEIGHT 144
|
|
#define DISPLAY_WIDTH 168
|
|
|
|
#define BLACK 0
|
|
#define WHITE 1
|
|
|
|
#define FONT_SIZE 2
|
|
#define FONT &FreeSans9pt7b
|
|
|
|
/********************* BLE ********************************/
|
|
|
|
#define BLE false
|
|
#if BLE
|
|
#define SERVICE_UUID "9f0dfdb2-e978-494c-8f15-68dbe8d28672"
|
|
#define MILLIS_UUID "abb92561-a809-453c-8c7c-71d3fff5b86e"
|
|
#define WEIGHT_UUID "123e4567-e89b-12d3-a456-426614174000"
|
|
#endif
|
|
|
|
#if GAIN == NAU7802_GAIN_1
|
|
#define CALIBRATION_FACTOR 100.0 / 424.47
|
|
|
|
#elif GAIN == NAU7802_GAIN_2
|
|
#define CALIBRATION_FACTOR 100.0 / 2457.96
|
|
|
|
#elif GAIN == NAU7802_GAIN_4
|
|
#define CALIBRATION_FACTOR 100.0 / 3622.82
|
|
|
|
#elif GAIN == NAU7802_GAIN_8
|
|
#define CALIBRATION_FACTOR 100.0 / 6630.74
|
|
|
|
#elif GAIN == NAU7802_GAIN_16
|
|
#define CALIBRATION_FACTOR 100.0 / 13179.24
|
|
|
|
#elif GAIN == NAU7802_GAIN_32
|
|
#define CALIBRATION_FACTOR 100.0 / 25955.84
|
|
|
|
#elif GAIN == NAU7802_GAIN_64
|
|
#define CALIBRATION_FACTOR 100.0 / 52865.63
|
|
|
|
#elif GAIN == NAU7802_GAIN_128
|
|
#define CALIBRATION_FACTOR 100.0 / 104167.17
|
|
#endif
|
|
|
|
#endif |