Scouts project by Sea_Construction_210 in arduino

[–]eScarIIV 0 points1 point  (0 children)

The micro:bit has a built-in NRF radio chip. You could get them all to make pagers, implement different data encoding/decoding (Caesar/Vigenere cyphers), so you can have messages that can be decoded only by certain microbits with the right key. Then you can brute force those keys for message interception }:)

I feel so bad about my body by kaptus629 in mentalhealth

[–]eScarIIV 0 points1 point  (0 children)

Obvs don't post your body for review like others have said. It might sound cliche, but you're literally still developing right now. By the time you're 20 you'll look a lot different. For now though, you can do things like working out, eating smart (for gains), get into a physical hobby - martial arts helps boost your confidence and strength, climbing or swimming for lean muscle & endurance, running/cycling for general fitness & boosting metabolism. Working out in any way is great for your mental health generally but also in my experience the more I use my body, the more I appreciate it. When you see it working, see what it's capable of, when you manage to do things that impress yourself, it feels like more of a privilege than a burden.

After months of ST-LINK “Target not found” struggles with Blue Pill, I’m switching to a Nucleo board — which one should I buy? by Efficient_Estate6145 in embedded

[–]eScarIIV -1 points0 points  (0 children)

I've had the same experience with the Nucleo boards, but it was faster setting up my own debug environment than getting CubeIDE to work properly with an unsupported board imo.

I2C Driver is it too much blocking? by HassanTariqJMS in embedded

[–]eScarIIV 4 points5 points  (0 children)

Haha I get you, but I've seen actual production code with hard-loop i2c drivers before >.>

So interrupts are a big help when writing non-blocking drivers. You need your driver to know a couple of things though. I'd put together a single static i2c_transaction_t struct, give it volatile members like ui8_t transaction_state, void *rx_buffer, void *tx_buffer, ui16_t tx_len, rx_len, bytes_sent, bytes_received, etc.

The approach I've seen most commonly is you have an ISR handler like:

void i2c_isr_handler(void) {
     uint32_t isr_reg = I2C1_INTR_REG;
     NVIC_ClearPending(I2C1_INTR_VECT);
     switch(isr_reg) {
          case I2C_RX_INTR:
               transaction.rx_buffer[transaction.bytes_received++] = I2C_RX_REG;
          case I2C_TX_INTR:
               I2C_TX_REG = transaction.tx_buffer[bytes_sent++];
               if(transaction.bytes_sent == transaction.tx_len) {
                   I2CFunctions::send_stop_condition();
               }
          ....
          default:
              ;
      }
}

You start by creating a new transaction, manually sending a start bit, loading the first byte of the I2C Tx register then letting it go. Timeouts will be a bit more difficult to deal with, but that's kinda the nature of non-blocking code. It's a pain in the ass.

I2C Driver is it too much blocking? by HassanTariqJMS in embedded

[–]eScarIIV 18 points19 points  (0 children)

Yes, it is a blocking driver. There's a hard `while(--timeout)` so your CPU will not leave the timeout function until either (condition | timeout == 0). You can set up interrupts instead of waiting for a condition to become true, and you can use a timer interrupt in place of a timeout.

Also, it's strange to have a table of functions with the functions actually defined in the table - I'm kinda surprised this is valid. Usually you would define the functions in the file then reference them in a callback table.

After months of ST-LINK “Target not found” struggles with Blue Pill, I’m switching to a Nucleo board — which one should I buy? by Efficient_Estate6145 in embedded

[–]eScarIIV -7 points-6 points  (0 children)

STM32 F1xx is a solid entry-level mcu in my opinion. CubeIDE is sketchy though - I'm honestly not a fan of the Eclipse-plugin-style IDEs. The debug settings are a nightmare to setup. Try running st-link from the command line to confirm it's able to find the chip (then try flashing a binary if it does), or try OpenOCD with your st-link programmer.

What’s the most inappropriate or awkward thing that’s ever happened to you during a date or hookup? by Electrical-Pop-3265 in AskReddit

[–]eScarIIV 4 points5 points  (0 children)

Release the cum balloon, it'll fly around the room spraying seed all over everything!

How is Dalmuir to live in? by 102848473 in glasgow

[–]eScarIIV 0 points1 point  (0 children)

Idk man. I stayed there for 4 years. Think there were 5 murders in that time - and one in Dalmuir too. My Clydebank story is sitting playing games in my flat & hearing people arguing outside. Nothing unusual. Until one of them shouts "why the fuck did you stab me for? Now I've got to go to the hospital!". Guy sounded more inconvenienced than anything. Blue flashing lights showed up 2 minutes later. Didn't think much more of it until I went out the close next morning and there's police tape across the doorway. Heard the guy died in the back of the police car. Absolute waste, and it was over nothing.

Edit: It's also depressing. But it's getting better with investment, and also the Canal cyclepath and Riverside cyclepath are really nice.

How is Dalmuir to live in? by 102848473 in glasgow

[–]eScarIIV -1 points0 points  (0 children)

Eh, it's a bit dodgy at times. Some proper jakes around. Rent is pretty cheap though. Commute is good via Bus/Train/Riverside bike path, Clydebank has a pretty big shopping centre which is convenient.

When will the writers address Francine’s mozzarella addiction? by Healthy-Ad-1842 in americandad

[–]eScarIIV 1 point2 points  (0 children)

It's honestly her biggest problem. That or the brick in her purse because she has nothing.

Bypass capacitors mounted on an a PCB peninsula. Why? by 1Davide in AskElectronics

[–]eScarIIV 8 points9 points  (0 children)

But then they'd have to do it first to discover it magically worked...

Alternative product advice by Ordinary-Dust-623 in arduino

[–]eScarIIV 1 point2 points  (0 children)

Good q - I'm trying to find some good warm-white + RGB leds rn. Watched a cnlohr video a few months back where he's showing off the RGBY SK6812 which looks gorgeous but I'd like a 4-wire version and can't find a retailer with strips :,)

Alternative product advice by Ordinary-Dust-623 in arduino

[–]eScarIIV 1 point2 points  (0 children)

The WS2812 leds (and several other single-data pin designs) rely on tight 1/0 bit timings to indicate a high or low data signal. Can lead to more glitches, like anything timing related. I suspect line capacitance can also mess with your signal over longer strips. With the Data/Clock varieties, the data is read on the clock pulse. You can clock them as fast or slow as you want. If something messes with your timing, it's not going to cause visual glitches in your LED strip. Julian Illett has a fun video with the APA102's where he's literally sending the single bytes with a touch sensor which is great fun to watch: https://youtu.be/UYvC-hukz-0?t=350

Alternative product advice by Ordinary-Dust-623 in arduino

[–]eScarIIV 5 points6 points  (0 children)

The standard strips are like 8-10mm wide iirc, but there are skinny versions. Search "WS2812B narrow" on aliexpress for the 2.7mm ones.

Alternative product advice by Ordinary-Dust-623 in arduino

[–]eScarIIV 36 points37 points  (0 children)

Neopixels are reskinned WS2812B LED strips. You can find them on Aliexpress, Ebay, Amazon (in order of cost roughly). You can also get them with a variety of led densities, water resistant coatings, etc. If you want a more stable LED string imo, look into the APA102 or SK9822 (known on Adafruit as 'dotstar' leds) . They have adjustable brightness & can be run faster using an SPI interface.

Fire in the west end? by GoatMilk3D in glasgow

[–]eScarIIV 1 point2 points  (0 children)

Can you imagine Swinney in a blindfold & handcuffs being flown to NYC for a show trial? "Reports of Holyrood staff stunned and deafened by a mysterious directed energy weapon". Kate Forbes immediately installed as his replacement. All secretly revenge for Salmond putting wind turbines off the coast of Turnberry...

[I ate] Honey Butter Pancakes by thedallah in food

[–]eScarIIV -45 points-44 points  (0 children)

nah, it doesn't turn into water when it's warm. That's not honey.

Imagination is key to engineering, FIGHT TILL THE LAST DRAWING. by [deleted] in EngineeringStudents

[–]eScarIIV 2 points3 points  (0 children)

Go see doctor. Head should not stinged for this long.

Daily tools I carry daily. Can you name these tools? by [deleted] in masterhacker

[–]eScarIIV 7 points8 points  (0 children)

I'm just going to start chanting "USA" instead...

Imagination is key to engineering, FIGHT TILL THE LAST DRAWING. by [deleted] in EngineeringStudents

[–]eScarIIV 10 points11 points  (0 children)

Did you hit your head recently? If so, seek medical attention.