open-index/open-npm huggingface dataset:
npm package: @johnsonhuang4396/api-smasher
Description: Convert Swagger documentation to TypeScript API files
Author: Johnson Huang
Latest version: 0.1.1

# Api Smasher

[![npm version](https://img.shields.io/npm/v/@johnsonhuang4396/api-smasher)](https://www.npmjs.com/package/@johnsonhuang4396/api-smasher)
[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@johnsonhuang4396/api-smasher)
[![github release](https://img.shields.io/github/v/release/JohnsonHuang4396/api-smasher)](https://github.com/JohnsonHuang4396/api-smasher/releases)
![NPM Unpacked Size](https://img.shields.io/npm/unpacked-size/%40johnsonhuang4396%2Fapi-smasher)
![NPM License](https://img.shields.io/npm/l/%40johnsonhuang4396%2Fapi-smasher)

_Convert Swagger documentation to TypeScript API files (Support custom template)_

## Install
```bash
npm i @johnsonhuang4396/api-smasher
```

## How to use
```ts
import { generateApi } from '@johnsonhuang4396/api-smasher'

generateApi({
  config: 'YOUR_SWAGGER_REMOTE_URL',
  autoRun: true,
  outputDir: 'YOUR_OUTPUT_DIR',
  selectedPaths: [API_PATHS_YOU_WANT]
})
```
then you will find `Api.ts` and `Model.ts` file be generated at **YOUR_OUTPUT_DIR**

## More usage ways

Find it [HERE](https://github.com/JohnsonHuang4396/api-smasher/tree/main/packages/core/test)

## Types

Find it [HERE](https://github.com/JohnsonHuang4396/api-smasher/blob/main/packages/core/src/action.ts)
npm package: @johnsonhuang4396/vite-plugin-api-smasher
Description: Vite plugin for API Smasher
Author: Johnson Huang
Latest version: 0.1.1

# Api Smasher

[![npm version](https://img.shields.io/npm/v/@johnsonhuang4396/vite-plugin-api-smasher)](https://www.npmjs.com/package/@johnsonhuang4396/vite-plugin-api-smasher)
[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@johnsonhuang4396/vite-plugin-api-smasher)
[![github release](https://img.shields.io/github/v/release/JohnsonHuang4396/api-smasher)](https://github.com/JohnsonHuang4396/api-smasher/releases)
![NPM Unpacked Size](https://img.shields.io/npm/unpacked-size/%40johnsonhuang4396%2Fvite-plugin-api-smasher)
![NPM License](https://img.shields.io/npm/l/%40johnsonhuang4396%2Fvite-plugin-api-smasher)

_Vite plugin for [Api-Smasher](https://github.com/JohnsonHuang4396/api-smasher/tree/main/packages/core)_

## Install
```bash
npm i @johnsonhuang4396/vite-plugin-api-smasher
```

## How to use
```ts
import apiSmasher from '@johnsonhuang4396/vite-plugin-api-smasher'

export default defineConfig({
  server: {
    port: 3000
  },
  plugins: [
    apiSmasher({
      config: 'YOUR_SWAGGER_REMOTE_URL',
    })
  ]
})
```

then run `npm run dev` and visit [localhost:3000/__api-smasher/](localhost:3000/__api-smasher/) to generate API and type files.
npm package: @johnsonsy/react-simple-time-picker
Description: > This project is created to simplify the process of publishing a React component to npm. For a full tutorial on publishing React component to npm, please refer to [this guide](https://medium.com/groftware/how-to-publish-your-react-component-on-npm-9cf48d
Author: Johnson
Latest version: 0.1.0

> This project is created to simplify the process of publishing a React component to npm. For a full tutorial on publishing React component to npm, please refer to [this guide](https://medium.com/groftware/how-to-publish-your-react-component-on-npm-9cf48d91944d)

## Guide
1. Replace contents in `/src` with your React component.
1. Edit `webpack.config.js`, replace the following:
	1. `entry: './src/YOUR_COMPONENT.js'` Replace value of `entry` to path to the entry point of your component.
	1. Replace 	`output.filename` to the name of your component
	```
		output: {
			path: path.resolve('lib'),
			filename: 'YOUR_COMPONENT.js',
			libraryTarget: 'commonjs2',
  	},
	```
1. Edit `package.json`, replace the following:
	1. `"name": "YOUR_PACKAGE_NAME"` Replace the value of `name` to your package name. This will be the name of the package that is published to `npm` and the name that is used when other people install your package using `npm install YOUR_PACKAGE_NAME`.
	1. Update the values of `version` and `description` to accordingly.
	1. `"main": "./lib/YOUR_COMPONENT.js"` replace `YOUR_COMPONENT.js` with the name that you've set in `output.filename` during Step #2
	1. If your component uses any other dependencies, make sure to add them into the `peerDependencies` list.
1. Building your component by running `npm build` in your command line. This would generate the folder `/lib` which includes your component.
1. Publishing to [npm](https://www.npmjs.com/)
	1. Make sure you've [registered an npm account](https://www.npmjs.com/signup)
	1. Run `npm login` in your command line, and enter your credentials.
	1. Run `npm publish`, and your React component will be uploaded to npm! You can find it at https://www.npmjs.com/package/[YOUR PACKAGE NAME] or your npm profile.

1. To update your package, make sure you remember to increment the `version` in `package.json`, and then perform Step #5 again.
npm package: @johnsony1995/jy-tableau-embedded-api
Description: Tableau Embedded API wrapped in a NPM module.
Author: Johnson Yick
Latest version: 3.0.1

# Tableau Embedded API

Tableau Embedded API snapshot wrapped in NPM module.

[Tableau API Documentation](https://help.tableau.com/current/api/embedding_api/en-us/reference/index.html)

[Tableau Getting Started](https://help.tableau.com/current/api/embedding_api/en-us/index.html)
npm package: @johnsriders/react-native-text-recognition
Description: React Native MLKIT Setup for Text Recognition
Author: Junaid Younas
Latest version: 1.0.4

# TextRecognition

🧠 TextRecognition - ML-Powered Text Extraction for React Native
Bring the power of Google's latest ML Kit Text Recognition directly into your React Native app with @jd/react-native-text-recognition. This library allows you to effortlessly detect and extract text from images — printed or handwritten — using cutting-edge machine learning models.

🔥 Note: Due to integration with the newest version of ML Kit, this library requires iOS 16.1+ as the minimum deployment target 
.

Perfect for OCR features, document scanning, form auto-fill, and more! 

✅ Features

🔍 Detects both printed and handwritten text

🚀 Powered by Google ML Kit (v8.0.0+) for high accuracy and performance

📱 Supports iOS 16.1 and above for native capabilities

⚙️ Easy installation via CocoaPods

👌 Works seamlessly with modern React Native projects

📲 Installation

🍎 iOS Setup

This library uses Google ML Kit , so you'll need to update your Podfile accordingly:
## Installation IOS

```bash
pod 'TextRecognition', :path => '../node_modules/@johnsriders/react-native-text-recognition/ios'

pod 'GoogleMLKit/TextRecognition', '~> 8.0.0'
pod 'SDWebImage', '~> 5.11.1'

cd ios && pod install

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end
```
💡 Make sure your Xcode project is targeting iOS 16.1 or later , as ML Kit now requires it for full functionality 
## Installation Android

```bash
implementation 'com.google.android.gms:play-services-mlkit-text-recognition:19.0.1'
```

## Usage

```javascript

import TextRecognition from '@johnsriders/react-native-text-recognition';

TextRecognition.recognizeFromImage(imagePath)
  .then(text => console.log("Recognized text:", text))
  .catch(err => console.error("Recognition error:", err));
```

## Contributing

Pull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License

[MIT](https://choosealicense.com/licenses/mit/)
npm package: @johnstonbl01/react-starter
Description: A personalized React starter kit built on top of CRA
Author: Blake Johnston
Latest version: 1.0.8

## React Starter

This is a small project that extends Creact React App and adds some of my personal preferences. Probably not the most idiomatic way to do this, but it was a good excuse to dig into how CRA works.

```
npx @johnstonbl01/react-starter [projectName]
```

<p align="center">
  <img src="react-starter.gif" width="600px" alt="command line interface when installing this project" />
  <img src="counter.gif"  alt="the example app" />
</p>
npm package: @johntad/m-pesa
Description: A TypeScript SDK for integrating M-Pesa mobile payment services into applications, enabling seamless money transfers and transactions.
Author: John Tad
Latest version: 1.0.0

![M-Pesa Banner](/m-pesa_banner.png)
# M-Pesa SDK for Node.js

The M-Pesa Node.js SDK simplifies the integration of M-Pesa mobile payment services into your applications. It offers an intuitive API to manage core M-Pesa operations such as sending payments, receiving payments, checking account balances, and more...

📘Learn more: [Documentation](), [Website]()

---
## Contribution

Read [CONTRIBUTING](CONTRIBUTING.md)

## License
This SDK is free and open source project licensed under the [MIT License](LICENSE). You are free to do whatever you want with it.

---

## Support

For any issues or queries, please open an issue contact.
npm package: @johntalton/adt7410
Description: Analog devices Temperature sensor with High / Low / Critical set points and interrupt lines.
Latest version: 2.0.2

# ADT 7410

Analog devices Temperature sensor with High / Low / Critical set points and interrupt lines.

[![npm Version](http://img.shields.io/npm/v/@johntalton/adt7410.svg)](https://www.npmjs.com/package/@johntalton/adt7410)
![GitHub package.json version](https://img.shields.io/github/package-json/v/johntalton/adt7410)
[![CI](https://github.com/johntalton/adt7410/actions/workflows/CI.yml/badge.svg)](https://github.com/johntalton/adt7410/actions/workflows/CI.yml)

## Operational Modes

The configuration of the ADT7410 allows for four distinct operational modes.

- Continuous:
- One Shot:
- 1 SPS:
- Shutdown:

Temperature configuration can set the device to 13-bit or 16-bit conversion mode.

A Low / High / Critical Alarm (set points) enable triggering of interrupts once configured.
npm package: @johntalton/adxl375
Description: 3-Axis Accelerometer using [`I2CBus`](https://github.com/johntalton/and-other-delights) abstraction
Latest version: 1.0.1

# ADXL375

3-Axis Accelerometer using [`I2CBus`](https://github.com/johntalton/and-other-delights) abstraction

[![npm Version](http://img.shields.io/npm/v/@johntalton/adxl375.svg)](https://www.npmjs.com/package/@johntalton/adxl375)
![GitHub package.json version](https://img.shields.io/github/package-json/v/johntalton/adxl375)
[![CI](https://github.com/johntalton/adxl375/actions/workflows/CI.yml/badge.svg)](https://github.com/johntalton/adxl375/actions/workflows/CI.yml)

# Example

```javascript
import { I2CAddressedBus } from '@johntalton/and-other-delights'
import { ADXL375 } from '@johntalton/adxl375'

const bus = /* I2CBus */
const aBus = new I2CAddressedBus(bus, 0x53)
const device = new ADXL375(aBus)

const id = await device.getID()

const { x, y, z } = await device.getXYZ()

```
npm package: @johntalton/aht20
Description: [![npm Version](http://img.shields.io/npm/v/@johntalton/aht20.svg)](https://www.npmjs.com/package/@johntalton/aht20) ![GitHub package.json version](https://img.shields.io/github/package-json/v/johntalton/aht20) ![CI](https://github.com/johntalton/aht20/wo
Latest version: 1.2.2

# AHT20


[![npm Version](http://img.shields.io/npm/v/@johntalton/aht20.svg)](https://www.npmjs.com/package/@johntalton/aht20)
![GitHub package.json version](https://img.shields.io/github/package-json/v/johntalton/aht20)
![CI](https://github.com/johntalton/aht20/workflows/CI/badge.svg)
![GitHub](https://img.shields.io/github/license/johntalton/aht20)
[![Downloads Per Month](http://img.shields.io/npm/dm/@johntalton/aht20.svg)](https://www.npmjs.com/package/@johntalton/aht20)
![GitHub last commit](https://img.shields.io/github/last-commit/johntalton/aht20)

Humidity and Temperature sensor driver.

# Usage

The AHT20 use a triggered reading result workflow.  Thus, reading data will be stable until the next trigger is performed.

Like other sensors initialization / calibration is a required step.
npm package: @johntalton/and-other-delights
Description: A simple set of abstraction and helpers useful when working with I²C
Latest version: 8.6.6

# And Other Delights
A simple set of abstraction and helpers useful when working with I²C

[![npm Version](https://img.shields.io/npm/v/@johntalton/and-other-delights.svg)](https://www.npmjs.com/package/@johntalton/and-other-delights)
![GitHub package.json version](https://img.shields.io/github/package-json/v/johntalton/and-other-delights)
[![CI](https://github.com/johntalton/and-other-delights/actions/workflows/CI.yml/badge.svg)](https://github.com/johntalton/and-other-delights/actions/workflows/CI.yml)
![CodeQL](https://github.com/johntalton/and-other-delights/workflows/CodeQL/badge.svg)
![GitHub](https://img.shields.io/github/license/johntalton/and-other-delights)
[![Downloads Per Month](https://img.shields.io/npm/dm/@johntalton/and-other-delights.svg)](https://www.npmjs.com/package/@johntalton/and-other-delights)
![GitHub last commit](https://img.shields.io/github/last-commit/johntalton/and-other-delights)

## Contents

* [I²C](#book-I²C)
  * [I2CBus](#book-i2cbus)
  * [I2CAddressedBus](#book-i2caddressedbus)
  * [I2CBusSoft16](#book-i2cbussoft16)


## :book: I2CBus

This is the top level interface for `I2CBus` implementations.  There are several concert version that conform to this, and a wide range of other abstraction that can provided capabilities around it.

- [MCP221](https://github.com/johntalton/i2c-bus-mcp2221) can provide I²C interface
- The Excamera Labs I2CDriver also exposes a [`I2CBus`](https://github.com/johntalton/i2c-bus-excamera-i2cdriver)
- NodeJS version based on `i2c-bus` [I2CBusFivdi](https://github.com/johntalton/i2c-bus-fivdi)
- A Virtualized Managed [`I2CBus`](https://github.com/johntalton/2c-bus-tca9548a) for the TCA9548 Multiplexer
- A Proxy implementation over [`MessagePort`](https://github.com/johntalton/i2c-bus-) in order to provide further abstraction, and a [Web Service](https://github.com/johntalton/i2c-bus-service) that uses it.

## :book: I2CAddressedBus

An addressed wrapper for I²C bus interactions.
Providing a `I2CAddressedBus` interface to the device and wrapping an `I2CBus`.

```javascript
const ab = await I2CAddressedBus.from(i2cbus, busAddress)
const buffer = await ab.readI2cBlock(command, length)
```

## :book: I2CBusSoft16

Some `I2CBus` concret implementation do not directly support 16-bit register addresses in the `readI2cBlock` and `writeI2cBlock` methods.  This wrapper bus can be used to provided that feature by directly calling `i2cWrite` and `i2cRead` directly.

This may introduce differences in the interaction and timing of specific devices or underlying implementation expectation.

```javascript
const bus = /* I2CBus that may-or-may-not implement 16-bit addresses */
const bus16 = new I2CBusSoft16(bus)

// read 8 bytes from a 16-bit address 0x0402
// this will only use software version
// if not supported by the underlying `bus`
const buffer = await bus16.readI2cBlock([ 4, 2 ], 8)
```
npm package: @johntalton/aw9523
Description: An LED friendly, but also generally useful, Gpio device.
Latest version: 2.0.1

# AW9523

An LED friendly, but also generally useful, Gpio device.

[![npm Version](http://img.shields.io/npm/v/@johntalton/aw9523.svg)](https://www.npmjs.com/package/@johntalton/aw9523)
![GitHub package.json version](https://img.shields.io/github/package-json/v/johntalton/aw9523)
[![CI](https://github.com/johntalton/aw9523/actions/workflows/CI.yml/badge.svg)](https://github.com/johntalton/aw9523/actions/workflows/CI.yml)

# Example

Individual Pins need to be set to LED Mode in order to use Dimming

```javascript
import { I2CAddressedBus } from '@johntalton/and-other-delights'
import { AW9523, DEFAULT_ADDRESS, SET } from '@johntalton/aw9523'

const bus = /* I2CBus */
const aBus = new I2CAddressBus(bus, DEFAULT_ADDRESS)
const device = new AW9523(device)

const id = await device.getId()

const port = 0
const pin = 2
const dim = 42

const { mode } = await device.getMode(port)
mode[pin] = SET // update mode array for this Pin
await device.setMode(port, mode)
await device.setDimming(port, pin, dim)

```
npm package: @johntalton/bitsmush
Description: [![npm Version](https://img.shields.io/npm/v/@johntalton/bitsmush.svg)](https://www.npmjs.com/package/@johntalton/bitsmush) ![GitHub package.json version](https://img.shields.io/github/package-json/v/johntalton/bitsmush) ![CI](https://github.com/johntalto
Latest version: 1.0.4

# Bit Smush 🤗

[![npm Version](https://img.shields.io/npm/v/@johntalton/bitsmush.svg)](https://www.npmjs.com/package/@johntalton/bitsmush)
![GitHub package.json version](https://img.shields.io/github/package-json/v/johntalton/bitsmush)
![CI](https://github.com/johntalton/bitsmush/workflows/CI/badge.svg)
![GitHub](https://img.shields.io/github/license/johntalton/bitsmush)
[![Downloads Per Month](https://img.shields.io/npm/dm/@johntalton/bitsmush.svg)](https://www.npmjs.com/package/@johntalton/bitsmush)
![GitHub last commit](https://img.shields.io/github/last-commit/johntalton/bitsmush)

## :book: BitSmush

A namespace for binary operations.  All otherwise reserved operators for bit manipulation should be contained within.  Providing a single lint exception class encapsulation.

##### SmushMap

The methods `smushBits` and `unSmushBits` work given a template of the data offset and length.
This template (`SmushMap`) consists of an array of arrays that contain two numbers - the offset and length.

- Offset is calculated from the right most bit, starting at zero
- Length is number of bits to copy into destination.

Offset index numbering
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|

The following `SmushMap` `[[ 5, 2 ], [ 2, 2 ]]` with the source data `[3, 2]` will produce `0b00_11_0_10_0`
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
| 0  | 0  | `1` | `1` | 0 | `1` | `0` | 0  |

A bit-flags style `SmushMap` could be expressed as `[ [6, 1], [5, 1], [3, 1], [2, 1]]`.
Using the source data of `[ENABLED, ENABLED, DISABLED, ENABLED]` (aka `[1, ,1 ,0, 1]`)
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
| 0  | `1`  | `1` | 0 | `0` | `1` | 0 | 0 |

The following methods `smushBits` and `unSmushBits` work using these templates definitions.

### `smushBits` and `unSmushBits`

Packs or Unpacks multiple number values of specified length (in bits) into or out of a single 8-bit number given a `SmushMap` template.

```javascript
const template = [ [6, 1], [5, 3], [1, 2] ]
```

| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
| 0  | `X`  | `Y` | `Y` | `Y` | 0 | `Z` | `Z` |

```javascript
const source = [1, 3, 2]
const expected = 0b0_1_011_0_10 // 0x5A
const outRegister = BitSmush.packBits(template, source)
expect(outRegister).to.equal(expected)
```

And thus:

```javascript
const inRegister = 0x5A
const [one, three, two] = BitSmush.unpackBits(template, inRegister)
expect(one).to.equal(1)
expect(two).to.equal(2)
expect(three).to.equal(3)
```
npm package: @johntalton/drv2605
Description: Haptic Driver for ERM and LRA based on the [DRV2605](https://www.adafruit.com/product/2305) supporting full range of configuration options.
Latest version: 2.1.1

# DRV2605

Haptic Driver for ERM and LRA based on the [DRV2605](https://www.adafruit.com/product/2305) supporting full range of configuration options.

[![npm Version](http://img.shields.io/npm/v/@johntalton/drv2605.svg)](https://www.npmjs.com/package/@johntalton/drv2605)
![GitHub package.json version](https://img.shields.io/github/package-json/v/johntalton/drv2605)
[![CI](https://github.com/johntalton/drv2605/actions/workflows/CI.yml/badge.svg)](https://github.com/johntalton/drv2605/actions/workflows/CI.yml)

## Example
```javascript
const bus = /* underlying I2CBus implementation */
const DEFAULT_DRV2605L_ADDRESS = 0x5A
const abus = I2CAddressedBus(bus, DEFAULT_DRV2605L_ADDRESS)
const device = new DRV2605(abus)

// while the 26xxx series chips are similar this has only been tested with the 2605L
const DRV2605L_DEVICE_ID = 7
const { DEVICE_ID } = await device.getStatus()
if(DEVICE_ID !== DRV2605L_DEVICE_ID) { throw new Error('unknown device') }

// Set the Mode to internal trigger (aka Go) and take out of standby
await .setMode({
  DEV_RESET: false,
  STANDBY: false,
  MODE: 0
})

// Switch into ERM Mode (Eccentric Rotating Mass) width default settings
await device.setFeedbackControl({
  N_ERM_LRA: 0,       // ERM Mode,
  FB_BRAKE_FACTOR: 3, // 4x
  LOOP_GAIN: 1,       // Medium
  BEMF_GAIN: 2
})

// switch into open-loop
const control3 = await device.getControl3()
await device.setControl3({
  ...control3,
  ERM_OPEN_LOOP: 1 // open loop
})

//
// setup a Sequence of step to create a nice little buzz
//
await device.setWaveformSequencer1({
  WAV_FRM_SEQ: 88 // Transition Ramp Up Long Sharp 1 – 0 to 100%
})
await device.setWaveformSequencer2({
  WAV_FRM_SEQ: 52 // Pulsing Strong 1 – 100%
})
await device.setWaveformSequencer3({
  WAV_FRM_SEQ: 0 // End
})

//
// trigger a single run of the above defined sequence
//
await device.setGo({ GO: true })

```


 ### Note on implementation architecture
aka: note to self (or other developers interest in how all of this works - or doesn't)

 This driver (unlike other found here) use a Definition file base on the Register map provided in the datasheet.  While this 'simplifies' the implementation, it removes some of the ergonomics of the API.

 Specifically the setting of enumeration properties, and limits the ability to have dynamic enumeration base on configuration.

 It thus also has limited typing and documentation by default.

 This is viewed as a working experiment on the architecture of these drivers as we way to unify some of the more boilerplate code, and may likely change back to a more bespoke/handwritten version in the future.

 It however is tested and works generally well for its intended use cases.
npm package: @johntalton/ds1841
Description: Logarithmic Scale Digital Potentiometer ... Ya, its all that
Latest version: 2.0.1

# ds1841

Logarithmic Scale Digital Potentiometer ...
Ya, its all that

[![npm Version](http://img.shields.io/npm/v/@johntalton/ds1841.svg)](https://www.npmjs.com/package/@johntalton/ds1841)
![GitHub package.json version](https://img.shields.io/github/package-json/v/johntalton/ds1841)
[![CI](https://github.com/johntalton/ds1841/actions/workflows/CI.yml/badge.svg)](https://github.com/johntalton/ds1841/actions/workflows/CI.yml)



# Modes and Interactions

The device operates as a standard digital POT, it however does have some extra configuration that can enable its LUT mode.  It also stores Non-Volatile configuration for control register 1 and its IRV.

Its multiple states of updating via temperature to LUT to potential summation with the IRV give the chip a wide range of flexibility for the user.


# LUT (Lookup Table)

To compensate for temperature variations the devices has a lookup table which is indexed by the Temperature of the sensor.
This index can be updated via the table or manually.  Also the result of the index can be made to update the POTs value or set manually.

# Example

```javascript
import { I2CAddressedBus } from '@johntalton/and-other-delights'
import { DS1841 } from '@johntalton/ds1841'

const bus = /* I2CBus */
const aBus = new I2CAddressedBus(bus, 0x28)
const device = new DS1841(aBus)

await device.setIRV(42)
await device.setCR2({
  enableLUTValueUpdate: true,
  enableLUTAddressUpdate: true
})


```
npm package: @johntalton/ds3231
Description: Real Time Clock I²C driver library.
Latest version: 1.1.2

# DS3231

Real Time Clock I²C driver library.

[![npm Version](http://img.shields.io/npm/v/@johntalton/ds3231.svg)](https://www.npmjs.com/package/@johntalton/ds3231)
![GitHub package.json version](https://img.shields.io/github/package-json/v/johntalton/ds3231)
![CI](https://github.com/johntalton/ds3231/workflows/CI/badge.svg)
![GitHub](https://img.shields.io/github/license/johntalton/ds3231)
[![Downloads Per Month](http://img.shields.io/npm/dm/@johntalton/ds3231.svg)](https://www.npmjs.com/package/@johntalton/ds3231)
![GitHub last commit](https://img.shields.io/github/last-commit/johntalton/ds3231)

# API

### `from`

```javascript
import { I2CAddressedBus } from '@johntalton/and-other-delights'
import { DS3231, CENTURY } from '@johntalton/ds3231'

const bus = /* byob */
const aBus = new I2CAddressedBus(bus)
const device = DS3231.from(aBus)

```

### `getTime`

```javascript
const { year, month, date, hours, minutes, seconds } = time

const storedDate = new Date(Date.UTC(
  CENTURY + year,
  month - 1,
  date,
  hours, minutes, seconds))

console.log(storedDate)

```

### `getAlarm1`

### `getAlarm2`

### `getControl`

### `getStatus`

Return object has these flags:
- `oscillatorStoppedFlag`
- `busyFlag`
- `alarm1Flag`
- `alarm2Flag`

as well as a status of the 32kHz output
- `output32kHzEnabled`


### `getAgingOffset`

### `getTemperature`

### `setTime`

Setting the time from an external known source is for useful clock functionality.  The values can be set as desired, but `Date.now()` seem a good choice:

```javascript
const device = /* ... */

const now = new Date(Date.now())

const seconds = now.getUTCSeconds()
const minutes = now.getUTCMinutes()
const hours = now.getUTCHours()
const date = now.getUTCDate()
const month = now.getUTCMonth() + 1
const year = now.getUTCFullYear() - CENTURY

await device.setTime({
  seconds, minutes, hours, date, month, year
})

```

### `setAlarm1`

### `setAlarm2`

### `setControl`

Enable the Alarms, toggle Interrupt / Square Wave output, and set backup battery mode for the oscillator and square wave functionality.

### `setStatus`

Useful for clearing the Oscillator stopped flag, or either of the alarm flags

### `setAgingOffset`