7#include <Adafruit_SPIFlash.h>
8#include <Adafruit_Sensor.h>
10#include <SdFatConfig.h>
25using String = std::string;
32inline void pinMode(
int pin,
int mode) {
36inline void digitalWrite(
int pin,
int value) {
40inline void analogReadResolution(
int bits) {
44#define HAL_HIGH_VOLTAGE_ADC_PIN 192
45#define HAL_MID_VOLTAGE_ADC_PIN 193
46#define HAL_LOW_VOLTAGE_ADC_PIN 194
48inline uint32_t analogRead(
int pin) {
51 if (pin == HAL_HIGH_VOLTAGE_ADC_PIN) {
52 return static_cast<uint32_t
>((1 << 12) - 1);
54 if (pin == HAL_MID_VOLTAGE_ADC_PIN) {
55 return static_cast<uint32_t
>((1 << 12) - 1) / 2;
57 if (pin == HAL_LOW_VOLTAGE_ADC_PIN) {
58 return static_cast<uint32_t
>(1 << 12) / 10;
64static auto program_start = std::chrono::high_resolution_clock::now();
65inline unsigned long millis() {
66 return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - program_start).count();
69inline void delay(
unsigned long ms) {
71 std::this_thread::sleep_for(std::chrono::milliseconds(ms));