-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
8,315 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//% color="#275C6B" weight=100 icon="\uf2db" block="COM-EEPROM-32" | ||
namespace COMEEPROM32 { | ||
let eepromADDR = 0x50; | ||
|
||
/** | ||
* Writes data to the EEPROM storage | ||
* @param data The data that is supposed to be written | ||
* @param address The address of the EEPROM where the data is supposed to be stored | ||
*/ | ||
//% block="write %dat to EEPROM address %addr" | ||
//% weight=100 | ||
export function eepromWrite(data: number, address: number): void { | ||
let buf = pins.createBuffer(3); | ||
|
||
buf[0] = address >> 8; | ||
buf[1] = (address & 0xFF); | ||
buf[2] = data; | ||
pins.i2cWriteBuffer(eepromADDR, buf) | ||
} | ||
|
||
/** | ||
* Reads data from the EEPROM storage | ||
* @param address The address of the EEPROM where the data is supposed to be read from | ||
*/ | ||
//% block="read byte from EEPROM address %addr" | ||
//% weight=99 | ||
export function eepromRead(address: number): number { | ||
pins.i2cWriteNumber(eepromADDR, address, NumberFormat.UInt16BE); | ||
return pins.i2cReadNumber(eepromADDR, NumberFormat.UInt8BE); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,36 @@ | ||
# pxt-COM-EEPROM-32 | ||
This library provides a Microsoft Makecode package for the Joy-IT COM-EEPROM-32 | ||
# MakeCode Package for the Joy-IT COM-EEPROM-32 | ||
|
||
This library provides a Microsoft Makecode package for the Joy-IT COM-EEPROM-32. See https://joy-it.net/products/COM-EEPROM-32 for more details. | ||
|
||
## Overview | ||
|
||
This EEPROM memory allows you to store and read data externally via the I2C interface of your microcontroller. | ||
|
||
## Connection | ||
|
||
| COM-EEPROM-32 | Micro:Bit | | ||
|:------------------------:|:----------------------------------:| | ||
| VCC | 3,3 V | | ||
| SCL | P19 (SCL) | | ||
| SDA | P20 (SDA) | | ||
| GND | GND | | ||
|
||
## Example | ||
|
||
### Write data | ||
|
||
You can write up to 32 kB of data to the EEPROM by using the **COMEEPROM32.eepromWrite(data, address)** function. Both parameters, **data** and **address**, need to be a number. | ||
|
||
```typescript | ||
// Write number 12345 to address 5 | ||
COMEEPROM32.eepromWrite(12345, 5); | ||
``` | ||
|
||
### Read data | ||
|
||
Data can be read out by using the **COMEEPROM32.eepromRead(address)** function. | ||
|
||
```typescript | ||
// Read data from address 5 | ||
COMEEPROM32.eepromRead(5) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"COMEEPROM32.eepromRead": "Liest Daten aus dem EEPROM-Speicher", | ||
"COMEEPROM32.eepromRead|param|address": "Die Adresse des EEPROM, aus dem die Daten gelesen werden sollen", | ||
"COMEEPROM32.eepromWrite": "Schreibt Daten in den EEPROM-Speicher", | ||
"COMEEPROM32.eepromWrite|param|address": "Die Adresse des EEPROM, in dem die Daten gespeichert werden sollen", | ||
"COMEEPROM32.eepromWrite|param|data": "Die Daten, die geschrieben werden sollen" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"COMEEPROM32.eepromRead|block": "Byte von EEPROM-Adresse %addr lesen", | ||
"COMEEPROM32.eepromWrite|block": "Schreiben von %dat in EEPROM-Adresse %addr", | ||
"COMEEPROM32|block": "COM-EEPROM-32", | ||
"{id:category}COMEEPROM32": "COM-EEPROM-32" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"COMEEPROM32.eepromRead": "Reads data from the EEPROM storage", | ||
"COMEEPROM32.eepromRead|param|address": "The address of the EEPROM where the data is supposed to be read from", | ||
"COMEEPROM32.eepromWrite": "Writes data to the EEPROM storage", | ||
"COMEEPROM32.eepromWrite|param|address": "The address of the EEPROM where the data is supposed to be stored", | ||
"COMEEPROM32.eepromWrite|param|data": "The data that is supposed to be written" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"COMEEPROM32.eepromRead|block": "read byte from EEPROM address %addr", | ||
"COMEEPROM32.eepromWrite|block": "write %dat to EEPROM address %addr", | ||
"COMEEPROM32|block": "COM-EEPROM-32", | ||
"{id:category}COMEEPROM32": "COM-EEPROM-32" | ||
} |
Oops, something went wrong.