Commit 5c7d40f6 authored by Katie Isard's avatar Katie Isard
Browse files

adding wk14 and wk7 bits

parent 41298a88
Pipeline #240856 passed with stage
in 30 seconds
/*
TinyWireM.h - a wrapper(+) class for TWI/I2C Master library for the ATtiny on Arduino
1/21/2011 BroHogan - brohoganx10 at gmail dot com
Thanks to 'jkl' for the gcc version of Atmel's USI_TWI_Master code
http://www.cs.cmu.edu/~dst/ARTSI/Create/PC%20Comm/
I added Atmel's original Device dependant defines section back into USI_TWI_Master.h
NOTE! - It's very important to use pullups on the SDA & SCL lines! More so than with the Wire lib.
USAGE is modeled after the standard Wire library . . .
Put in setup():
TinyWireM.begin(){ // initialize I2C lib
To Send:
TinyWireM.beginTransmission(uint8_t slaveAddr){ // setup slave's address (7 bit address - same as Wire)
TinyWireM.send(uint8_t data){ // buffer up bytes to send - can be called multiple times
someByte = TinyWireM.endTransmission(){ // actually send the bytes in the buffer
// returns (optional) 0 = sucess or see USI_TWI_Master.h for error codes
To Receive:
someByte = TinyWireM.requestFrom(uint8_t slaveAddr, uint8_t numBytes){ // reads 'numBytes' from slave's address
// (usage optional) returns 0= success or see USI_TWI_Master.h for error codes
someByte = TinyWireM.receive(){ // returns the next byte in the received buffer - called multiple times
someByte = TinyWireM.available(){ // returns the number of unread bytes in the received buffer
TODO: (by others!)
- merge this class with TinyWireS for master & slave support in one library
This library is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 2.1 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
*/
#ifndef TinyWireM_h
#define TinyWireM_h
#include <inttypes.h>
#define USI_SEND 0 // indicates sending to TWI
#define USI_RCVE 1 // indicates receiving from TWI
#define USI_BUF_SIZE 16 // bytes in message buffer
class USI_TWI
{
private:
static uint8_t USI_Buf[]; // holds I2C send and receive data
static uint8_t USI_BufIdx; // current number of bytes in the send buff
static uint8_t USI_LastRead; // number of bytes read so far
static uint8_t USI_BytesAvail; // number of bytes requested but not read
public:
USI_TWI();
void begin();
void beginTransmission(uint8_t);
void send(uint8_t);
uint8_t endTransmission();
uint8_t requestFrom(uint8_t, uint8_t);
uint8_t receive();
uint8_t available();
};
extern USI_TWI TinyWireM;
#endif
......@@ -341,6 +341,23 @@
</pre>
<h3>Global evaluation</h3>
<p>As pointed out I have used Luiz board therefore means I needed to redo this week with a board I had designed myself, so I went back and used my board from <a href="http://fabacademy.org/2021/labs/plusx/students/katie-isard/week11.html">week11</a> which I didn't use because the sketch was too large. But it was suggested that I use 'TinyWireM.h' onto my ATtiny44 and then use an Arduino uno and put on it 'Wire.h'.</p>
<p><b>THIS WORKED WOOHOO!!</b></p>
<p>
<img src="images/week14/networking_wk.jpeg" height="700" alt="networking_wk">
</p>
<p>I honestly really struggled with this week and having to do it 3 times over really has made it clear I will not be doing networking between two boards for a while haha.</p>
<p>
<a href="files/week14/TinyWireM.h.ino">sketch of TinyWireM.h .ino</a>
</p>
<h4>Design Files:</h4>
<p>These are my traces and outlines for my edited board, if you need Luiz outline and traces <a href="https://drive.google.com/drive/folders/12CahARt2xojdS4rMmZaLwhNCXWHOi5Yf">click here</a></p>
......
......@@ -218,8 +218,8 @@
<p>because my stool was too large for the machine I used two different size of stock</p>
<ul>
<li>stock 01 for legs = </li>
<li>stock 02 for top = </li>
<li>stock 01 for legs = 100 x 1200 mm</li>
<li>stock 02 for top = 500 x 500 mm </li>
</ul>
<h3>Legs</h3>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment