Commit graph

223 commits

Author SHA1 Message Date
Harald Pichler a02be51f08 Merge branch 'contiki' into osd 2014-12-07 15:24:00 +01:00
Nicolas Tsiftes 9e7927e415 Merge pull request #765 from ejoerns/pull-req/avr-asflags
[avr] Add mcu parameter to ASFLAGS
2014-12-02 19:16:14 +01:00
Nicolas Tsiftes 9b90c378e8 Merge pull request #812 from kkrentz/packetbuf-holds-broadcast
packetbuf_holds_broadcast()
2014-11-28 19:15:19 +01:00
Josef Lusticky c6bea7d0e7 avr: fix divide when CLOCK_SECOND is not a power of two 2014-11-26 22:47:50 +01:00
Ralf Schlatterbeck f0ad042bfc Minor optimisations of timer init 2014-11-19 13:53:21 +01:00
Ralf Schlatterbeck fd54bc9ca4 Inline timer init functions, no static storage
Hardware init function profit a great deal from being inlined if the
given parameters are constant -- which is the common use-case, we could
probably call this for all timers and still have less overhead. The
hwtimer_pwm_ini (which calls hwtimer_ini) gets completely computed at
compile-time resulting only in the register settings of hwtimer_ini.

This is now possible because we get rid of static storage for the
max_ticks and instead compute this in hwtimer_pwm_max_ticks from the
timer register settings.
2014-11-19 13:52:42 +01:00
Ralf Schlatterbeck 08abd8807d Fixes for platform timer code
Some platforms are missing timer channels, this is now left to the
(missing) preprocessor definitions on those platforms, no
platform-specific defines needed anymore.
Also fix usage of timer counter register 3 (hardcoded) in
cpu/avr/dev/clock.c -- this code isn't used on many platforms as it
requires a very special quartz clock frequency but this now also uses
the platform timer specification.
2014-11-19 13:48:42 +01:00
Ralf Schlatterbeck b6be226e69 Add Arduino compatibility layer
We can now directly compile arduino sketches (.pde) files.
Arduino compatible analogWrite works now.
But there is still a long way to go, serial I/O and timer stuff (delay,
millis etc) currently don't work (not tested but I don't expect this to
work).
It can be used in an arduino sketch or in a normal contiki program.
We get a PWM frequency of 490.2 Hz (a period of 2.040 ms), that's
Arduino compatible. If you need different frequencies see native timer
usage in examples/osd/pwm-example
In a contiki program you have to call arduino_pwm_timer_init to
initialize the timer before pwm works. The arduino sketch wrapper
already does this.
For running a sketch, see examples/osd/arduino-sketch
2014-11-19 13:48:05 +01:00
Ralf Schlatterbeck b17934c491 Allow compilation of c++ files (extension .cpp) 2014-11-19 13:47:51 +01:00
Ralf Schlatterbeck cfec3c6e2d Initial implementation of avr hardware timer
Mainly for PWM use for now.
With example to set the LED to different brightness via COAP.
We switch the LED with 50 kHz (20µs) in this example.
2014-11-19 13:47:37 +01:00
Ralf Schlatterbeck 4ceffb090d Make HW timer for contiki rtimer configurable
... and configure osd platform to use timer 5. With the new
configuration we can use timer 3 for generating hardware PWM.
2014-11-19 13:44:55 +01:00
Harald Pichler 34d64b4eb0 bugfix blockmode, 8 Hz dutycyle as standard 2014-11-19 13:34:07 +01:00
kkrentz fb00a217f5 packetbuf: Use packetbuf_holds_broadcast() all-over 2014-11-13 09:58:08 -08:00
Fredrik Österlind 03a923b6b9 Merge pull request #782 from ejoerns/pull-req/avr-mcucsrfix
[avr] Removed usage of deprecated MCUSR
2014-11-13 10:25:30 +01:00
Enrico Joerns 0b8769e576 [doc] Various fixes for doxygen grouping etc. 2014-11-10 23:53:32 +01:00
Enrico Joerns 8cc0bb8a1e [avr] Removed usage of deprecated MCUSR
Since avr-libc 1.8.0 MCUSR is marked as poison as it was replaced by the
correct name MCUCSR.
Thus code still using the old MCUSR name does not compile anymore.

This commit replaces usages of former MCUSR by its new name MCUCSR and
modifies the alias fallback accordingly.
2014-08-30 01:58:18 +02:00
Enrico Joerns 351e4e9fba [avr] added missing mcu parameter to ASFLAGS in order to enable assembler compilation 2014-07-10 11:31:41 +02:00
Adam Dunkels def57199b9 Merge pull request #511 from ADVANSEE/leds
leds: Fixes and enhancements
2014-06-11 22:37:34 +02:00
Adam Dunkels 64f65b4e45 Merge pull request #617 from nfi/extended-radio-api
Extended radio API with support for setting channel, pan id, addressing modes, etc
2014-06-03 21:32:53 +02:00
Rémy Léone 25c8b0835d Closing doxygen groups 2014-05-30 11:01:20 +02:00
Niclas Finne cb3e053232 Added stub for extended radio API for rf230 2014-04-03 13:38:20 +02:00
Adam Dunkels 45265249fc Changed the name of the rimeaddr module to linkaddr 2014-01-29 20:12:24 +01:00
Adam Dunkels 0b805e4763 Moved the cc2420 driver into a separate dev/cc2420 module 2014-01-26 23:20:27 +01:00
Benoît Thébaudeau 7f48057b9e leds: Fix the API
The leds API did not work in some cases. E.g. with the following sequence:
  leds_off(LEDS_ALL);
  leds_toggle(LEDS_GREEN);
  leds_off(LEDS_ALL);
the green LED was remaining on after the last call.

This was caused by the toggle feature made synonymous with the invert feature,
although it is unrelated. leds_toggle() is indeed supposed to toggle an LED,
while leds_invert() is supposed to change the active level of an LED. However,
all users of leds_invert() actually meant leds_toggle(), and the invert feature
does not make sense in this module because it is not handy due to successive
calls to leds_invert() changing the intended behavior, and hardware active
levels should be managed in leds_arch_set() (e.g. by XORing the passed value
with a hardware-specific constant before setting the output levels of the pins).

Consequently, this change:
 - removes the leds_invert() function,
 - makes leds_toggle() behave as expected relatively to leds_off() / leds_on(),
 - sanitizes the code in the leds module.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2014-01-07 13:02:41 +01:00
Adam Dunkels bb2dcaa057 A massive all-tree automated update of all double inclusion guard #defines that changes from using two underscores as a prefix, which are reserved, to not using two underscores as a prefix 2013-11-24 20:20:11 +01:00
Adam Dunkels 30c0c5eaf6 Removed old unused timetable code 2013-11-19 08:29:23 +01:00
Werner Almesberger be0a296049 cpu/avr/radio/rf230bb/rf230bb.c (rf230_transmit): extend comment on tx sequence
Explain that the transmission is intentionally started before copying the
frame to the buffer.
2013-07-28 18:43:29 -03:00
Peter A. Bigot 5fc0575e99 Makefile.include: support make clean all
Historically $(OBJECTDIR) was created when Makefile.include is read.  A
consequence is that combining "clean" with "all" (or any other build
target) results in an error because the clean removes the object
directory that is required to exist when building dependencies.
Creating $(OBJECTDIR) on-demand ensures it is present when needed.

Removed creation of $(OBJECTDIR) on initial read, and added an order-only
dependency forcing its creation all Makefile* rules where the target is
explicitly or implicitly in $(OBJECTDIR).
2013-06-20 17:45:41 -05:00
Nicolas Tsiftes a445c4020d Merge pull request #153 from darconeous/pull-requests/cpu-avr-bootloader
avr/bootloader.c: Now compatible with bootloaders which always run first
2013-05-20 05:49:13 -07:00
Robert Quattlebaum 674f70b6c3 cpu/avr: Added "AVRDUDE_MCU" configuration parameter. 2013-05-19 14:23:31 -07:00
Robert Quattlebaum 9c17a542a7 avr/bootloader.c: Now compatible with bootloaders which always run first.
The boot loader now knows when to go into bootstrap mode by
looking for a specific EEPROM value. Also updated code style
to match Contiki code style guidelines.
2013-05-19 08:21:16 -07:00
Robert Quattlebaum 28a1e40ebd core/lib/settings: Generalized Settings Manager to work on any platform
This commit moves the Settings Manager from the AVR codebase
into the Contiki core library. Any platform that implements
the Contiki EEPROM API can now use the Settings Manager's
key-value store for storing their persistent configuration info.

The Settings Manager is a EEPROM-based key-value store. Keys
are 16-bit integers and values may be up to 16,383 bytes long.
It is intended to be used to store configuration-related information,
like network settings, radio channels, etc.

 * Robust data format which requires no initialization.
 * Supports multiple values with the same key.
 * Data can be appended without erasing EEPROM.
 * Max size of settings data can be easily increased in the future,
   as long as it doesn't overlap with application data.

The format was inspired by the [OLPC manufacturing data format][].

Since the beginning of EEPROM often contains application-specific
information, the best place to store settings is at the end of EEPROM
(the "top"). Because we are starting at the end of EEPROM, it makes
sense to grow the list of key-value pairs downward, toward the start of
EEPROM.

Each key-value pair is stored in memory in the following format:

Order    | Size     | Name         | Description
--------:|---------:|--------------|-------------------------------
       0 |        2 | `key`        | 16-bit key
      -2 |        1 | `size_check` | One's-complement of next byte
      -3 |   1 or 2 | `size`       | The size of `value`, in bytes
-4 or -5 | variable | `value`      | Value associated with `key`

The end of the key-value pairs is denoted by the first invalid entry.
An invalid entry has any of the following attributes:

 * The `size_check` byte doesn't match the one's compliment of the
   `size` byte (or `size_low` byte).
 * The key has a value of 0x0000.

[OLPC manufacturing data format]: http://wiki.laptop.org/go/Manufacturing_data
2013-03-20 11:57:13 -07:00
Robert Quattlebaum 67a39618eb cpu/avr: Make sure that GCC removes all unused symbols.
This magic comes from the `--gc-sections` linker flag, which turns on garbage collection for unused input sections. The compiler flags `-ffunction-sections` and `-fdata-sections` make sure that each function and each static data definition have their own section. The result is that GCC can prune away all unused symbols, reducing the size of the resulting executable.

These optimizations may be disabled by setting the Makefile variable
`SMALL` to zero.
2013-02-28 21:59:19 -08:00
Nicolas Tsiftes 42e4b2b02a Merge pull request #143 from idelamer/master
Bug fix for Issue #88
2013-02-24 15:26:38 -08:00
Ivan Delamer c22838b9d3 Enable Timer1 on Raven so that interrupts coming from radio, which are
connected to input capture, fire again.
2013-02-15 16:08:37 -07:00
Adam Dunkels 1af22fa4fe Removed old unused RTL8019 code that had license issues 2012-10-29 16:08:09 +01:00
Adam Dunkels 944537fccf Removed all old RCS tags in the Contiki source tree. Those RCS tags are not used any more, as we are now using git to manage the Contiki source tree 2012-10-26 15:54:49 +02:00
Ivan Delamer b43dad00b0 Cleaned up RF230BB, and refactored FRAME_RETRIES and CSMA_RETRIES
#defines.
2012-09-04 11:12:18 -06:00
Ivan Delamer 2e72ec3594 Place ATmega1281 define in correct section (it does have compare C
unit, avoid duplicate define and compiler warning).
2012-09-01 15:22:13 -06:00
Ivan Delamer 5636357243 Fix RF230 transition: RX_AACK_ON -> TX_ARET_ON (go through PLL_ON,
as per datasheet). Tested on RF230 and 128RFA1 (RF231).
2012-09-01 15:20:00 -06:00
Ivan Delamer 17a62a649c ATmega128RFA1 bug fix: no interrupt pin used (embedded radio).
Enabling interrupt caused MCU reset if using pin as GPIO.
2012-07-10 14:36:47 -06:00
David Kopf e9a55cc222 Enable check on received length to prevent buffer overflow. Thank you Cooja! 2012-05-28 13:02:23 -04:00
David Kopf d6dc216e02 Reorder includes to prefer platform routines. Remove redundant RPL define. 2012-04-27 16:54:09 -04:00
David Kopf cac4e9a222 Add clock_delay_us and clock_set_seconds to clock.h. Modify clock_wait to use clock_time_t.
Remove the troublesome avr/dev/delay.* files.
Add PLATFORM_NAME and combine the confusing *_REVISION defines into a single PLATFORM_TYPE
2012-04-09 15:49:53 -04:00
David Kopf 40bd020394 Fix wrong register addresses. 2012-04-09 09:58:12 -04:00
David Kopf 2b7ecefce7 Remove unused SPI initializer flag from AVR. Comment out in the msp-430 template. 2012-02-27 17:05:22 -05:00
Ilya Dmitrichenko 9c99d46e24 Simplified host OS platform detection in Makefiles 2012-02-25 10:09:33 -05:00
David Kopf deb75d3d97 Several bugfixes 2012-02-21 11:14:52 -05:00
David Kopf 59e459e0e9 Add missing mtarch_stop function 2012-02-21 11:11:53 -05:00
David Kopf 6e45dfe5ff PROGMEM changes needed for newer avr-gcc compiler 2012-02-21 11:10:57 -05:00