Show Posts
Pages: 1 2 [3] 4 5 ... 31
31  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: July 18, 2014, 02:53:14 pm
@Mispulin

The quick answer is add a timeout to the requests and it works fine.
Code:
void loop()
{
   const uint32_t TIMEOUT = 100L;
  // Service incoming requests
  server.run(TIMEOUT);
  
  // Service SNMP requests with given MIB handlers
  SNMP::PDU pdu;
  snmp.request(pdu, TIMEOUT);
}
Tested it on an Arduino Leonardo :-) with an Ethernet Shield.
Code:
user@host: cosa leonardo upload
.....
AVR Memory Usage
----------------
Device: atmega32u4

Program:   22380 bytes (68.3% Full)
(.text + .data + .bootloader)

Data:        793 bytes (31.0% Full)
(.data + .bss + .noinit)
The long answer is if you look at the description of HTTP::Server::run() and SNMP:request() there is a timeout parameter that is default blocking.

Ref.
1. https://dl.dropboxusercontent.com/u/993383/Cosa/doc/html/d0/d12/classHTTP_1_1Server.html#adca760526a455a0e034862daa802acd1
2. https://dl.dropboxusercontent.com/u/993383/Cosa/doc/html/d8/d36/classSNMP.html#a111be2e37fb479a15df3cc77347097c9

Cheers!

BW: You left out the code in the first post and then in the next post you had removed the copyright notice. And you have only pasted together two example sketches. That is very very very bad practice.

Always post code. Always post environment; board, core, host, versions, versions, version. And always keep copyright notices if you are copying.

32  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: July 16, 2014, 11:48:44 am
The latest Cosa development have been focused on implementing a file system for the flash device driver (S25FL127S). The device is accessed through SPI and has a total size of 16 Mbyte (128 Mbit). Typical access time with the optimized Cosa SPI functions are approx. 600 Kbyte/s read and 200 Kbyte/s at 16 MHz clock and DIV2 SPI clock (i.e. 8 Mhz).

The Cosa Flash File System takes advantage of the S25FL127S hybrid sector structure with 16 X 4 Kbyte sectors followed by 255 x 64 Kbyte sectors. The file system allows for up to 16 directories with up to 128 files per directory. The total number of data files is limited to 255. The file and directory API is very traditional Linux with open, close, remove, tell, seek, read, write and ls, cd, mkdir and more.

The API follows the Cosa FAT16 interface so that SD and Flash access can replace each other in a sketch. Also the CFFS::File and FAT16::File classes implement the Cosa IOStream interface and all the output functions and operators can be used directly. Both binary and text data can be written to files on the flash. The only restriction is that the last data entry cannot be 0xff. This works fine for text while binary data records must be padded.

Interface: https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/FS/CFFS.hh


Example sketch: https://github.com/mikaelpatel/Cosa/blob/master/examples/Sandbox/CosaCFFS/CosaCFFS.ino

The example sketch demonstrates the file system functionality and binding a file to an iostream for log output in text (i.e. analog sample written to the file). Above is a screen shot of the output.

Cheers!
33  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: July 16, 2014, 11:27:26 am
@kowalski
I can confirm, Mega1280 is working now smiley, however it seems that the uart1 doesn't work, I've tried the MegaUARTs example and had to change to uart2 to test it.
@g_ad
Thanks for the info. Great that you got your Mega 1280 board up and running with Cosa. I will look into the UART numbering. Seems like the ISRs might have got mixed up.

Cheers!
34  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: July 14, 2014, 11:47:16 am
Good news ans super fast response, thank you very much.
This is my beginning of the adventure with Cosa plaftorm smiley The note is taken where to post questions smiley
Kind regards,
Adam
@g_ad
You are welcome. Please let me know how the update works with Arduino Mega 1280 as I do not have that specific board to test. As the MCU is very similar to the Mega 2560,  half the amount of program memory but otherwise the same, I believe that it should work just fine.

I have also added support for the Arduino Diecimila (https://github.com/mikaelpatel/Cosa/issues/209). All boards can be built with the command line tool.

Cheers!
35  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: July 13, 2014, 04:40:58 pm
Hello, I hope this is right place to ask the question. I have Mega1280 board and I don't know what should I choose in tools/boards. In the arduino ide there is mega1280, what would be equivalent in cosa?
Kind Regards,
Adam
@g_ad

Hi Adam! Ok with the question here on the Arduino forum but you would get faster response on the Cosa github issues list. https://github.com/mikaelpatel/Cosa/issues?state=open

The current Mega 2560 support will not work for the Mega 1280 as this board has a different bootloader. To fix this I have added a board definition for the Mega 1280 to the Cosa boards definition file. Please download from github https://github.com/mikaelpatel/Cosa/archive/master.zip and install https://github.com/mikaelpatel/Cosa/blob/master/doc/02-install.md.

Cheers!

36  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: July 06, 2014, 09:32:28 am
The latest update of the Cosa command line build script adds support for attiny devices. The below example command line will build the CosaBlink sketch for an ATtiny84 (internal clock 8 MHz) and upload with ISP device on the given port.
Code:
user@host:~/Sketchbook/hardware/Cosa/examples/Blink/CosaBlink$ cosa attiny84-8 ispload ISP_PORT=/dev/ttyACM0
The command "cosa boards" lists the devices that require ISP device upload as "Cosa Breadboard" with the MCU and clock type/frequency. The default ISP device is defined as "arduino:arduinoisp" in the Cosa/boards.txt file.

The latest update also includes an updated version of miniterm.py (serial monitor) so that 1) the board may signal shutdown of the serial monitor and 2) LF/CR is handled correctly both for RX and TX to the board. The shutdown signal is used by the Cosa ASSERT macro and the Trace::fatal_P() member function on error detect. The ASSERT error message uses the same format as GCC compiler errors and warnings so that the M-X goto-next-locus (F3) command can be used in GNU Emacs to directly step to the ASSERT code line.

Cheers!
37  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: July 03, 2014, 03:10:44 pm
The latest update of Cosa includes a device driver for MAX7219/MAX7221 Serially Interfaced, 8-digit LED Display Drivers.

The device driver implements the Cosa LCD/IOStream::Driver interface. It handles carriage-return-line-feed, backspace, alert, horizontal tab and form-feed. The period character is translated to the 7-segment LED decimal point of the previous written character. The example sketch (https://github.com/mikaelpatel/Cosa/blob/master/examples/LCD/CosaMAX72XX/CosaMAX72XX.ino) shows how to output floating-point numbers to a Cosa IOStream.

Cheers!

Ref.
Interface: https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/LCD/Driver/MAX72XX.hh
Source: https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/LCD/Driver/MAX72XX.cpp
38  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: July 01, 2014, 06:57:35 pm
Command line build of Cosa based sketches is now as easy as it gets.  A new shell script (cosa)  eliminates the need for makefiles. Used as follows:
Code:
cosa BOARD COMMAND
Where BOARD is one of the BOARD_TAGs and COMMAND is what is passed to make (Arduino-Makefile). Typical usage are:

1. Some basic instructions on how to use the tool and make targets.
Code:
user@host:~/Sketchbook/hardware/Cosa/examples/Blink/CosaBlink$ cosa help
Available targets (default is compile the code):
  upload            - upload
  ispload           - upload using an ISP
  raw_upload        - upload without first resetting
  eeprom            - upload the eep file
  raw_eeprom        - upload the eep file without first resetting
  clean             - remove all our dependencies
  depends           - update dependencies
  reset             - reset the Arduino by tickling DTR or changing baud
                      rate on the serial port.
  boards            - list all the boards defined in boards.txt
  config            - list configuration
  monitor           - connect to the Arduino's serial port
  size              - show the size of the compiled output (relative to
                      resources, if you have a patched avr-size).
  verify_size       - verify that the size of the final file is less than
                      the capacity of the micro controller.
  symbol_sizes      - generate a .sym file containing symbols and their
                      sizes.
  disasm            - generate a .lss file that contains disassembly
                      of the compiled file interspersed with your
                      original source code.
  generate_assembly - generate a .s file containing the compiler
                      generated assembly of the main sketch.
  burn_bootloader   - burn bootloader and fuses
  set_fuses         - set fuses without burning bootloader
  help_vars         - print all variables that can be overridden
  avanti            - short cut for upload and monitor
  help              - show this help
More details in:
/home/user/Sketchbook/hardware/Cosa/build/Arduino-Makefile/Arduino.mk
/home/user/Sketchbook/hardware/Cosa/build/Cosa.mk

2. Get the current configuration.
Code:
user@host:~/Sketchbook/hardware/Cosa/examples/Blink/CosaBlink$ cosa uno config
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED]       CURRENT_OS = LINUX
- [USER]               ARDMK_DIR = /home/user/Sketchbook/hardware/Cosa/build/Arduino-Makefile
- [USER]               ARDUINO_DIR = /home/user/opt/arduino-1.0.5
- [AUTODETECTED]       ARDUINO_VERSION = 105
- [AUTODETECTED]       ARDUINO_PREFERENCES_PATH = /home/user/.arduino/preferences.txt
- [AUTODETECTED]       ARDUINO_SKETCHBOOK = /home/user/Sketchbook (from arduino preferences file)
- [BUNDLED]            AVR_TOOLS_DIR = /home/user/opt/arduino-1.0.5/hardware/tools/avr (in Arduino distribution)
- [COMPUTED]           ARDUINO_LIB_PATH = /home/user/opt/arduino-1.0.5/libraries (from ARDUINO_DIR)
- [USER]               ARDUINO_CORE_PATH = /home/user/Sketchbook/hardware/Cosa/cores/cosa
- [USER]               ARDUINO_VAR_PATH = /home/user/Sketchbook/hardware/Cosa/variants
- [USER]               BOARDS_TXT = /home/user/Sketchbook/hardware/Cosa/boards.txt
- [DEFAULT]            USER_LIB_PATH = /home/user/Sketchbook/libraries (in user sketchbook)
- [DEFAULT]            PRE_BUILD_HOOK = pre-build-hook.sh
- [USER]               BOARD_TAG = uno
- [COMPUTED]           OBJDIR = build-uno (from BOARD_TAG)
- [ASSUMED]            MONITOR_BAUDRATE = 9600
- [DEFAULT]            OPTIMIZATION_LEVEL = s
- [DEFAULT]            MCU_FLAG_NAME = mmcu
- [DEFAULT]            CFLAGS_STD = -std=gnu99
- [AUTODETECTED]       DEVICE_PATH =  
- [AUTODETECTED]       Size utility: AVR-aware for enhanced output
- [COMPUTED]           BOOTLOADER_PARENT = /home/user/opt/arduino-1.0.5/hardware/arduino/bootloaders (from ARDUINO_DIR)
-------------------------
Please refer to /home/user/Sketchbook/hardware/Cosa/build/Arduino-Makefile/Arduino.mk for more details.

3. Get a list of the available boards.
Code:
user@host:~/Sketchbook/hardware/Cosa/examples/Blink/CosaBlink$ cosa boards
atmega328-8           Cosa Breadboard (ATmega328, 8 MHz internal clock)
attiny84-8            Cosa Breadboard (ATtiny84, 8 MHz internal clock)
attiny85-8            Cosa Breadboard (ATtiny85, 8 MHz internal clock)
attiny861-8           Cosa Breadboard (ATtiny861, 8 MHz internal clock)
duemilanove           Cosa Arduino Duemilanove (ATmega328/BOOT_168)
leonardo              Cosa Arduino Leonardo (ATmega32U4/Caterina)
lilypad               Cosa LilyPad Arduino (ATmega328/BOOT_168, 8 MHz)
lilypad-usb           Cosa LilyPad Arduino USB (ATmega32U4/Caterina, 8 MHz)
mega                  Cosa Arduino Mega (ATmega2560/STK500v2)
microduino-core32u4   Cosa Microduino-Core32u4 (ATmega32U4/Caterina)
microduino-core       Cosa Microduino-Core (ATmega328/Optiboot)
microduino-core-plus  Cosa Microduino-Core+ (ATmega644P/Optiboot)
mighty                Cosa Breadboard (ATmega1284/BOOT_1284P)
mighty-opt            Cosa Breadboard (ATmega1284/Optiboot)
miniwireless          Cosa Anarduino MiniWireless (ATmega328/BOOT_168)
moteino               Cosa LowPowerLab Moteino (ATmega328/DualOptiboot)
nano                  Cosa Arduino Nano (ATmega328/BOOT_168)
pinoccio              Cosa Pinoccio Scout (ATmega256RFR2/STK500v2)
pro-micro             Cosa Arduino Pro Micro (ATmega32U4/Caterina)
pro-mini-8            Cosa Arduino Pro Mini (ATmega328/BOOT_168, 3.3V, 8 MHz)
pro-mini              Cosa Arduino Pro Mini (ATmega328/BOOT_168)
uno                   Cosa Arduino Uno (ATmega328/Optiboot)

4. Build the CosaBenchmarkPins sketch for Arduino Uno, upload and start the serial monitor.
Code:
user@host:~/Sketchbook/hardware/Cosa/examples/Benchmarks/CosaBenchmarkPins$ cosa uno avanti

To install this new build feature please either add Cosa/build to your PATH or symbolic link from you local bin directory to the build script $COSA_DIR/build/cosa. The default path for COSA_DIR is $HOME/Sketchbook/hardware/Cosa. You can set COSA_DIR as an exported environment variable.

To use GNU Emacs as the Cosa IDE simply use the command M-X compile with "cosa BOARD upload" (only needed the first time per session). You can directly move to any compile error with M-X goto-next-locus. Add the following to your .emacs file to allow bind compile-upload to F2 and goto-next-error to F3. The first line below will make GNU Emacs recognize .pde/.ino files as C++ and automatically switch to the correct mode.  
Code:
(setq auto-mode-alist (cons '("\\.\\(pde\\|ino\\)$" . c++-mode) auto-mode-alist))
(global-set-key (quote [f2]) (quote compile))
(global-set-key (quote [f3]) (quote goto-next-locus))
Below is an example of compiling the CosaBlink example sketch with a bad modification and stepping to the error line (F2 and F3).

GNU Emacs will help you with indentation, quick incremental search,  color coding comments, etc. Together with the new Cosa build script GNU Emacs gives a productive IDE for Arduino programming that is easy to customize.  

The Arduino version is configured in the file Cosa/build/Cosa.mk. There is support for the following Arduino versions; 1.0.5, 1.5.6-r2 and the nightly build with GCC 4.8.1.

Cheers!
39  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: July 01, 2014, 04:32:20 pm
The latest Cosa update includes porting and configuration of the Arduino-Makefile https://github.com/sudar/Arduino-Makefile. This allows simple build using "traditional" make files. To get started simply configure the build template with your Arduino installation path (https://github.com/mikaelpatel/Cosa/blob/master/build/Cosa.mk#L21) and write a three line makefile in the same directory as the sketch.

Code:
COSA_DIR = $(HOME)/Sketchbook/hardware/Cosa
BOARD_TAG = duemilanove
include $(COSA_DIR)/build/Cosa.mk

The COSA_DIR variable is the path of the Cosa installation. The BOARD_TAG is the type of board to build the sketch for. The possible board tags are:

Code:
BOARD_TAG DESCRIPTION
================================================================================
miniwireless Cosa Anarduino MiniWireless (ATmega328/BOOT_168)
duemilanove Cosa Arduino Duemilanove (ATmega328/BOOT_168)
leonardo Cosa Arduino Leonardo (ATmega32U4/Caterina)
mega Cosa Arduino Mega (ATmega2560/STK500v2)
nano Cosa Arduino Nano (ATmega328/BOOT_168)
pro-micro Cosa Arduino Pro Micro (ATmega32U4/Caterina)
pro-mini Cosa Arduino Pro Mini (ATmega328/BOOT_168)
pro-mini-8 Cosa Arduino Pro Mini (ATmega328/BOOT_168, 3.3V, 8 MHz)
uno Cosa Arduino Uno (ATmega328/Optiboot)
attiny84-8 Cosa Breadboard (ATtiny84, 8 MHz internal clock)
attiny85-8 Cosa Breadboard (ATtiny85, 8 MHz internal clock)
attiny861-8 Cosa Breadboard (ATtiny861, 8 MHz internal clock)
atmega328-8 Cosa Breadboard (ATmega328, 8 MHz internal clock)
mighty Cosa Breadboard (ATmega1284/BOOT_1284P)
mighty-opt Cosa Breadboard (ATmega1284/Optiboot)
lilypad Cosa LilyPad Arduino (ATmega328/BOOT_168, 8 MHz)
lilypad-usb Cosa LilyPad Arduino USB (ATmega32U4/Caterina, 8 MHz)
moteino Cosa LowPowerLab Moteino (ATmega328/DualOptiboot)
microduino-core Cosa Microduino-Core (ATmega328/Optiboot)
microduino-core32u4 Cosa Microduino-Core32u4 (ATmega32U4/Caterina)
microduino-core-plus Cosa Microduino-Core+ (ATmega644P/Optiboot)
pinoccio Cosa Pinoccio Scout (ATmega256RFR2/STK500v2)
teensy-2_0 Cosa Teensy 2.0 (ATmega32U4/halfkay)
teensypp-2_0 Cosa Teensy++ 2.0 (AT90USB1286/halfkay)

Build, upload and monitor the sketch with the following command.

Code:
make upload monitor

The Cosa Arduino-Makefile uses miniterm.py as serial monitor. The exit command is CTRL-ALT GR ]

Build for another board by either changing the BOARD_TAG in the Makefile or simply giving the command:

Code:
make "BOARD_TAG=uno"

More details in the Cosa/build directory and on the original Arduino-Makefile site. Please see the example makefiles in the CosaBlink and CosaBenchmarkPins directories.

Cheers!
40  Using Arduino / Networking, Protocols, and Devices / Re: AK Protocal on: June 29, 2014, 04:32:18 pm
Try http://www.epa.gov/oamcinc1/1300053/protocol.pdf

Cheers!
41  Development / Other Software Development / Re: Will Arduino team ever do better than this?! on: June 29, 2014, 11:14:05 am
There is a standard definition for this. See http://pubs.opengroup.org/onlinepubs/009695399/basedefs/stdbool.h.html and  http://clang.llvm.org/doxygen/stdbool_8h_source.html. This could be added to AVR GCC or intermediately to Arduino.

Cheers!
42  Development / Other Software Development / Re: Upload contributions in the Arduino libraries on: June 28, 2014, 05:23:11 am
You should discuss your changes on the developers form https://groups.google.com/a/arduino.cc/forum/m/#!forum/developers, clone/fork the Arduino respository and do a pull request. The better you present your changes on the forum the quicker the pull request is merged. If you check the Arduino git respository you can figure out who are the maintainers.

Cheers!

PS: Sorry about the bad link to the forum.
43  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: June 28, 2014, 04:29:48 am
As my intention is to base all my nodes on Cosa, some additional chip & functional support should be added to the Cosa eco system smiley-red
I guess the best way to make that visible is to add an issue on GitHub for each chip and/or function??
@MarsWarrior

That sounds like a good idea. The issue list on github is the right place for that.

There are a few things to consider. At this stage Cosa is not a commercial product or project as Arduino. There is no license, no registration, and no release handling with maintenance. The idea is to collaborate and build an industry strength high quality fully OOP alternative to the Arduino codebase. If and when we reach critical mass the next stage will offer release and maintenance.

For now anybody may contribute by building and test, writing code, donating hardware, giving improvement suggestions, etc. Contributing code requires normal open source git handling; clone/fork and pull request. The contributed code should follow the coding standard and must have test and/or example code. Contributed code will follow the normal refactoring of Cosa. The high level of refactoring right now is also part of the current stage.

Easiest way to get new device drivers is to contribute hardware. This is important even when contributing code to the main repository. It is difficult to add code that cannot be tested. This will need a lot of convincing :-).

Cheers!
44  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: June 23, 2014, 02:03:55 pm
Some news on the latest Cosa updates:

1. TCS230 color sensor device driver
Interface: https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Driver/TCS230.hh
Example: https://github.com/mikaelpatel/Cosa/blob/master/examples/Sandbox/CosaTCS230/CosaTCS230.ino

2. Arduino String class
Refactoring of the Arduino String class and support for Cosa IOStream output operator with String.
Interface: https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/String.hh
Example: https://github.com/mikaelpatel/Cosa/blob/master/examples/Sandbox/CosaString/CosaString.ino

3. Removed offsetof() macro warning
Older version of AVR GCC will give warnings on usage of offsetof() macro.
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Types.h#L154

4. MCP7940N Alarm interrupt handler and example sketch
The device driver supports alarm interrupts so that the MCU can power-down and wake up on a RTCC alarm. Both device alarms may be used to trigger a wake up. The device driver has been tested on Anarduino MiniWireless. A new example sketch is available. https://github.com/mikaelpatel/Cosa/blob/master/examples/Time/CosaMCP7940N/CosaMCP7940N.ino

5. Breaking the 30 KLOC barrier
The Cosa source code repository is 30+ KLOC without comments and 58+ KLOC with comments. This does not include the 150+ example sketches. Please see Ohloh for more details. https://www.ohloh.net/p/cosa

Cheers!
45  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: June 23, 2014, 04:41:21 am
@MarsWarrior

Thanks for all the info and especially the links. Always great to have a look at other implementations and approaches.

My guess on the MCP79141X device was not that bad. It is basically a MCP7940N with an EEPROM (128 bytes), an ID and some security register setup sequencing. The Cosa EEPROM driver for AT24CXX has the same I2C address (0x5X) and could be used for the EEPROM part. The security sequencing will need some tweaking.
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/TWI/Driver/AT24CXX.hh

Cheers!
Pages: 1 2 [3] 4 5 ... 31