Re: [Tutor] Help with building bytearray arrays

2018-09-11 Thread Peter Otten
Chip Wachob wrote: > Peter, > > I see that clue "[[". > > The thread history pretty much sums up what is going on up to this point. > > I'll cover it once more: [snip] > I hope this helps. Unfortunately it doesn't as the problem is in my_transfer. > I'm beginning to wonder if Python was

Re: [Tutor] Help with building bytearray arrays

2018-09-10 Thread Alan Gauld via Tutor
On 10/09/18 19:15, Chip Wachob wrote: > So I see why my .join() isn't working. I'm not sure how to fix it though. I already showed you the sum() function. It can take a list of lists and add them together end_array = sum(results,[]) > My background is in C and other 'historical' languages,

Re: [Tutor] Help with building bytearray arrays

2018-09-10 Thread Cameron Simpson
On 10Sep2018 10:23, Chip Wachob wrote: So, without all the fluff associated with wiggling lines, my function now looks like this: def RSI_size_the_loop(): results = [] all_together = [] # not certain if I need this, put it in in an attempt to fix the incompatibility if it existed You

Re: [Tutor] Help with building bytearray arrays

2018-09-10 Thread Chip Wachob
Peter, I see that clue "[[". The thread history pretty much sums up what is going on up to this point. I'll cover it once more: I'm using Adafruit FT232H Breakout board and Adafruit's library. https://github.com/adafruit/Adafruit_Python_GPIO Per Adafruit's example code, I create an SPI

Re: [Tutor] Help with building bytearray arrays

2018-09-10 Thread Peter Otten
Chip Wachob wrote: > Cameron, > > Thank you again for the insight. > > Yes, data_out is an equivalently-sized 'chunk' of a larger array. > > I'm 'getting' this now.. > > So, without all the fluff associated with wiggling lines, my function > now looks like this: > > def RSI_size_the_loop():

Re: [Tutor] Help with building bytearray arrays

2018-09-10 Thread Chip Wachob
Cameron, Thank you again for the insight. Yes, data_out is an equivalently-sized 'chunk' of a larger array. I'm 'getting' this now.. So, without all the fluff associated with wiggling lines, my function now looks like this: def RSI_size_the_loop(): results = [] all_together = [] # not

Re: [Tutor] Help with building bytearray arrays

2018-09-10 Thread Alan Gauld via Tutor
On 10/09/18 04:00, Chip Wachob wrote: > I presume that I need to instantiate an array of slice_size-sized bytearrays. Cameron has already addressed this and explained that you don't need to and if you did how to do it. I'd only add that you need to readjust your thinking when it comes to Python

Re: [Tutor] Help with building bytearray arrays

2018-09-10 Thread Cameron Simpson
On 09Sep2018 23:00, Chip Wachob wrote: On Sat, Sep 8, 2018 at 9:14 PM, Cameron Simpson wrote: Actually he's getting back bytearray instances from transfer and wants to join them up (his function does a few small transfers to work around an issue with one big transfer). His earlier code is

Re: [Tutor] Help with building bytearray arrays

2018-09-10 Thread Chip Wachob
On Sat, Sep 8, 2018 at 9:14 PM, Cameron Simpson wrote: > On 08Sep2018 11:40, Alan Gauld wrote: >> >> On 08/09/18 03:15, Chip Wachob wrote: >>> >>> Ideally, I'd like to take the slice_size chunks that have been read >>> and concatenate them back togetjer into a long MAX_LOOP_COUNT size >>> array

Re: [Tutor] Help with building bytearray arrays

2018-09-09 Thread Cameron Simpson
On 09Sep2018 17:06, Chip Wachob wrote: Before I jump in, the 1000 foot view is I have to send an array of 512 bytes down the SPI loop, and read back 512 bytes that were latched in from a control interface. Unfortunately, there's a glitch in the FTDI part and I can't just send the 512 bytes..

Re: [Tutor] Help with building bytearray arrays

2018-09-09 Thread Chip Wachob
Cameron, et al. First off, thank you for being patient with me. I'm not used to the email list communication style. Since Cameron's response was the one that raised the most questions / comments, I'm going to reply to it. Inline.. now that I know that this is the preferred method... Before I

Re: [Tutor] Help with building bytearray arrays

2018-09-08 Thread Cameron Simpson
On 08Sep2018 11:40, Alan Gauld wrote: On 08/09/18 03:15, Chip Wachob wrote: Ideally, I'd like to take the slice_size chunks that have been read and concatenate them back togetjer into a long MAX_LOOP_COUNT size array to pass back to the rest of my code. Eg: You need to create a list of

Re: [Tutor] Help with building bytearray arrays

2018-09-08 Thread Cameron Simpson
On 08Sep2018 20:01, Cameron Simpson wrote: So, if I'm understanding the transfer() function correctly, the function takes and returns a bytearray type. It would be good to see the specification for the transfer function. They we can adhere to its requirements. Can you supply a URL? I see

Re: [Tutor] Help with building bytearray arrays

2018-09-08 Thread Alan Gauld via Tutor
On 08/09/18 03:15, Chip Wachob wrote: > my function's main pieces are: It would probably be better to post the entire function, a partial code sample like this just gives us an inkling of what you are trying to do but not enough to be sure of where the errors lie. > def transfer_byte_array(): >

Re: [Tutor] Help with building bytearray arrays

2018-09-08 Thread Alan Gauld via Tutor
On 08/09/18 03:15, Chip Wachob wrote: > Admin, please remove my earlier messages. No can do, once the emails are sent by the server they are out there on the net, stored in people's mailboxes and in various internet archives. When using a mailing list always check before sending, there's no

Re: [Tutor] Help with building bytearray arrays

2018-09-08 Thread Alan Gauld via Tutor
On 08/09/18 04:57, Chip Wachob wrote: > was my attempt at 'setting' the type of the variable. A variable in Python is just a name. It has no type. Only values have types. So you can set (or change) the type of a value but not of a variable. > Coming from a 'C' background, I find the lack of

Re: [Tutor] Help with building bytearray arrays

2018-09-08 Thread Cameron Simpson
Please try to adopt the inline reply style; we prefer it here. It lets us reply point by point and makes messages read like conversations. Anyway... On 07Sep2018 23:57, Chip Wachob wrote: Point taken on 'bytes'.. thanks. the scratch_ary = bytearray() was my attempt at 'setting' the type of

Re: [Tutor] Help with building bytearray arrays

2018-09-08 Thread Chip Wachob
Point taken on 'bytes'.. thanks. the scratch_ary = bytearray() was my attempt at 'setting' the type of the variable. I had hoped that it would help resolve the error messages telling me that the types didn't go together. Coming from a 'C' background, I find the lack of typing in Python to be

[Tutor] Help with building bytearray arrays

2018-09-08 Thread Chip Wachob
Admin, please remove my earlier messages. This message is a properly 'self contained' message. Hello, I've been struggling with this for the last day or so and I can't seem to figure out how to make it work. I'll start out by saying that if there's a better approach, then I'm all ears. I'm

Re: [Tutor] Help with building bytearray arrays

2018-09-07 Thread Cameron Simpson
On 07Sep2018 15:45, Chip Wachob wrote: Basically I'm trying to write a block of unsigned bytes to the device and read back an equal sized block of unsigned bytes. There's a function that is provided called transfer(data_to_send, num_of_bytes) that handles the heavy lifting. Unfortunately

[Tutor] Help with building bytearray arrays

2018-09-07 Thread Chip Wachob
Hello, I've been struggling with this for the last day or so and I can't seem to figure out how to make it work. I'll start out by saying that if there's a better approach, then I'm all ears. I'm using the Adafruit Breakout board for the FTDI FT232H part. Along with this comes the Python