Page 4 of 4

Re: Can be stored data inside non volative memory ?

Posted: Mon Feb 15, 2016 6:53 am
by pythoncoder
I'm glad you found it - a slip up most of us have done at some point.

"He who never made a mistake never made anything." ;)

Re: Can be stored data inside non volative memory ?

Posted: Wed Mar 02, 2016 6:38 pm
by BOB63
Hi,
well ,I've completed my project.
I'm finishing to write the down the project description into a document and ready to post it with the code (MicroPython and Processing2) in the forum.
The project use the upower module from pythoncoder.

I DON'T KNOW NOTHING AT ALL ABOUT THE DIFFERENT LICENSE THAT CAN BE USED TO RELEASE A CODE. :shock:

Can someone tell me what I've to write in both codes , in terms of licence and declarations , to permit the sharing of this sw ? :?: :roll:

Re: Can be stored data inside non volative memory ?

Posted: Thu Mar 03, 2016 7:03 am
by pythoncoder
The best place to post code is on GitHub. When you create a new repository it invites you to choose a licence and puts a copy of the licence into your repository. Most of the MicroPython code is released under the MIT licence which means people can use it for any purpose including commercial ones. Crucially it absolves you from any responsibility if a failure of the code results in unpleasant consequences.

In the code itself I put the words

Code: Select all

# Copyright (C) Peter Hinch 2016
# Released under the MIT licence
However I'm not a lawyer nor an expert on licensing so I'd welcome any comments from anyone more knowledgeable.

Re: Can be stored data inside non volative memory ?

Posted: Sat Jul 23, 2016 8:16 am
by Iyassou
pythoncoder wrote:

Code: Select all

bram[0] = len(inBuffer)
ba[4: 4+len(inBuffer)] = inBuffer
# To retrieve
bt = bytes(ba[4:4+bram[0]])
 
Sorry if this is a silly question but I was reading the documentation for your micropower module because I'm interested in being able to store a few strings into the 4kb RAM and there's one thing that I didn't understand which was the presence of the number 4 in the instances of list slicing. I found this thread hoping it would shed light on my query but it seems that I'm missing something :? I'm a complete noob to all of this and I would really like to know the significance of the number 4 in all of this. Thanks.

Re: Can be stored data inside non volative memory ?

Posted: Sat Jul 23, 2016 11:16 am
by pythoncoder
In that code sample I stored the length of the buffer in location 0 of the backup RAM. This is a 32 bit integer, which takes 4 bytes. Consequently the buffer contents start at location 4.

The code is merely intended as an example, and the approach of saving the length of the buffer, while necessary for binary buffers, isn't the only approach when saving data with bytes constrained to a subset of possible values. The output of the Pickle module is an example. Another way would be to append a character to the buffer which is outside of the subset, such as (in the case of Pickle) 0x00. But any routine which is to retrieve data needs some way to establish where the data ends.

Re: Can be stored data inside non volative memory ?

Posted: Sat Jul 23, 2016 12:19 pm
by Iyassou
Thank you very much for the explanation, it's clear now :D Also thank you for sharing your micropower module :D