Commit graph

200 commits

Author SHA1 Message Date
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
Nicholas J Humfrey 1cda3da17e Converted u8_t to uint8_t and u16_t to uint16_t in the cpu directory. 2012-02-21 08:33:24 -05:00
David Kopf 987906be97 rf230bb updates: involves setting the 801.15.4 pending bit,
0x800000 cpu clock, and a jtag reset bugfix
2012-02-01 14:16:39 -07:00
Ivan Delamer 57e686179c Improved rf230bb.c synchronization/locking. Removed unnecessary locks
during Tx (single-threaded environment). Added protection to Rx thread
from buffer access by ISR.
2012-02-01 13:37:45 -07:00
David Kopf 7ca141b457 Access uart registers directly instead of through intermediate addresses in a RAM struct.
Add a platform define to reduce the number of ports supported by the cpu.
2012-01-21 13:49:58 -05:00
David Kopf 58298f59db Add F_CPU=0x800000 option with phase lock to external 32768 Hz crystal
Add MCU_CONF_LOW_WEAR option to avoid eeprom writes during development.
2012-01-10 12:42:27 -05:00
David Kopf 81af871db9 Bugfix: use 16 bit tick count to adjust clock after sleep 2011-12-01 09:58:55 -05:00
David Kopf fb977cb9ef Better fix for hardware FCS error on JTAG reset
Correct silly error introduced by trying to save two bytes.
2011-11-15 13:24:58 -05:00
David Kopf 31ba84eb75 Improve rf23x cca procesing
Fix delay_loop timing bug by using long long calculation.
128rfa1 and rf230 both working with contikimac RDC
2011-11-14 11:49:58 -05:00
David Kopf d1cd3f213c Add general unsupported interrupt vector suggested by Daniel Willmann 2011-11-14 11:36:18 -05:00
David Kopf 6eba721af1 Add rtimer_arch_sleep function, enabled with RDC_CONF_MCU_SLEEP 2011-11-14 11:10:35 -05:00
David Kopf c2364897f8 atmega128rfa1 cca fixes, energest and rimestat macros.
Add option to return ACK to RDC layer when in extended mode, based on Georg von Zengen code.
2011-11-08 12:20:22 -05:00
David Kopf f721f646fa Adjust sleep time by ticks instead of seconds, proposed by Ivan Delamer 2011-09-10 12:44:49 -04:00
David Kopf dfdae5b02b This fixes commit 9a1ce7 for spaces instead of .... 2011-08-31 12:08:01 -04:00
David Kopf 470887eddd Print elf size if ELF_SIZE is defined 2011-08-31 11:50:14 -04:00
David Kopf 9a1ce7cf75 Use enumerated tx return values 2011-08-31 11:40:23 -04:00
David Kopf 5f2b2074f0 Implement WITH_RPL option in makefile 2011-08-28 16:11:48 -04:00
David Kopf bdec65b889 Fix typos and file endings 2011-08-28 16:04:36 -04:00
David Kopf 94fc40f736 Move LEDONPORTE1 define to contiki-conf.h, fixing typo. 2011-08-24 11:35:58 -04:00
David Kopf 09db159876 128rfa1 cca fix, NETSTACK_RADIO.off now returns 0/1 if radio off/on 2011-08-18 14:36:04 -04:00
David Kopf 53737d9a38 Use correct prescale factor 2011-08-18 13:58:20 -04:00
David Kopf 3ea102050b Apply patch of Ivan Delamer for atmega1281 @ 4 MHz 2011-08-17 13:16:46 -04:00
David Kopf 36fa735323 Calculate best prescaler based on F_CPU and CLOCK_CONF_SECONDS. Inspired by patch from Ivan Delamer. 2011-08-17 13:15:26 -04:00
maniacbug 0990896f54 Added an .eu target to upload only the eeprom for AVR cpu. 2011-08-16 14:10:48 -04:00