#avr Logs

Jan 26 2018

#avr Calendar

01:52 AM polygon: nuxil: interesting, but looks shit To compile LibrePCB, you need the following software components: g++ >= 4.8, MinGW >= 4.8, or Clang >= 3.3 (C++11 support is required) Qt >= 5.2 zlib OpenSSL
01:55 AM polygon: lel
01:55 AM polygon: maybe we should fork it?
01:55 AM day__ is now known as day
02:22 AM nuxil: Did you compile it?
02:23 AM polygon: negative
02:24 AM polygon: cant be bothered with crap like this now
02:24 AM nuxil: lol.. true
02:24 AM polygon: i would probably port it to bash script and it would be better
02:30 AM _ami_: polygon, nuxil is it better than kicad?
02:30 AM _ami_: oh you have not tried it yet.
02:30 AM nuxil: nop.
02:31 AM polygon: _ami_: the screenshots lrooked promising but when you read what it is made of? (building palaco outof shit)
02:31 AM nuxil: but i doubt it be better
02:31 AM polygon: *palace
02:31 AM _ami_: why another PCB editor when we already have one in open source.
02:32 AM polygon: _ami_: you meant PCB?
02:32 AM _ami_: polygon, i am just comparing it with kicad.
02:33 AM _ami_: EDA tool
02:33 AM _ami_: i meant EDA
02:36 AM _ami_: polygon, https://bintray.com/librepcb/LibrePCB-Nightly/LibrePCB-Nightly-Linux-x86_64 there is a binary for linux
02:38 AM polygon: i dont care :)
02:38 AM polygon: btw im on 32 bit and the libs probably mismatch.
02:39 AM polygon: nobody compiles static, they are dumb
02:39 AM _ami_: :)
02:47 AM polygon: https://en.wikipedia.org/wiki/Crowbar_%28circuit%29
02:47 AM polygon: haha
03:20 AM nohit: morning
03:28 AM gnom: good morning
03:30 AM Trangar: Moin
03:33 AM nohit: nuxil do you have public repo somewhere for your DDS project?
03:34 AM _ami_: this is pretty neat: http://www.fischl.de/dcdccontrol/
03:34 AM nohit: _ami_ how's your experiments with stm32's DACs?
03:35 AM _ami_: nohit, stm32f103c8t6 (aka blue pill) does not have DACs
03:35 AM _ami_: btw, i able to achieve DAC on my other board stm32f407
03:35 AM nohit: hmm maybe it was someone else then
03:36 AM _ami_: nohit, btw, stm32f1 has 16 PWM channels so it can be used as DACs :D
03:37 AM Trangar: Does the blue pill have 16 PWM channels?
03:37 AM _ami_: yes
03:37 AM nohit: nice
03:37 AM Trangar: Oh crap, I made my own PWM software
03:37 AM Trangar: Whoops
03:37 AM nohit: i made a multi waveform oscillator yesterday with stm32L4 nucleo board and its built in dac
03:37 AM day__ is now known as day
03:38 AM nohit: needs little work still
03:38 AM _ami_: nohit, nice.
03:39 AM _ami_: is your work published somewherE? github? or blog?
03:39 AM nohit: no
03:39 AM nohit: i use bitbucket and its unlimited private repos
03:40 AM Trangar: nohit: I only count 15 http://wiki.stm32duino.com/images/a/ae/Bluepillpinout.gif
03:43 AM Trangar: I suspect pb2 is also pwm but it's used for the boot pin
03:43 AM nohit: i dont know, i dont have a blue pill
03:45 AM Trangar: Err _ami_ ^
03:45 AM Trangar: My bad
03:46 AM _ami_: Trangar, let me check my notes
03:47 AM _ami_: aha, PA8 and PA9 are shared by TIM3 and TIM1
03:48 AM _ami_: so it should be 14.
03:48 AM Trangar: Ah
03:53 AM _ami_: Trangar, i might be wrong. i am reverifying with DS.
03:54 AM Trangar: Take your time, I won't be doing stm stuff until tomorrow
04:14 AM _ami_: Trangar, http://www.st.com/content/ccc/resource/technical/document/datasheet/33/d4/6f/1d/df/0b/4c/6d/CD00161566.pdf/files/CD00161566.pdf/jcr:content/translations/en.CD00161566.pdf
04:14 AM _ami_: check Table 5
04:14 AM _ami_: for pin definitions.
04:16 AM _ami_: Trangar, it has 21 pwm pins if you include complementary PWM pins and BKIN and ETR pins
04:17 AM _ami_: TIM1 is an advanced timer and it has 9 channels
04:17 AM _ami_: others TIM2/3/4 has 4 pwm channels.
04:18 AM Trangar: Oh nice
04:18 AM _ami_: BKIN and ETR pins are for controllign motors i think.
04:18 AM _ami_: i did not play with BKIN/ETR yet.
04:18 AM Trangar: I just made my own software pwms
04:19 AM _ami_: TIM1 => 4 pwm + 3 complementary pwm + ETR + BKIN = 9 channels
04:19 AM Trangar: I guess for the next time I'll just make my own board and expose those pins
04:29 AM polygon: [10:34] <_ami_> nohit, btw, stm32f1 has 16 PWM channels so it can be used as DACs :D - pwm channel is output
04:29 AM polygon: [10:35] <nohit> nice [10:35] <Trangar> Oh crap, I made my own PWM software - ya cool, deltasigma ?
04:29 AM _ami_: polygon, well, i meant with low pass filter + op-amp
04:30 AM polygon: _ami_: oh
04:30 AM Trangar: polygon: I just made a list of values I'm writing to memory location, and loop through that list
04:30 AM polygon: _ami_: btw software deltasigma is better
04:32 AM polygon: this https://hackaday.io/project/6356-delta-sigma-versus-pwm
04:33 AM Trangar: It's currently running the leds in a shared room and it doesn't flicker
04:34 AM Trangar: It might get worse when I add usb :D
04:35 AM nohit: _ami_ this is the code i ported to stm32 https://pastebin.com/3Ha0k80X
04:35 AM polygon: _ami_: r2rdac lel :)
04:39 AM Trangar: polygon: https://github.com/pixelbar/led_controller/blob/master/src/main.rs#L137-L152
04:39 AM Trangar: Beware: messy code
04:43 AM polygon: i only C
04:43 AM polygon: no scripts on mcu now
04:44 AM Trangar: Rust's compiled
04:44 AM Trangar: And the executable is generally on-par with C and C++ in terms of size and speed
04:45 AM polygon: That won't convince me not to use C
04:45 AM Trangar: I'm not trying to convince you :P
04:45 AM Banonee: i wanna python on avr or stay c :(
04:46 AM Trangar: CPython's apparently very good on mcus
04:46 AM nohit: i think im gonna add .wav playback for the project and make it some sort of groovebox eventually
04:46 AM Banonee: 2kb much ram ^^
04:54 AM polygon: cpython haha
04:55 AM polygon: ofc for switching relays or leds and logic stuff that does not require best performance you could get away with some script on mcu too
04:56 AM polygon: i am just not sure why would you
04:56 AM Trangar: Aren't there javascript ESPs?
04:56 AM polprog: my stm32s havent arrived yet *twitch*
04:56 AM polygon: is it that simpler/better/faster to write ?
04:56 AM polygon: polprog: ;/ china?
04:56 AM Trangar: polprog: should've just come visit me
04:57 AM polprog: polygon: poland. its like 6 hours drive from here
04:58 AM polygon: there is also a thing that mcus have very limited resources, and if your script interpreter runs out of ram then your plane will dive
04:58 AM polprog: Trangar: in retrospect id get them faster like that
04:58 AM Trangar: polygon: I have several mcus that literally just switch 1 relay, so I really don't need performance there
04:59 AM polygon: polprog: that blue thing miniboard with selder pads ?
04:59 AM polprog: polygon: yeah
04:59 AM polprog: i may just go and buy the bare chips
04:59 AM polygon: Trangar: ok you use cpython?
04:59 AM Trangar: http://wiki.stm32duino.com/index.php?title=Blue_Pill
04:59 AM Trangar: polygon: nah rust, I'm just playing devils advocate
05:00 AM polygon: polprog: well almost the same, diff is you create your board then
05:00 AM Trangar: polprog: if you do give me a sign, we might be able to buy something in bulk and send it to the other
05:00 AM Trangar: I can probably find some others that are interested
05:00 AM polygon: Trangar: can you reason your choice?
05:01 AM Banonee: i just want to import matplotlib to draw with an atiny XD
05:01 AM Trangar: polygon: I feel more comfortable writing Rust code than C code, and it compiles to similar-enough machine code that it doesn't matter for performance
05:01 AM polygon: well i picked an stm that has 260 minimum order
05:01 AM polygon: lel
05:02 AM polygon: but some places sell them for like 5x price per one
05:02 AM polygon: good business?
05:02 AM Trangar: I bought mine for $1.57 or something
05:02 AM polprog: Trangar: haha, i have this idea to implement Travelling Hacker Box
05:03 AM polprog: polygon: i learnt avrs with a bare chip on a breadboard. this shouldnt be hard, given that i have a breakout PCB
05:03 AM nohit: nucleos are the best in my opinion
05:03 AM Banonee: i have one but don't know how to prog it in gcc with minimum files
05:03 AM polygon: http://wiki.stm32duino.com/index.php?title=File:STM32_Blue_Pill_perspective.jpg - no watch crystal? ;< and what is that xtal on that? doesn't it have internal RC?
05:04 AM nohit: havent used blue pill, but it doesnt have debugger built in
05:04 AM Trangar: You can debug it with openocd just fine
05:04 AM polygon: also no TVS diode, no fuse, no crowbar... what kind of dev board is that? :)
05:04 AM polprog: nohit: i was looking at nucleos - i like this programmer PCB that looks like it's snap off. if i fail with openocd or it turns out to be difficult i will buy a nuckeo
05:05 AM polprog: polygon: crowbar ? manig zif socket?
05:05 AM polygon: https://en.wikipedia.org/wiki/Crowbar_%28circuit%29
05:05 AM polygon: :)
05:06 AM Trangar: I admit I blew up a couple of blue pills with 12v
05:06 AM Banonee: you can snap it off to have own progger
05:06 AM polprog: Banonee: yeah
05:06 AM nohit: so how do you connect the blue pill to pc for debugging?
05:07 AM polprog: nohit: JTAG
05:07 AM Trangar: 4 pins on the top-right connect to an STLink
05:07 AM nohit: :D
05:07 AM nohit: so you still need STLink
05:08 AM nohit: why not spend few bucks more and get the STlink built in
05:08 AM polprog: nohit: openocd on raspi is said to be able to program them
05:08 AM Trangar: Yeah but stlinks are only $2 and you don't need it after you're done deving
05:08 AM Trangar: I just add 2 rows of headers on my pcbs and plug these in
05:09 AM Trangar: And I can swap and debug them if needed
05:09 AM nohit: yeah
05:10 AM nohit: my co-worker is using blue pill to make a CIA chip tester
05:11 AM polprog: okay im looming at that crow bar circuit and the adjustable zener. i need a refreshment on opamps. when the + input is higer than output then the output goes up?
05:11 AM Trangar: I really need to learn the basics of electronics tbh
05:12 AM polprog: looking*
05:13 AM nohit: its been a while since i used op amps but i think if + is higher than - output goes up
05:13 AM Banonee: whould go up with infinity gain to around +vcc, to the rail voltage
05:14 AM polprog: ok
05:15 AM Banonee: o wait, i thought you did mean the voltage between the inputs x.x
05:16 AM polygon: openocd can do parallel port wiggler and xil
05:16 AM polprog: whatever, nie thing about TI is that they tell you how to use what they give you
05:16 AM polprog: and how it works
05:18 AM polygon: opamp adjusts output so trying to pull - input to the level of + input
05:19 AM polygon: no if, works both ways, up, down
05:20 AM polygon: haha lel i know of a company tht doesnt
05:20 AM polygon: polprog:
05:20 AM nohit: i dont have anything bad to say about TI either
05:21 AM polygon: they sell crappy led drivers and they want you to sign nda to get a description on how to use them
05:21 AM polprog: hahaha
05:22 AM polygon: i asked the distributor for some ics, and said to them that i need the datasheet to be able to use it unless i wont buy any ;>>
05:23 AM polygon: they didnt require nda to sell that crap
05:26 AM polygon: when they ask random funny shit from you you can always choose not to buy
05:26 AM Trangar: Hmm this site seems good to learn basic electronics https://www.electronics-tutorials.ws/
05:27 AM polygon: would have liked it 20 years ago
05:28 AM polygon: it is only theory though https://www.electronics-tutorials.ws/opamp/opamp_1.html
05:29 AM polygon: there should be at least a simple working prototype of something
05:33 AM Trangar: I still don't get what it does
05:34 AM polygon: subtracts + from -, multiplies by gain and outputs, in short
05:34 AM polygon: this is why it is operational amplifier
05:35 AM polygon: subtracts - from +, multiplies by gain and outputs, in short
05:36 AM polygon: (Vin+ - Vin-)*1000000=out
05:43 AM polygon: check this out http://www.ti.com/lit/ds/symlink/lm158-n.pdf
05:44 AM polygon: there are example circuits coo
05:46 AM nohit: Trangar learn the two basic configurations: inverting and non-inverting. the math is very easy with those iirc
05:52 AM day__ is now known as day
05:58 AM polprog: SecureCRT.
05:58 AM polprog: how crazy do you have to be to pay for a terminal program
06:01 AM day__ is now known as day
06:05 AM _ami_: polygon, it has internal clock as well. we call it hsi and it has 8 mhz ext crystal (hse)
06:06 AM polygon: not missing the watch crystal? :)
06:07 AM _ami_: for 72MHz, we just multiply the PLL factor to 9
06:07 AM polygon: [13:03] <+polygon> <+rindolf> for i in 1 .. 1000 { if i % 3 == 0 or i % 5 == 0 { sum += i; } } question is how this will get interpreted { if ( ( (i % 3 == 0) or (i % 5) ) == 0 ) { sum += i; } } ? ;)
06:07 AM _ami_: polygon, one example of 48Mhz clock implementation: https://github.com/amitesh-singh/FASTUSBasp/blob/master/lib/rcc.cpp#L45
06:07 AM polygon: _ami_: how would you go for a timebase? With preferable high resolution
06:08 AM polygon: I think i would connect the lfquartz output to systick pin
06:11 AM Trangar: nohit: I'll start with the basics; volt and amps :D
06:12 AM polygon: Trangar: feels like 1995 again
06:12 AM Trangar: :D
06:13 AM polygon: Lazard - 4 O'clock in the morning https://www.youtube.com/watch?v=Esx6UyfPIgE No Limit https://www.youtube.com/watch?v=RkEXGgdqMz8
06:28 AM polprog: No Limit.
06:28 AM polprog: the band that made cool music but as soon as youve bought their album it turns out all the music is literally the same structure :P
06:28 AM polprog: still, cool tunes
06:29 AM Trangar: Can't improve on perfection
06:29 AM polprog: https://www.youtube.com/watch?v=7wfYIMyS_dI
06:30 AM Trangar: I need to make a song with that intro, but just keep repeating the intro
06:30 AM polprog: https://www.youtube.com/watch?v=ZOm0BruEVT0 this was the peak use of autotune. its impossible to repeat this in a way it doesnt sound like crap
06:31 AM polprog: besided from cher soundking like she was a drag queen
06:31 AM polprog: lol
06:31 AM polprog: ping polygon
06:32 AM polprog: back when MTV played music ;)
06:39 AM nohit: i think that's the song that started it all
06:39 AM nohit: making the response time to very small
06:39 AM nohit: so it goes instanly to the correct pitch
06:40 AM polprog: thats the effect, basically
06:45 AM nohit: this is cool https://www.izotope.com/en/products/create-and-design/vocalsynth.html
06:45 AM polygon: JizzBuzz revised https://pastebin.com/TnNryUxN
06:46 AM polprog: nohit: coll plugin
06:46 AM polprog: cool*
06:48 AM Trangar: I really don't miss C's macros
06:49 AM polygon: polprog: Arrakis The Spice Original mix https://www.youtube.com/watch?v=gPdAU5VRMuA
06:49 AM polprog: you know the track is good when the recommedned videos are on your plalists
06:50 AM polprog: i like the graphics
06:50 AM polprog: ;)
06:51 AM polygon: i remember i saw one that hos graphics
06:51 AM polprog: good electronic tunes
06:52 AM polprog: this bass makes my desk vibrate with those speakers
06:53 AM polprog: its a little bit too much bass
06:54 AM polygon: haha https://www.youtube.com/watch?v=j4QaHSwtwKI
06:54 AM polygon: Dune PC Intro (CD)
06:55 AM polprog: polygon: https://www.youtube.com/watch?v=p8IVONhSEY0
06:57 AM polprog: i should play that game
06:58 AM polprog: the time when games have had real cinematics
06:59 AM polygon: polprog: she has good graphics https://www.youtube.com/watch?v=zZD99X_S7SA
07:00 AM silipwn: Hello everyone
07:00 AM silipwn: I was wondering if you guys tried reverse engineering AVR Files.
07:01 AM polprog: which AVR files do you mean?
07:01 AM silipwn: Hex files
07:01 AM polprog: the hex file is a very simple and well documented format
07:01 AM polprog: https://en.wikipedia.org/wiki/Intel_HEX
07:02 AM polygon: silipwn: mostly i see no meaning in "reversing" hex files
07:02 AM silipwn: I see.
07:02 AM silipwn: I meant, I have the IHEX files, I need to look into what the program does.
07:03 AM polprog: you should be able to write a simple converter to binary file
07:03 AM polprog: and then use a disassembler on that
07:03 AM silipwn: OK, thanks for the help.
07:04 AM Trangar: There are hex to bin tools online
07:04 AM silipwn: converter like objcopy?
07:04 AM silipwn: I would have to use avr-objcopy though.
07:04 AM Trangar: http://hex2bin.sourceforge.net/
07:04 AM silipwn: Thanks Trangar
07:07 AM polprog: you can use avr-objcopy: http://www.avrfreaks.net/comment/1770406#comment-1770406
07:12 AM polprog: ping silipwn
07:12 AM polprog: ^
07:15 AM silipwn: Sure, polprog
09:33 AM nuxil: nohit, cant say i do. i dont even have my own webpage.
10:02 AM polygon: fun with 9V batteries https://www.youtube.com/watch?v=8hwLHdBTQ7s
10:03 AM polprog: quite a few of them
10:04 AM polprog: lot*
11:50 AM mudkip908_ is now known as mudkip908
02:15 PM polprog: polygon: search Youtube for "Marek Bilinski"
02:15 PM polprog: you will like it ;)
02:17 PM nohitzwork: i have ran out of mini usb cables
02:18 PM nohitzwork: found one from ps3 controller
02:18 PM nohitzwork: nucleos dont come with one, its a shame
02:18 PM polprog: lol
02:18 PM polprog: how much do those cost in bulk...
02:19 PM nohitzwork: idk. i should buy 10 of them
02:26 PM * polprog glances at national post tracking page
02:26 PM polprog: last status 2 days ago. srsly...
02:26 PM polprog: i should have taken DHL/UPS
02:29 PM polprog: cmd exe is werd o_o. i accidentally typed "ls" instead of dir... and it listed the files
02:30 PM polprog: what
02:30 PM polprog: this is gnu ls, when did i install that??
02:30 PM nuxil: ?
02:31 PM polprog: why do i have gnu coreutils on windows
02:31 PM polprog: huh, nice
02:31 PM polprog: i guess?
02:32 PM polprog: oh, vim probably did that
02:34 PM polygon: polprog: winshit has stolen many stuff fromunix and linux
02:34 PM polprog: i think NT kernel has support for some unix like soft. that what WSL is running on i believe
02:35 PM polprog: plus, they were stealing shit from each other those days :P
02:35 PM polprog: Xerox was the first to invent GUIs
02:35 PM polygon: also, thereis a wm called ratpoison :)
02:36 PM polprog: and whats witht hat wm?
02:36 PM polygon: it uses keyboard, only
02:36 PM polprog: i think ive seen it
02:37 PM polprog: the weirdest WM ive seen is twin - its a txt mode WM
02:37 PM polygon: and winshit was gonna patent rat double click ;>
02:38 PM polygon: nah wrote some hamming like calculus
02:39 PM polygon: unsigned int and friends c types are cancer
02:39 PM polygon: printf supports cancer
02:42 PM polprog: ive heard of friends in context of c++
02:43 PM polygon: so when you have a 64 bit variable and you want to use it on whatever platform printf gives you the finger
02:45 PM nuxil: printf("%llu", foobar)
02:46 PM polprog: i cant believe that, i need to see it myself
02:47 PM polygon: nuxil: try printing values on 32 and 64 bit system with same code
02:47 PM polygon: c is portable you know...
02:47 PM polygon: i use stdint, fixtypes
02:49 PM polprog: thats right, it craps itself, looks
02:49 PM polprog: s
02:49 PM polprog: fuck
02:49 PM polprog: https://puu.sh/zahLg/a098ea704b.png
02:50 PM polprog: prints a dword
02:50 PM nuxil: llu
02:50 PM nuxil: if you know its a 64 bit unsign int. use llu
02:51 PM polprog: thats right, now works
02:51 PM polprog: i would have expected that to be 64 bit compatible. or even better, word length independent
02:55 PM polygon: polprog: it was possible to make a printf work on 64 bit, but compiled same code on 32 bit and it shat itself
02:56 PM polprog: now lest bump the stake and use __int128 ;)
02:56 PM nuxil: polygon, read up on printf. its fully porteble if you know its limitation/how to print mics data types :p
02:56 PM polygon: i guess that will not be gcc
02:57 PM polygon: nuxil: i dont want to spend my time porting printf for every architecture :)
02:58 PM polygon: i would require my code to compile and work
02:58 PM nuxil: umm how is adding in "%llu" any hard work ?
02:58 PM polygon: well i used hundreds of times in some stuff
02:59 PM polygon: and changing every instance accordingly is crappy
02:59 PM nuxil: replace in files :p
02:59 PM polygon: there probably exist hacks, im just saying that it is cancer
03:00 PM polprog: sed -i 's/%d/%llu/g' watch things break catastrophically
03:00 PM polygon: also how is it not possible to autodetect a type? :)
03:01 PM nuxil: its not cancer becaue you didnt use llu with printf on uint 64bit. thats on you.. not C :p
03:01 PM polygon: write a friggin number that is there as parameter
03:02 PM polygon: nuxil: i wrote code on 64 and on 32 bit too, ever tried?
03:02 PM polygon: you start writing crap, then the sizes of your variables change
03:06 PM polygon: "64-bit operating systems are now appearing in which long integers are 64 bits long. With GCC, long integers are normally 32 bits long and long long integers are 64 bits long, but it varies with the computer hardware and implementation of GCC, so check your system's documentation."
03:06 PM polygon: :)
03:07 PM nuxil: i mean. if i understood prinf right. printf is setup to for int. on 64 bit system its still only 4bytes. so you may say that printf uses "%i" by default. if your variable is biggert than 4 bytes you need to spesicy so using l for long, unsing long long 64bit var.
03:07 PM polygon: you can't even predict them
03:44 PM * nuxil is back with more coffee
03:44 PM nuxil: polygon, what do you mean you cant predict them ?
03:45 PM polygon: what i pasted
03:46 PM polygon: it is non standard, nor logical.
03:46 PM nuxil: sizeof(int) and you know the size of int on that platform. besided. you should know what datatype you function is printing out. so for thouse functions who use 64bit prinf with llu.
03:48 PM polprog: if its platfrm dependent then preprocessor could help
03:49 PM polprog: there are those macros that tell you whether you are compiling on windows or linux
03:49 PM polprog: for example
03:49 PM polprog: and surely there are macros that tell you whether you build for a 32 or 16 bit cpu
03:49 PM polprog: s/16/64/
03:57 PM polygon: https://usrmisc.wordpress.com/2012/12/27/integer-sizes-in-c-on-32-bit-and-64-bit-linux/
03:59 PM polprog: whats size_t ?
04:00 PM nuxil: size_t 32 bit 64 bit
04:00 PM nuxil: scroll up
04:00 PM nuxil: :p
04:01 PM polprog: i assume its the CPU word size then
04:08 PM nuxil: hmm doesnt gcc have a typeof for C?
04:08 PM polygon: size_t can store the maximum size of a theoretically possible object of any type (including array)
04:08 PM nuxil: i cant test now. but assume it does.
04:08 PM nuxil: cant you make an ugly macro like:
04:08 PM nuxil: #define DT(x) (typeof(x) == int) ? "%i" : (typeof(x) == long) ? "%l" : "ll"
04:08 PM nuxil: int foo = 123;
04:09 PM nuxil: printf(DT(foo), foo);
04:09 PM polygon: nuxil: Some functional logic in C's macro (gcc) lazycode https://pastebin.com/v1wEu4Xd Macro Magic in C (gcc), functional logic, polymorphism https://pastebin.com/z0sw6hK7 foreach() array in C ;) (gcc) https://pastebin.com/B0DBzNYp Si/IEC prefixes printf(value) and symbol in C https://pastebin.com/eEX68wt9 C point and vector structs/types https://pastebin.com/Vb1XLszP
04:09 PM polygon: it does
04:10 PM polygon: nuxil: ya was thinking about it
04:11 PM polygon: gcc hates it :)
04:18 PM nuxil: another idea. since your just using a prinf statement. you do not really care about the variable size. why not look into itoa or something like dtostrf and stringify it.
04:18 PM nuxil: then just use printf("%s", foobar)
04:19 PM nuxil: but that comes at some costs :p
04:24 PM polygon: nuxil: i have a half solution for what you proposed
04:25 PM polygon: https://pastebin.com/aEWCjxGB
04:26 PM nuxil: #define _print_crap_int lol
04:26 PM nuxil: hope its not to smelly :p
04:28 PM nuxil: you are missing the u's ?
04:29 PM polygon: it would only define the number of l- so you could write anything before after but gcc hates it now
04:31 PM polygon: wanted to create a define that just returns a text depending on parameters
04:32 PM polygon: so i could do printf("%16"_print_crap_int_(ind)"x = ", (ind));
04:32 PM polygon: but gcc started crying and ran away
04:44 PM cehteh: what do you mean?
04:45 PM cehteh: what is 'ind'
04:51 PM polygon: cehteh: macro parameter, whatever int type
04:52 PM polygon: error: called object ‘"%16"’ is not a function
04:52 PM polygon: :)
04:53 PM Casper: I got a simmilar to that before
04:53 PM Casper: fun to debug
04:54 PM polygon: i would guess this is not possible
05:07 PM polprog: i like the itoa idea
05:07 PM cehteh: possible with the new C generics stuff, dunno if avr-gcc has that already
05:08 PM cehteh: otherwise, you can infer the type at compiletime with some tricks, but i dont know any other way to make a type-switch based on that
05:08 PM polprog: switch(sizeof())
05:09 PM polprog: possibly have a func that takes a union as an arg, correct me if im wrong, i never used unions
05:14 PM polygon: anyway priu thing might work
05:15 PM cehteh: there are plenty different types with the same size
05:16 PM cehteh: https://en.wikichip.org/wiki/c/generic_selection
05:16 PM cehteh: that gives you the type-switch, but needs a fairly modern C compiler
05:17 PM cehteh: gcc has typeof() but cant be used in a switch
05:29 PM polygon: so
05:29 PM polygon: ( sizeof( (_var_) ) == sizeof( unsigned int ) ) ? ({"";}) : \ - this works
05:30 PM polygon: gcc just fails to concat the macro with the format string
05:30 PM polygon: printf("%16"_print_crap_int_(ind)"x = ", (ind)); \
05:30 PM polygon: here
05:30 PM cehteh: sizeof os unreliable
05:30 PM cehteh: and yes of course you cant mix C code into literal strings
05:31 PM cehteh: even when you know its statically evaluated, its still not legal
05:31 PM cehteh: you have to reduce that to preprocessor features somehow
05:32 PM cehteh: and there the only way to switch on types is the new _Generic stuff, at least as much i know
06:05 PM shifttymike is now known as Guest20503
06:13 PM nuxil: sizeof is unreliable ?? then why do people use it all the time with malloc, example? ptr = (int *)malloc(sizeof(int));
06:19 PM cehteh: unreliable to detect the underlying type
06:39 PM polprog: apropos your printf https://mort.coffee/home/obscure-c-features/ look at generic macro there
06:39 PM polprog: nuxil: polygon
06:42 PM nuxil: is _Generic in gcc ?
06:42 PM polprog: yeah
06:42 PM polprog: i think
06:44 PM nuxil: but that might be stripped out from avr-gcc and other compilers.
06:46 PM polprog: i was about to ask how are other arch versions constructed
06:46 PM polprog: is there a modular frontend and architecture dependent backends?
06:47 PM nuxil: no idea.
06:47 PM polprog: ordifferent arch versions are completely independent?
06:47 PM polprog: hmm
06:47 PM polprog: im too tired to understand it anyway
06:47 PM polprog: goodnight
06:55 PM nuxil: gn
06:55 PM nuxil: polprog, why you go to bed so early now when its weeken. but at weekdays you stay up to like 3-4 am :p
10:40 PM nuxil: so i got my test cables today i ordered on ebay a month ago. :) 1m 50ohm male bnc-bnc. for my dds to scope. and a cople of brymen goldplated teast leasds.
10:41 PM nuxil: i saw this guy in one of eevblog's videos. and i thouhgt. hmm why not try him out.
10:42 PM nuxil: https://www.ebay.com/sch/f-t-2000/m.html?item=171162377470&rt=nc&_trksid=p2047675.l2562 2nd item test lead i ordered. they are verry nice :) way better than expected :p
11:41 PM day__ is now known as day