The Okapi data logger: what is Okapi’s about it, on the NW_Logger core. More…

#include <Okapi.h>

Inherits from NW_Logger

Public Functions

  Name
  Okapi(board Model_ =Model_0v0, build Specs_ =Build_A)
Instantiate the Okapi data-logger class.
bool begin(uint8t * Vals, uint8_t NumVals, String header) override
Begin with a list of attached I2C devices.
String readStr(uint8_t LineIndex, uint32_t DataIndex)
< begin(header) with no external sensors
float getVoltage(uint8_t Pin)
Read voltage from the external 16-bit ADC.
uint8_t setVoltageRaw(uint16_t Val, bool Gain =GAIN_1X)
Set voltage on the 12-bit digital-to-analog converter.
uint8_t setVoltage(float Val)
Set voltage on the 12-bit digital-to-analog converter.
void addDataPoint(String(*)(void) Update) override
Writes date/time, on-board sensors, and external string to SD.
String getOnBoardVals()
Obtain date/time, P/T/RH, temperatures, and voltages from board.
uint8_t powerAuto()
Determine which input has power and set up power path from that.
void powerAux(uint8_t State)
Power from Main, backup, or off.
void i2cState(bool State)
Use the on-board (INTERNAL) or external (EXTERNAL) I2C bus.
const char * name() const override
size_t printStatus(Print & out, bool boot =false) override
int LogStr(String Val)
String ReadStr(uint8_t LineIndex, uint32_t DataIndex)
void Run(String(*)(void) Update, unsigned long LogInterval)
float GetVoltage(uint8_t Pin)
uint8_t SetVoltageRaw(uint16_t Val, bool Gain =GAIN_1X)
uint8_t SetVoltage(float Val)
void AddDataPoint(String(*)(void) Update)
String GetOnBoardVals()
void InitLogFile()
void ResetWD()
uint8_t PowerAuto()
void PowerAux(uint8_t State)
void I2CState(bool State)

Public Attributes

  Name
uint8_t TX
USART Transmit.
uint8_t RX
USART Receive.
uint8_t C0
BSCHULZ1701: WHAT ARE THESE??
uint8_t C1
BSCHULZ1701: WHAT ARE THESE??
uint8_t Sw_Bus_Prime
Primary bus switch pin (BSCHULZ1701: is this in addition to the physical switch?)
uint8_t Sw_Bus_Sec
Secondary bus switch pin (BSCHULZ1701: is this in addition to the physical switch?)
uint8_t PG_3v3_Core
IO Exp PORT B (BSCHULZ1701: what is this in plain English / purpose?)
uint8_t FeatherEN
IO Exp PORT B (BSCHULZ1701: turn Feather on if True, I guess?)
uint8_t D0
GPIO pin D0 Arduino Pin 12
uint8_t D1
GPIO pin D1 Arduino Pin 25
uint8_t D2
GPIO pin D2 Arduino Pin 3
uint8_t D3
GPIO pin D3 Arduino Pin 26
uint8_t ADC_Sense_SW
Switch the Analog-Digital Converter on (true) or off (false) Pin 0
uint8_t FeatherRTS
Feather pin: should this be public or private?
uint8_t FeatherCTS
Feather pin: should this be public or private?
uint8_t FeatherGPIO
Feather pin: should this be public or private?
uint8_t CS_Ext
Feather pin: should this be public or private?
uint8_t GlobalInt
WHAT IS THIS?
const String LibVersion
Okapi data logger library version.

Detailed Description

class Okapi;

The Okapi data logger: what is Okapi’s about it, on the NW_Logger core.

Everything a logger does (the card layout, the data and status files, run(), the interrupts, the self-tests, the LED, the serial number from Page 0) comes from NW_Logger. Okapi adds its two power rails with their arbitration, its on-board ADS1115 pair and MCP4725 DAC, the MCP23018 port expander that switches the Feather, and the backhaul over Serial after every LogCountPush rows. Okapi is a Schema 1 device like Margay: its Pages 0 from EEPROM, Pages 2 and 3 a reading of itself (the appendix’s Block 1, power, waits on the power model and stays zero).

Names are camelCase as of 2026-09-23; the PascalCase names stay as deprecated forwarders for one release.

Public Functions Documentation

function Okapi

Okapi(
    board Model_ =Model_0v0,
    build Specs_ =Build_A
)

Instantiate the Okapi data-logger class.

Parameters:

  • Model_ Not currently used for Okapi
  • Specs_ Defines the number of on-board I2C device addresses. Build_A: DEFAULT 6 on-board I2C devices. Build_B: 0 on-board I2C devices.

function begin

bool begin(
    uint8_t * Vals,
    uint8_t NumVals,
    String header_
) override

Begin with a list of attached I2C devices.

Parameters:

  • *Vals List of I2C addresses for external sensors
  • NumVals The length of the *Vals list
  • Header_ A header string for the data file

Return: true when the self-tests found nothing wrong

function readStr

String readStr(
    uint8_t LineIndex,
    uint32_t DataIndex
)

< begin(header) with no external sensors

Parameters:

  • LineIndex The desired line number, counted from DataIndex
  • DataIndex The byte at which to start in the file

Read one row back from the data file, for the backhaul

function getVoltage

float getVoltage(
    uint8_t Pin
)

Read voltage from the external 16-bit ADC.

Parameters:

  • Pin (range 0-3) – which pin to read?

function setVoltageRaw

uint8_t setVoltageRaw(
    uint16_t Val,
    bool Gain =GAIN_1X
)

Set voltage on the 12-bit digital-to-analog converter.

Parameters:

  • Val 0 to 4095, which scales from 0 to Vbus
  • Gain GAIN_1X or GAIN_2X

function setVoltage

uint8_t setVoltage(
    float Val
)

Set voltage on the 12-bit digital-to-analog converter.

Parameters:

  • Val Desired voltage value, in volts.

function addDataPoint

void addDataPoint(
    String(*)(void) Update
) override

Writes date/time, on-board sensors, and external string to SD.

Parameters:

  • *Update External update function from Arduino sketch

function getOnBoardVals

String getOnBoardVals()

Obtain date/time, P/T/RH, temperatures, and voltages from board.

function powerAuto

uint8_t powerAuto()

Determine which input has power and set up power path from that.

function powerAux

void powerAux(
    uint8_t State
)

Power from Main, backup, or off.

Parameters:

  • State 0 or 3 = OFF, 1 = V_Prime, 2 = V_Beta

function i2cState

void i2cState(
    bool State
)

Use the on-board (INTERNAL) or external (EXTERNAL) I2C bus.

function name

inline const char * name() const override

function printStatus

size_t printStatus(
    Print & out,
    bool boot =false
) override

function LogStr

inline int LogStr(
    String Val
)

function ReadStr

inline String ReadStr(
    uint8_t LineIndex,
    uint32_t DataIndex
)

function Run

inline void Run(
    String(*)(void) Update,
    unsigned long LogInterval
)

function GetVoltage

inline float GetVoltage(
    uint8_t Pin
)

function SetVoltageRaw

inline uint8_t SetVoltageRaw(
    uint16_t Val,
    bool Gain =GAIN_1X
)

function SetVoltage

inline uint8_t SetVoltage(
    float Val
)

function AddDataPoint

inline void AddDataPoint(
    String(*)(void) Update
)

function GetOnBoardVals

inline String GetOnBoardVals()

function InitLogFile

inline void InitLogFile()

function ResetWD

inline void ResetWD()

function PowerAuto

inline uint8_t PowerAuto()

function PowerAux

inline void PowerAux(
    uint8_t State
)

function I2CState

inline void I2CState(
    bool State
)

Public Attributes Documentation

variable TX

uint8_t TX = 11;

USART Transmit.

variable RX

uint8_t RX = 10;

USART Receive.

variable C0

uint8_t C0 = 18;

BSCHULZ1701: WHAT ARE THESE??

variable C1

uint8_t C1 = 19;

BSCHULZ1701: WHAT ARE THESE??

variable Sw_Bus_Prime

uint8_t Sw_Bus_Prime = 23;

Primary bus switch pin (BSCHULZ1701: is this in addition to the physical switch?)

variable Sw_Bus_Sec

uint8_t Sw_Bus_Sec = 22;

Secondary bus switch pin (BSCHULZ1701: is this in addition to the physical switch?)

variable PG_3v3_Core

uint8_t PG_3v3_Core = 1;

IO Exp PORT B (BSCHULZ1701: what is this in plain English / purpose?)

variable FeatherEN

uint8_t FeatherEN = 7;

IO Exp PORT B (BSCHULZ1701: turn Feather on if True, I guess?)

variable D0

uint8_t D0 = 12;

GPIO pin D0 Arduino Pin 12

variable D1

uint8_t D1 = 25;

GPIO pin D1 Arduino Pin 25

variable D2

uint8_t D2 = 3;

GPIO pin D2 Arduino Pin 3

variable D3

uint8_t D3 = 26;

GPIO pin D3 Arduino Pin 26

variable ADC_Sense_SW

uint8_t ADC_Sense_SW = 0;

Switch the Analog-Digital Converter on (true) or off (false) Pin 0

variable FeatherRTS

uint8_t FeatherRTS = 31;

Feather pin: should this be public or private?

variable FeatherCTS

uint8_t FeatherCTS = 30;

Feather pin: should this be public or private?

variable FeatherGPIO

uint8_t FeatherGPIO = 29;

Feather pin: should this be public or private?

variable CS_Ext

uint8_t CS_Ext = 24;

Feather pin: should this be public or private?

variable GlobalInt

uint8_t GlobalInt = 28;

WHAT IS THIS?

variable LibVersion

const String LibVersion = OKAPI_LIBRARY_VERSION;

Okapi data logger library version.


Updated on 2026-09-23 at 22:44:32 +0000