Giter Site home page Giter Site logo

mikaelpatel / cosa Goto Github PK

View Code? Open in Web Editor NEW
339.0 50.0 76.0 45.13 MB

An Object-Oriented Platform for Arduino/AVR

Home Page: https://mikaelpatel.github.io/Cosa/

License: GNU Lesser General Public License v2.1

Makefile 1.53% Shell 0.14% Python 1.28% C 43.56% C++ 53.50%
cosa arduino-boards lilypad-arduino arduino framework c-plus-plus arduino-platform arduino-firmware

cosa's Introduction

Che Cosa?

Cosa is an object-oriented platform for Arduino. It replaces the Arduino and Wiring library with a large set of integrated classes that support the full range of AVR/ATmega/ATtiny internal hardware modules; all pin modes, Digital, and Analog Pins, External and Pin Change Interrupts, Analog Comparator, PWM, Watchdog, Timer0/Timer2 (RTT), Timer1 (Servo/Tone/VWI), Input Capture, UART, USI, SPI, TWI and EEPROM. Cosa supports several programming paradigms including Multi-Tasking, Event Driven Programming and UML Capsules/Actors. Cosa contains over 200 classes and nearly as many example sketches to get started.

Please note that Cosa is not an Arduino core; Cosa does not implement the Arduino API. Sketches written with Cosa may be built with the Arduino IDE or with the command line based build support for Linux.

Cosa supports the Arduino Boards Manager install. Simply install by adding the Cosa Package URL to the Additional Boards Manager URLs in the IDE Preferences; https://raw.githubusercontent.com/mikaelpatel/Cosa/master/package_cosa_index.json

More details are available:

Cosa API

The API documentation is available:

The documentation contains a full hyperlinked description of all functions in Cosa together with UML graphs of the class hierarchy, include dependencies, and much more.

The provided documentation is generated with doxygen and may also be generated for users source code if the Cosa documentation style is adapted. See the Doxyfile for configuration of doxygen.

Supported Boards and MCUs

Cosa has built-in support for a large number of boards and clones/vendors. It also supports breadboards and custom-design boards with AVR MCUs.

References

  1. D.tools, http://hci.stanford.edu/research/dtools/
  2. Processing, http://processing.org/
  3. Wiring, http://wiring.org.co/
  4. Quantum Leaps, http://www.state-machine.com/
  5. Concurrency.cc, http://concurrency.cc/
  6. Arduino, http://www.arduino.cc/
  7. Firmata, http://www.firmata.org/wiki/Main_Page
  8. LilyPad, http://web.media.mit.edu/~leah/LilyPad/
  9. Adafruit, http://www.adafruit.com/
  10. Microduino, http://www.microduino.cc/
  11. Jeelabs, http://jeelabs.org/
  12. Teensy, https://www.pjrc.com/
  13. Pinoccio, https://pinocc.io/
  14. LowPowerLab, http://lowpowerlab.com/
  15. Anarduino, http://www.anarduino.com/
  16. Wicked Device, http://shop.wickeddevice.com/
  17. MQTT, http://mqtt.org/
  18. ThingSpeak, https://thingspeak.com/

Naming

  • "Ciao"; interjection hello!, goodbye!.
  • "Che cosa"; pronoun; what.
  • "Cosa"; noun thing, matter; pronoun; what?, what!.
  • "Cosa fai"; what do you do?
  • "Nucleo"; kernel.
  • "Rifare"; remake.
  • "Rete"; network.
  • "Tutto"; all.

Stay tuned

Please follow the development of this project on the blog http://cosa-arduino.blogspot.se and on the Arduino forum, http://arduino.cc/forum/index.php/topic,150299.0.html.

Supporting this project

There are many ways to support this project.

  1. Build and test.
  2. Fix bugs and take part in the development work.
  3. Write blog or instructions on how you have used Cosa in your project(s).
  4. Donate hardware; Arduino boards and shields. This is especially welcome as with the growning number of device drivers and supported modules that require hardware setups which takes a lot of time if breadboarded.
  5. Or donations through paypal (use email address).

If you are planning to use Cosa you are encouraged to support the project to help keep the software at high quality and follow changes in tooling, and above all open-source.

Please note that the issues list should be used mainly for bug reports and enhancement requests. Design and implementation support is only provided to contributing projects.

cosa's People

Contributors

dansut avatar ericyanush avatar janpavlis avatar kc9jud avatar mikaelpatel avatar mogball avatar oddstr13 avatar shahzadlone avatar slashdevin avatar thomasahlendorf avatar tht avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cosa's Issues

Registry abstraction for protocols

The PROGMEM structure in Cosa/Menu could be abstracted to handle a generic Registry. A variant of SNMP protocol could then be implemented to access configuration, state and activate/apply functions.

Cosa version of Tone?

Hello! Are there any plans to implement a version of Tone into the Cosa platform?

These libraries seem to be superior to the built-in Tone function and may be a good place to start:
https://code.google.com/p/arduino-tone-ac/

Also, it would be nice if the timer# was selectable to avoid conflicts with other timer-controlling libraries -- similar to what came out of this thread:
http://arduino.cc/forum/index.php?PHPSESSID=6ba682882315bad2bee08a6b21f58ff0&topic=157602.0

Thanks!

Common Interface for Wireless devices

How about a common interface as IOStream but for Wireless devices? There is a need for a simple package oriented radio protocol with addressing, boardcasting, etc.

DS18B20 parasited mode

Hi,
DS18B20 works well in normal mode,
but I can't see anything to use parasited mode.

normal mode :
DS18B20
PIN 1 : VCC
PIN 2 : ONEWIRE DATA
PIN 3 : GND

parasited mode (see datasheet for differences in command sequences):
DS18B20
PIN 1 : GND
PIN 2 : ONEWIRE DATA
PIN 3 : GND

guillaume.

Cleanup RTC

It should be possible to cleanup the RTC interrupt handlers as the previous conflict with Arduino micros/millis has ben removed.

Should allow a faster ISR.

Allow dynamic LCD Menu Range variables

The current LCD Menu Range variable has fixed boundary values in program memory (lower..upper). In some applications the range is defined by other settings (e.g. number of days in a month).

Additional serial protocol for secure link

Consider adding a frame based serial protocol to allow secure transmission (on any iostream device).

The frame should allow acknowledgement and retransmission but also error detection. Possible starting points are DHLC and PPP. See also QPspy and possible usage to transmit events.

Please explain how to use uart1-3 for Mega2560

In the Cosa - Arduino forum, the last message on how to use uart1-3 for the Mega2560 states:

static char ibuffer1[UART::BUFFER_MAX];
static IOBuffer ibuf1(ibuffer1, sizeof(ibuffer1));
static char obuffer1[UART::BUFFER_MAX];
static IOBuffer obuf1(obuffer1, sizeof(obuffer1));
UART uart1(1, &ibuf1, &obuf1);
...
void setup()
{
   ...
   UART_SETUP(1, uart1);
   uart1.begin(9600);
   ...
}

But I get these compilation errors:

SerialRxHF:17: error: invalid use of template-name 'IOBuffer' without an argument list
SerialRxHF:19: error: invalid use of template-name 'IOBuffer' without an argument list
SerialRxHF:20: error: 'ibuf1' was not declared in this scope
SerialRxHF:20: error: 'obuf1' was not declared in this scope

Some of the recent commits have been changes to the IOBuffer class/template class?

I tried this too:

static IOBuffer<UART::BUFFER_MAX> ibuf1;
static IOBuffer<UART::BUFFER_MAX> obuf1;
UART uart1(1, &ibuf1, &obuf1);

And got these compilation errors:

core.a(HardwareSerial.cpp.o): In function `__vector_25':
E:\Portable Apps\arduino-1.0.4\hardware\arduino\cores\arduino/HardwareSerial.cpp:118: multiple definition of `__vector_25'
core.a(UART.cpp.o):E:\Portable Apps\arduino-1.0.4\hardware\arduino\cores\arduino\Cosa\IOStream\Driver/UART.cpp:110: first defined here
e:/portable apps/arduino-1.0.4/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions
core.a(HardwareSerial.cpp.o): In function `__vector_36':
E:\Portable Apps\arduino-1.0.4\hardware\arduino\cores\arduino/HardwareSerial.cpp:152: multiple definition of `__vector_36'
core.a(UART.cpp.o):E:\Portable Apps\arduino-1.0.4\hardware\arduino\cores\arduino\Cosa\IOStream\Driver/UART.cpp:122: first defined here
core.a(HardwareSerial.cpp.o): In function `__vector_51':
E:\Portable Apps\arduino-1.0.4\hardware\arduino\cores\arduino/HardwareSerial.cpp:169: multiple definition of `__vector_51'
core.a(UART.cpp.o):E:\Portable Apps\arduino-1.0.4\hardware\arduino\cores\arduino\Cosa\IOStream\Driver/UART.cpp:126: first defined here
core.a(HardwareSerial.cpp.o): In function `__vector_54':
E:\Portable Apps\arduino-1.0.4\hardware\arduino\cores\arduino/HardwareSerial.cpp:186: multiple definition of `__vector_54'
core.a(UART.cpp.o):E:\Portable Apps\arduino-1.0.4\hardware\arduino\cores\arduino\Cosa\IOStream\Driver/UART.cpp:130: first defined here
core.a(HardwareSerial.cpp.o): In function `__vector_26':
E:\Portable Apps\arduino-1.0.4\hardware\arduino\cores\arduino/HardwareSerial.cpp:227: multiple definition of `__vector_26'
core.a(UART.cpp.o):E:\Portable Apps\arduino-1.0.4\hardware\arduino\cores\arduino\Cosa\IOStream\Driver/UART.cpp:109: first defined here
core.a(HardwareSerial.cpp.o): In function `__vector_37':
E:\Portable Apps\arduino-1.0.4\hardware\arduino\cores\arduino/HardwareSerial.cpp:258: multiple definition of `__vector_37'
core.a(UART.cpp.o):E:\Portable Apps\arduino-1.0.4\hardware\arduino\cores\arduino\Cosa\IOStream\Driver/UART.cpp:121: first defined here
core.a(HardwareSerial.cpp.o): In function `__vector_52':
E:\Portable Apps\arduino-1.0.4\hardware\arduino\cores\arduino/HardwareSerial.cpp:275: multiple definition of `__vector_52'
core.a(UART.cpp.o):E:\Portable Apps\arduino-1.0.4\hardware\arduino\cores\arduino\Cosa\IOStream\Driver/UART.cpp:125: first defined here
core.a(HardwareSerial.cpp.o): In function `__vector_55':
E:\Portable Apps\arduino-1.0.4\hardware\arduino\cores\arduino/HardwareSerial.cpp:292: multiple definition of `__vector_55'
core.a(UART.cpp.o):E:\Portable Apps\arduino-1.0.4\hardware\arduino\cores\arduino\Cosa\IOStream\Driver/UART.cpp:129: first defined here

Can you tell me how to properly use the additional hardware uarts on the Mega2560?
Thanks!
:-)

Add TWI device access to Registry

Adding TWI to the Registry would allow access directory to sensors without using the driver library layer. The new Registry item would contain TWI bus address and possible register address and max size. The general version would only be the TWI bus address and access function would contain the offset.

Power OneWire salve

Hi,
you made a POWER class that control power of internal composants.
Is it possible to extend this class to drive slaves like OneWire ones ?

Power consumation of OneWire salve can be reduce by disconnecting the pull up resistor.

example :
D1 ------|==R==|-------
D2 --------------------------+-------
' ONEWIRE SLAVES
GND --------------------------------/

In this way, D1 & D2 can be put in High Impedance mode in order to preserve power when ONEWIRE bus is not need.

the class may include a delay when power on the ONEWIRE bus to let some time to initialize the slaves.

my 2ct

guillaume

Horizontal LCD Menu item rendering

The LCD Menu system is optimized for two line displays such as 1602. The first line is used for navigation (parent:current) and the second item for value or description. The rendering is vertical in the list of items or values.

Some complex values need to rendered in horizontal order instead. A good example is dates or alarm time.

Low power mode and Attiny85

Hi, Mikael,

I'm currently testing your watchdog API to enable low power consumption with an Attiny85 (with Arduino IDE).

I taked one of your exemple (VWI transmitter) and modified it to only have the Watchdog part running.

Here is the final code I have :

#include "Cosa/Pins.hh"
#include "Cosa/Watchdog.hh"
#include "Cosa/Power.hh"

void setup()
{
  // Set up watchdog for power down sleep
  Watchdog::begin(1024, SLEEP_MODE_PWR_DOWN);

  // Disable hardware
  Power::adc_disable();
  Power::timer0_disable();
  Power::timer1_disable();
#if defined(__ARDUINO_TINY__)
  Power::usi_disable();
#else
  Power::spi_disable();
  Power::twi_disable();
  Power::timer2_disable();
  Power::usart0_disable();
#endif
}

void loop()
{
  SLEEP(2);
}

I measured a constant current of 250 - 300 ÂľA (3.3 V and my Attiny is cadenced at 8 Mhz). I know it is possible to get a lower current, so, what's wrong with this code?

For info : BOD is disabled with the fuses and the only component I have on my breadboard is the Attiny85 and a resistor on the reset PIN (my ISP programmer is disconnected) and I have tested with two different tiny85 chip.

Any hints for me?

Thank you.

Fabien D.

PWM need pin to be defined as output !

hi,
when using Pwmpin from cosa,
we need to define the same pin as outputpin and set it.

PWMPin pwmPin(Board::PWM0);
pwmPin.set(127);

doesn't works (with prescaler and PWMmode set)

I have to do:

OutputPin pwmPinHack(Board::D3);
PWMPin pwmPin(Board::PWM0);

pwmPinHack.set();
pwmPin.set(127); //now it works !

Could you add the DDR to output when declaring pwmpin ?

other idears for new feature :
init PWMmode (Fast or PhaseCorrect)
init prescaler (x1, x8 ....)

thx

Guillaume

Event Tracing

Add support for event tracing. It might also be interesting to have a builtin measuring of the event push to dispatch delay and the wait time e.g. processing load.

Add enable/disable for Watchdog to support low power mode

Turning off the Watchdog during power down could reduce power further especially if the watchdog is not used for wakeup. For ATtinyX5 the numbers are 5 uA with the watchdog enabled and below 1 uA with it disabled. Should be possible to evaluate this with the CosaWirelessButton example sketch.

Implement the Socket Interface with Wireless

The Socket Interface has temporary been removed as the new Wireless interface will handle the device driver layer. The Socket device should be implemented with the Wireless interface and become automatically adapted to any Wireless device driver.

Wrong ADV REFERENCE when computing Vcc

Hi,
In CosaVCC.ino

wrong m_vcc = 1126400L / AnalogPin::sample(VBG, AnalogPin::A1V1_REFERENCE);
good m_vcc = 1126400L / AnalogPin::sample(VBG, AnalogPin::AVCC_REFERENCE);

wrong VCC lowPower(1150);
good VCC lowPower(4900) ; // trigger alarm when below 4.9 Volts

We know with 5V VCC we have 1023, and so 1.1V ref is 225 (1023/5*1.1)
Now if we donc know VCC, if we sample 1.1REF, with VCC as ref,
we have vcc = 1126400 / (sample 1.1V with Vcc as REF)

now we can do :
// if vcc under 4.9 Volts = lowbatt trigged

VCC lowPower(4900);

guillaume

PS: as you can see, I'm porting my current project to your libs ;-)
PS: I'll try using pull request for new issue ...

Improve SPI driver support

The SPI driver support more or less assumes that there is only a single device on the bus or that the devices uses the bus in exactly the same way (mode, frequency, bitorder).

SPI drivers such as the NRF24L01P driver assume that there is a global SPI symbol. This assumes single SPI bus and either hardware or software. Not both or several SPI buses.

Possible concurrency bug in NRF24L01P socket driver

There is no protection against possible interrupts on incoming messages while performing SPI read/write in the library level code. The NRF24L01P interrupt handler issues SPI read without checking possible collision.

The library level code should at least turn off device interrupts while performing SPI read/write.

The code is currently not secure. There is an assumption of sequencing and timing of out- and incoming messages.

Add on_full() virtual member function to IOBuffer

By adding a virtual member function to be called on buffer full IOBuffer could be used for buffering IO. An example of usage is a buffered variant of Wireless where data is buffered before sending.

IOStream::Device for the Wireless interface

Implement an IOStream::Device with the Wireless interface to allow streaming over the wireless device drivers. May require a layer of retransmission. Could be combined with the HDLC frame for event trace. Basically the same problem.

Support for Attiny84

Hi mikael,

any plan to support Attiny84 ? (an attiny85 with 14 pins !!!)
( attiny x4 series are almost the same of attiny x5 series
with 14 pins vs 8 pins
with 1x16bits + 1x8 bits timer vs 2x8bits timer
thats all ....

http://gibibit.com/electronics/AVR%20MCU%20Comparison%20Table.pdf

As we can have cosa lib used by

  • little projet (tiny size, low IO : attiny x5
  • medium projet (small size, some IO : attiny x4
  • big projet (high size, high IO : atmega 328 (arduino).

thanks

guillaume

Allow Wireless::Driver NRF24L01P and CC1101 for ATtinyX5

Currently the Wireless::Driver for NRF24L01P and CC1101 are not available for ATtinyX5. This is mainly due to a pin conflict (pin D2 is both EXT0 and SCK for USI/SPI).

Possible solutions are 1) remove interrupt handler (e.g. EXT0), 2) use a Pin Change Interrupt instead.

Add data type descriptors to Registry

The data references in the Registry is currently typed with storage. For struct/class instances it would be an improvement to have a type descriptor.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.