Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
weavingcodes
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dave Griffiths
weavingcodes
Commits
ebcaa3b5
Commit
ebcaa3b5
authored
Nov 26, 2014
by
Dave Griffiths
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attiny forgotten bits
parent
a5a1d022
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
flotsam/avr/attiny85/i2c_master.cpp
flotsam/avr/attiny85/i2c_master.cpp
+39
-0
flotsam/avr/attiny85/make_old
flotsam/avr/attiny85/make_old
+3
-0
No files found.
flotsam/avr/attiny85/i2c_master.cpp
0 → 100644
View file @
ebcaa3b5
//#define F_CPU 1200000UL
#include <avr/io.h>
#include <util/delay.h>
#include "tinywirem/TinyWireM.h" // I2C Master lib for ATTinys which use USI
typedef
unsigned
char
u8
;
typedef
unsigned
int
u32
;
#define LED PB1
void
set_led_state
(
u8
s
)
{
if
(
s
)
PORTB
|=
_BV
(
LED
);
else
PORTB
&=~
_BV
(
LED
);
}
int
main
(
void
)
{
sei
();
DDRB
=
0x00
;
DDRB
|=
_BV
(
LED
);
TinyWireM
.
begin
();
u32
led_counter
=
0
;
while
(
1
)
{
TinyWireM
.
requestFrom
(
0x32
,
1
);
// Request 1 byte from slave
u8
t
=
TinyWireM
.
receive
();
// get the temperature
set_led_state
((
led_counter
++
)
%
2
);
_delay_ms
(
1000
);
}
}
flotsam/avr/attiny85/make_old
0 → 100755
View file @
ebcaa3b5
avr-gcc -DAVR -Wall -Os -mmcu=attiny85 -o i2c.elf i2c.c usi_i2c_slave.c
avr-objcopy --output-target=ihex i2c.elf i2c.ihex
avrdude -c usbtiny -p t85 -e -U flash:w:i2c.ihex -U lfuse:w:0xE2:m
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment