2022-12-30 11:29:07 -05:00
|
|
|
#pragma once
|
|
|
|
//
|
|
|
|
// FILE: AtomicWeight.h
|
|
|
|
// AUTHOR: Rob Tillaart
|
|
|
|
// DATE: 2022-03-09
|
2022-12-31 11:38:51 -05:00
|
|
|
// VERSION: 0.1.1
|
2022-12-30 11:29:07 -05:00
|
|
|
// PURPOSE: Arduino library for atomic weights
|
|
|
|
// URL: https://github.com/RobTillaart/AtomicWeight
|
|
|
|
|
|
|
|
|
|
|
|
#include "Arduino.h"
|
|
|
|
|
2022-12-31 11:38:51 -05:00
|
|
|
#define ATOMIC_WEIGHT_LIB_VERSION (F("0.1.1"))
|
2022-12-30 11:29:07 -05:00
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// IS THIS THE RIGHT FORMAT?
|
|
|
|
// or should we build a list of elements
|
|
|
|
//
|
|
|
|
class PTOE
|
|
|
|
{
|
|
|
|
public:
|
2022-12-31 11:38:51 -05:00
|
|
|
PTOE(uint8_t size = 118); // all by default
|
|
|
|
uint8_t size();
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t electrons(uint8_t el);
|
|
|
|
uint8_t neutrons(uint8_t el);
|
|
|
|
uint8_t protons(uint8_t el);
|
2022-12-30 11:29:07 -05:00
|
|
|
|
|
|
|
|
2022-12-31 11:38:51 -05:00
|
|
|
float weight(uint8_t el);
|
|
|
|
float weight(const char * formula);
|
|
|
|
float weight(char * formula);
|
2022-12-30 11:29:07 -05:00
|
|
|
|
|
|
|
|
2022-12-31 11:38:51 -05:00
|
|
|
char * name(uint8_t el);
|
|
|
|
uint8_t find(char * abbrev);
|
2022-12-30 11:29:07 -05:00
|
|
|
|
|
|
|
|
|
|
|
// DEBUG
|
2022-12-31 11:38:51 -05:00
|
|
|
float weightFactor();
|
2022-12-30 11:29:07 -05:00
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint8_t _size;
|
|
|
|
const float _weightFactor = 1.0 / 222.909;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// -- END OF FILE --
|
|
|
|
|