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."
Can be stored data inside non volative memory ?
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Can be stored data inside non volative memory ?
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Can be stored data inside non volative memory ?
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.
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 ?
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.
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 ?
Thanks. Roberto
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Can be stored data inside non volative memory ?
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
However I'm not a lawyer nor an expert on licensing so I'd welcome any comments from anyone more knowledgeable.
In the code itself I put the words
Code: Select all
# Copyright (C) Peter Hinch 2016
# Released under the MIT licence
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Can be stored data inside non volative memory ?
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.pythoncoder wrote:Code: Select all
bram[0] = len(inBuffer) ba[4: 4+len(inBuffer)] = inBuffer # To retrieve bt = bytes(ba[4:4+bram[0]])
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Can be stored data inside non volative memory ?
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.
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.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Can be stored data inside non volative memory ?
Thank you very much for the explanation, it's clear now Also thank you for sharing your micropower module