Show Posts
Pages: 1 ... 10 11 [12] 13 14 ... 30
166  Development / Other Software Development / Re: Reference Array - add a sub topic for handling arrays on: January 16, 2014, 06:16:53 pm
This is what you can do in C/C++ to achieve array assignment.
#include <string.h>
// matrix = i_face
memcpy(matrix, i_face, sizeof(matrix));
// program memory (constant values)
const byte c_face[8] PROGMEM = { ..... };
memcpy_P(matrix, c_face, sizeof(matrix));
// matrix = 0;
memset(matrix, 0, sizeof(matrix));
// matrix == i_face
memcmp(matrix, i_face, sizeof(matrix)) == 0
The include is not really needed in Arduino as this is done in Arduino.h. I like the answer about wrapping the array in a struct.
struct array_t {
  byte element[8];
array_t matrix, i_face;
matrix = i_face;
There are more tricks to be played in C++ as operators may be defined for the struct/class. With a template class you can also handle different array sizes and avoid using the heap (malloc/free, new/delete).
167  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: January 07, 2014, 02:47:13 pm
Cosa may now be used with both major versions of the Arduino IDE (1.05 and 1.5.5). The configuration files have been updated so that both environments are supported. The installation procedure for 1.5.5 will require an additional directory level to be created. Please see the installation instructions on github and/or the blog.

Thanks to @Jantje for convincing me that this update was a "piece-of-cake".

168  Development / Other Software Development / Re: Using a arduino to reduce the number of pins needed for a LCD on: January 06, 2014, 07:19:09 pm

Thanks for the info. It helped convince me to look into adding support for 1.5.X. Actually it turned out to be not so complex or difficult. The changes for the Cosa core are (so far):

1. Install changed from Sketchbook/hardware/Cosa to Sketchbook/hardware/Cosa/avr. An extra directory needs to be created when installing.
2. Minor update to boards.txt to include the new 1.5.X attributes (e.g. upload.tool, bootload.tool, board). This can be improved to include the "Processor" menu item.
3. Copy the platform.txt file from the Arduino core and minor update to the board menu item attribute.

By leaving the 1.0.X attributes (e.g upload.using) in the boards.txt configuration works for both versions of the IDE.

I will push the update after some addition regression tests.  Cheers, and thanks again.
169  Development / Other Software Development / Re: Using a arduino to reduce the number of pins needed for a LCD on: January 06, 2014, 09:54:23 am

Thanks for the swift reply. Might need to take some time and prepare 1.5.X support. Sounds like it is more stable than I thought.

Cosa is not really an Arduino library. The installation method and structure is a core as the "platform" is self-contained and support a large number of boards and AVR processors within a single core.

I did a test run of 1.5.5 just to see where things went wrong. As you said the boards and platform files have changed both location and contents. There is a nice reuse between cores so I think the update should not be that difficult.

I would like to support both 1.0.X and 1.5.X but it seems like they will converge at some point, if I understand you correctly. This would be great and reduce variance handling.

Thanks again!
170  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: January 05, 2014, 08:05:45 pm
Just to show that I'm paying attention,
Thanks Rob. Corrected that. Just too many numbers ;-) Cheers!
171  Development / Other Software Development / Re: Using a arduino to reduce the number of pins needed for a LCD on: January 05, 2014, 03:29:40 pm
It comes to me that the Cosa library is not yet 1.5.x compatible.
I ask because I need 1.5.x as I want to run on a yun.

Need to ask you a question about 1.5.X. Do you think it is stable enough to start adding support for this? It isn't that much as I understand; new boards/platform file and build support. There is also a somewhat different directory structure with support for multiple architectures.

Also do you know if it is possible for a core to support both 1.0.5 and 1.5.X?

172  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: January 05, 2014, 02:14:42 pm
Cosa is approaching a first major release. It contains over 150 classes and over 30 SPI/TWI device drivers (35+ KLOC in total). Below is a complete list of classes (without internal implementation classes). These range from object-oriented Digital and Analog Pin abstractions to Wireless devices and application frameworks.  
BitSet.hh:class BitSet
Button.hh:class Button
Canvas.hh:class Canvas
Canvas.hh:  class Context
Canvas.hh:  class Element
Ciao.hh:class Ciao
Ciao.hh:  class Descriptor
EEPROM.hh:  class Device
Event.hh:class Event
Event.hh:  class Handler
ExternalInterrupt.hh:class ExternalInterrupt
Fai.hh:class Fai
Fai.hh:  class Descriptor
FixedPoint.hh:class FixedPoint
FSM.hh:class FSM
Interrupt.hh:class Interrupt
Interrupt.hh:  class Handler
IOBuffer.hh:class IOBuffer
IOStream.hh:class IOStream
IOStream.hh:  class Device
IOStream.hh:  class Filter
IR.hh:class IR
IR.hh:  class Receiver
Keypad.hh:class Keypad
Keypad.hh:class LCDKeypad
LCD.hh:class LCD
LCD.hh:  class Device
LED.hh:class LED
Linkage.hh:class Linkage
Linkage.hh:class Link
Linkage.hh:class Head
Listener.hh:class Listener
Menu.hh:class Menu
Menu.hh:  class Action
Menu.hh:  class Walker
Menu.hh:  class KeypadController
Menu.hh:  class RotaryController
OWI.hh:class OWI
OWI.hh:  class Driver
OWI.hh:  class Search
Periodic.hh:class Periodic
PinChangeInterrupt.hh:class PinChangeInterrupt
Pins.hh:class Pin
Pins.hh:class InputPin
Pins.hh:class OutputPin
Pins.hh:class PWMPin
Pins.hh:class IOPin
Pins.hh:class AnalogPin
Pins.hh:class AnalogPins
Pins.hh:class AnalogComparator
Power.hh:class Power
ProtocolBuffer.hh:class ProtocolBuffer
Queue.hh:class Queue
Registry.hh:class Registry
Registry.hh:  class Iterator
Registry.hh:  class Action
Rete.hh:class Rete
Rete.hh:  class Device
Rete.hh:  class Manager
Rotary.hh:class Rotary
Rotary.hh:  class Encoder
Rotary.hh:    class SignalPin
Rotary.hh:  class Dial
Rotary.hh:  class AcceleratedDial
RTC.hh:class RTC
Servo.hh:class Servo
SPI.hh:class SPI
SPI.hh:  class Driver
SPI.hh:  class Slave
Thread.hh:class Thread
Touch.hh:class Touch
Trace.hh:class Trace
TWI.hh:class TWI
TWI.hh:  class Driver
TWI.hh:  class Slave
Watchdog.hh:class Watchdog
Wireless.hh:class Wireless
Wireless.hh:  class Driver
AVR/Programmer.hh:class Programmer
AVR/STK500.hh:class STK500
Canvas/Font.hh:class Font
Canvas/GLCDFont.hh:class GLCDFont
Canvas/OffScreen.hh:class OffScreen
Canvas/UTFTFont.hh:class UTFTFont
Cipher/Base64.hh:class Base64
Cipher/RC4.hh:class RC4
Cipher/Vigenere.hh:class Vigenere
Driver/DHT.hh:class DHT
Driver/DHT.hh:class DHT11
Driver/DHT.hh:class DHT22
Driver/DS1302.hh:class DS1302
Driver/HCSR04.hh:class HCSR04
Driver/NEXA.hh:class NEXA
Driver/NEXA.hh:  class Receiver
Driver/NEXA.hh:  class Transmitter
FS/FAT16.hh:class FAT16
FS/FAT16.hh:  class File
Soft/SPI.hh:  class SPI
Soft/SPI.hh:    class Driver
Soft/UART.hh:  class UART
USI/TWI.hh:class TWI
USI/TWI.hh:  class Driver
USI/TWI.hh:  class Slave
Canvas/Driver/ST7735.hh:class ST7735
Canvas/Element/Textbox.hh:class Textbox
Canvas/Font/FixedNums8x16.hh:class FixedNums8x16
Canvas/Font/Segment32x50.hh:class Segment32x50
Canvas/Font/System5x7.hh:class System5x7
IOStream/Driver/CDC.hh:class CDC
IOStream/Driver/RS485.hh:class RS485
IOStream/Driver/UART.hh:class UART
IOStream/Driver/WIO.hh:class WIO
LCD/Driver/HD44780.hh:class HD44780
LCD/Driver/HD44780.hh:  class IO
LCD/Driver/HD44780.hh:  class Port4b
LCD/Driver/HD44780.hh:  class SR3W
LCD/Driver/HD44780.hh:  class SR3WSPI
LCD/Driver/HD44780.hh:  class SR4W
LCD/Driver/HD44780.hh:  class MJKDZ
LCD/Driver/HD44780.hh:  class GYIICLCD
LCD/Driver/HD44780.hh:  class DFRobot
LCD/Driver/HD44780.hh:  class ERM1602_5
LCD/Driver/PCD8544.hh:class PCD8544
LCD/Driver/ST7565.hh:class ST7565
LCD/Driver/VLCD.hh:class VLCD
LCD/Driver/VLCD.hh:  class Slave
OWI/Driver/DS18B20.hh:class DS18B20
OWI/Driver/DS18B20.hh:  class Search
SPI/Driver/SD.hh:class SD
TWI/Driver/ADXL345.hh:class ADXL345
TWI/Driver/AT24CXX.hh:class AT24CXX
TWI/Driver/AT24CXX.hh:class AT24C32
TWI/Driver/AT24CXX.hh:class AT24C64
TWI/Driver/AT24CXX.hh:class AT24C128
TWI/Driver/AT24CXX.hh:class AT24C256
TWI/Driver/AT24CXX.hh:class AT24C512
TWI/Driver/BMP085.hh:class BMP085
TWI/Driver/DS1307.hh:class DS1307
TWI/Driver/DS3231.hh:class DS3231
TWI/Driver/HMC5883L.hh:class HMC5883L
TWI/Driver/L3G4200D.hh:class L3G4200D
TWI/Driver/MPU6050.hh:class MPU6050
TWI/Driver/PCF8574.hh:class PCF8574
TWI/Driver/PCF8574.hh:class PCF8574A
TWI/Driver/PCF8591.hh:class PCF8591
Wireless/Driver/CC1101.hh:class CC1101
Wireless/Driver/NRF24L01P.hh:class NRF24L01P
Wireless/Driver/VWI.hh:class VWI
Wireless/Driver/VWI.hh:  class Codec
Wireless/Driver/VWI.hh:  class Receiver
Wireless/Driver/VWI.hh:  class Transmitter

Cosa is implemented as an Arduino 1.0.5 "core" and replaces the standard Arduino/Wiring core. All ATmega328P (Uno, Nano,...), ATmega2560 (Mega), ATmega1284 (Mighty) and ATmega32u4 (Leonardo, Micro,...) Arduino based boards are supported together with support for ATtinyX4, ATtinyX5, ATtinyX61 within this single core. The devices drivers and processor module abstractions are available across all processors (where the HW supports them). Cosa is one of the  most complete platforms for Arduino board programming.

Please see documentation on github and blog for more details.

173  Using Arduino / Microcontrollers / Re: SPI in ISR do not work on: January 05, 2014, 01:31:14 pm
This question has an interesting complexity as SPI is a bus that may be several units with different clock, phase and frequency. Also each unit has its own chip select and could have one or several interrupt pins.

Now your question need to be broken down into several parts to be able to answer it. First could SPI transfer be called from an ISR (any ISR)? It could but there are a number of restrictions. First no other SPI transfer should be in progress. No device should be selected (pre SPI transfer). Second could SPI transfer be used in SPI completion? This question is more "how is SPI completion ISR used". In this case SPI transfer would be a "DMA" style operation where the ISR fetches data from a buffer and put into the SPDR register without waiting for the flag to be set. Instead the processor continues and the ISR handles the transfer block as, for instance, in TWI and UART/Serial.

The Arduino implementation of SPI is very simple and does not really support multiple devices very well. To implement a more robust scheme much more logic is needed. If you are interested in how this can be done please see Cosa/SPI. There are also Linux SPI device drivers to be studied.

The Cosa implementation handles multiple devices with ISR and both ATmega and ATtiny USI implementation. It does not implement SPI completion interrupt handler as the SPI frequency is assumed to be greater than 1 MHz and there would not be time for anything else during a block transfer. More details on forum topic

174  Using Arduino / Displays / Re: Cosa/Boosting LCD 1602 performance (7X SR4W, 6.5X 4-bit parallel, 1.7-2.3X I2C) on: January 03, 2014, 07:26:10 pm
A short update on the Cosa LCD support. The following devices and processes have been added.

1. TWI expander ports and display; GYIICLCD, ERM1602-5
2. ATtinyX4, ATtinyX5, ATtinyX61
3. ATmega1264 (Mighty)
4. ATmega32u4 (Arduino Leonardo, Micro, LilyPad USB, Pro Mini, etc)

Please see github for further details.
and the blog

175  Using Arduino / Displays / Re: 1.8" SPI TFT LCD ILI9163C on: January 03, 2014, 07:17:10 pm
Please see the blog;

Programs in Arduino are called sketches and stored in the Sketchbook directory. You should create a directory named hardware in the Sketchbook directory and unzip the Cosa zip file there. It is really simple. Do not attempt to move files around you will just get a lot of compile errors.

If you have problems please post me a message.

176  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: December 31, 2013, 11:27:49 am

Many, many THANKS back to you and all for testing and support this project. Without your effort testing different parts of Cosa it would not have evolved as much as it has. Your questions help improve documentation, abstractions and give a better understand for typical usage patterns - not to mention all the encouragements!

Great year with a lot of fun. Hope to be able to find as much time next year and continue the work on the blog, more demo code and documentation.

Cheers! And a Happy New Year.
177  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: December 29, 2013, 07:54:15 pm
And I could help you a bit - without obligations from your side - by solving your first problem in getting some modules if you want...
That would help ;-). The RFM69 was not (yet?) a very popular wireless module on ebay. Actually more or less a single US based seller.

178  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: December 29, 2013, 07:47:33 pm
Will support for the Arduino Leonardo be added anytime soon?
USB/CDC will be added later on.
Later became sooner than I first thought. An update is now available with basic USB support with CDC.


Interface CDC:
Example sketch CDC:
179  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: December 28, 2013, 06:53:55 pm
Would you consider adding support to Cosa for the Hope RFM69W / RFM69HW trancievers as you did for the nRF24L01+ ?

Yes, have been looking at a few other RF modules. The "problem" is more or less getting hold of a few modules and putting together a test environment. Also there is some extra "link level" code to be written to add the same level of support as the NRF24L01P (e.g. retransmission). I have to do this for the other devices anyway; VirtualWire (VWI) and CC1101. Both are "raw" send/receive right now. Also there is some work to be done to get a mesh with routing up and running on top of the Wireless interface.

Anyway I will have a look at the spec. So far it seems to be an interesting challenge with a lot in common with CC1101. And it has some extra features (encryption and crc support).

180  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: December 28, 2013, 05:37:59 pm
Will support for the Arduino Leonardo be added anytime soon?

Need to update my previous answer on this issue ;-). There is now support for ATmega32u4 boards (Micro, LilyPad USB and Leonardo) in Cosa. USB/CDC will be added later on. Upload is as normal but serial output goes over the UART. In some cases you will have to press the reset button on the board before the upload as the internal USB module is not active.


Pages: 1 ... 10 11 [12] 13 14 ... 30