bluehash 1,581 Posted January 27, 2014 Share Posted January 27, 2014 Thought I'd start a running thread, popular among many DIY forums. Can be anything electrical/software or mechanical/DIY. Quote Link to post Share on other sites
bluehash 1,581 Posted January 27, 2014 Author Share Posted January 27, 2014 I'll start. I have a Baofeng UV-B5 radio($30) that I use as a scanner and listen to hams in my area. My model comes with a flash flight button which is disabled, but used on a similar model. I came across this link to connect that button to control the LCD backlight on/off, which is great, so I can see the screen at night, and consumes only 10ma. Success! tripwire 1 Quote Link to post Share on other sites
dpharris 13 Posted January 27, 2014 Share Posted January 27, 2014 While waiting for my Two-Up from Qu-bd, I am contemplating building a 3D printer from scratch.... got some motors, control board .... ... and that LED - clock project is looking good :-) Quote Link to post Share on other sites
spirilis 1,265 Posted January 27, 2014 Share Posted January 27, 2014 Writing a Nokia 1202 driver for TivaWare native C, and debugging it before proceeding to write Newlib stdio stubs so it can take printf() et al.... and pondering a simple "filesystem" concept with those newlib stubs too. Figure the Tiva has the grunt to make it happen. Quote Link to post Share on other sites
bluehash 1,581 Posted January 28, 2014 Author Share Posted January 28, 2014 I did not get the filesystem part. Writing a Nokia 1202 driver for TivaWare native C, and debugging it before proceeding to write Newlib stdio stubs so it can take printf() et al.... and pondering a simple "filesystem" concept with those newlib stubs too. Figure the Tiva has the grunt to make it happen. Quote Link to post Share on other sites
spirilis 1,265 Posted January 28, 2014 Share Posted January 28, 2014 I did not get the filesystem part. Well regardless, looks like I was successful! Anyway, short story is... Newlib implements the typical POSIX crap for stdio, like open(), close(), write(), read() and stdio like fopen, fclose, fprintf, printf ... But the bottom line is, it leaves the implementation of the generics open(), close(), write(), read() etc (a few it needs in addition; isatty() and lseek()) to the end-user. If you make use of any of the stdio crap like fopen, printf ... GCC will crash with linker errors that it can't find the requisite _open(), _close() etc symbols. So I got a simple driver together (based on something I did for the Renesas RX, based on something else I saw written up about newlib stubs) that takes filenames and provides file descriptors... using a lookup table including struct's that have a const char *name it can compare the "filename" to to see if that driver has what the user wants. In this instance, the Nokia 1202 driver I wrote responds to filenames "LCD" and "LCDBACKLIT" by running nokia1202_init() and/or nokia1202_backlight(true), then returns STDOUT_FILENO as its return value. Then running printf("Hi there!") suddenly "just works". E.g. the pic I just posted Here's the TivaWare program I just wrote (a bit ugly since it uses in-line SysTick stuff to implement the RESET delay)- /* nokia1202.c */ // needed for driverlib rom stuff #define TARGET_IS_BLIZZARD_RA1 1 #include <stdio.h> #include <stdint.h> #include <stdbool.h> #include "inc/tm4c123gh6pm.h" #include "inc/hw_types.h" #include "inc/hw_memmap.h" #include "driverlib/sysctl.h" #include "driverlib/rom.h" #include "driverlib/rom_map.h" #include "driverlib/pin_map.h" #include "driverlib/gpio.h" #include "driverlib/ssi.h" #include "nokia1202_drv.h" #include "ste2007.h" #include "font_5x7.h" int main() { MAP_SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // 80MHz CPU; speed is calculated as 200MHz/SYSDIV // SPI, GPIO config for Nokia 1202 LCD MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); MAP_GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_6); // Default chipselect state = HIGH (deselect), default backlight = LOW (OFF) MAP_GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_6, GPIO_PIN_5); MAP_GPIOPinConfigure(GPIO_PB4_SSI2CLK); MAP_GPIOPinConfigure(GPIO_PB6_SSI2RX); MAP_GPIOPinConfigure(GPIO_PB7_SSI2TX); MAP_GPIOPinTypeSSI(GPIO_PORTB_BASE, (GPIO_PIN_4 | GPIO_PIN_6 | GPIO_PIN_7)); MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2); MAP_SSIConfigSetExpClk(SSI2_BASE, MAP_SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 4000000, 9); MAP_SSIEnable(SSI2_BASE); // Need at least 250ms reset + 250ms wait before Nokia LCD is ready to receive commands ROM_SysTickPeriodSet(80000*125); ROM_SysTickIntDisable(); HWREG(NVIC_ST_CURRENT_R) = 1; ROM_SysTickEnable(); while (ROM_SysTickValueGet() < 10000) ; while (ROM_SysTickValueGet() > 10000) ; ROM_SysTickDisable(); HWREG(NVIC_ST_CURRENT_R) = 1; ROM_SysTickEnable(); while (ROM_SysTickValueGet() < 10000) ; while (ROM_SysTickValueGet() > 10000) ; ROM_SysTickDisable(); MAP_GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_6,GPIO_PIN_6); // drive LCD_RESET HIGH pulling LCD out of RESET HWREG(NVIC_ST_CURRENT_R) = 1; ROM_SysTickEnable(); while (ROM_SysTickValueGet() < 10000) ; while (ROM_SysTickValueGet() > 10000) ; ROM_SysTickDisable(); HWREG(NVIC_ST_CURRENT_R) = 1; ROM_SysTickEnable(); while (ROM_SysTickValueGet() < 10000) ; while (ROM_SysTickValueGet() > 10000) ; ROM_SysTickDisable(); // Display ready for init fopen("LCDBACKLIT", "w"); printf("Hi there, using printf!\n"); //nokia1202_puts("Hi there!\n"); while(1) ; } Main thing to note is the last little part I requested the library initialize the LCD simply by using fopen("LCDBACKLIT", "w");. Slowly pondering the utility of implementing all my programs using these sort of primitives... like a very lightweight O/S layer for my stuff. bluehash and tushki7 2 Quote Link to post Share on other sites
cubeberg 540 Posted January 28, 2014 Share Posted January 28, 2014 Generating gerbers for a super-secret project @@bluehash knows what I'm talking about - unfortunately the rest of you will be out of the loop for a bit! bluehash and tripwire 2 Quote Link to post Share on other sites
enl 227 Posted January 28, 2014 Share Posted January 28, 2014 Unfortunately, not much with electronics. Mostly using the temp monitoring system I put together with a launchpad and a bunch of ds28B20's to track down air leaks in my house and fill them. 8 channels on port 2 rather than using the id of each unit. As Arlo Guthery said, "I'm not proud... or tired". Te code is ugly. May post when I get time to clean it up. Not at all efficient, but I whaled it together in a few hours, using a serial LCD i picked up for $1 at radio shack clearance (parallax 16X4line). Way too much timing by delay_cycles. I really don't like 5degF weather. spirilis 1 Quote Link to post Share on other sites
bluehash 1,581 Posted January 28, 2014 Author Share Posted January 28, 2014 @@spirilis Thanks for the explanation! @cubeberg Quote Link to post Share on other sites
t0mpr1c3 91 Posted January 28, 2014 Share Posted January 28, 2014 No microcontroller stuff whatsoever. dubnet 1 Quote Link to post Share on other sites
abecedarian 330 Posted January 28, 2014 Share Posted January 28, 2014 I'm contemplating fuel injection on my motorcycle. My main thread is "EFI", everything else is an interrupt. Oh, and I'm also pondering why the NSA didn't start threads like this on 4chan and other forums? ... or maybe they did? Quote Link to post Share on other sites
jpnorair 340 Posted January 28, 2014 Share Posted January 28, 2014 My current "night time coding projects" are: (1) implementing AES128-CCM cipher for non-aligned frames. (2) Building a binary serial terminal app in pure, POSIX C for good-old command line shell. Why is it that all the binary serial terminals are married to one horrible OO graphical framework or another? I do enough hardware stuff during the day. spirilis 1 Quote Link to post Share on other sites
roadrunner84 466 Posted January 28, 2014 Share Posted January 28, 2014 Generating gerbers for a super-secret project @@bluehash knows what I'm talking about - unfortunately the rest of you will be out of the loop for a bit! @@cubeberg : The jagged line maked me guess this is a touch slider. The H on it's side below a C(?) on it's side makes me guess it's some form of HVAC or hottub control. How close am I? Quote Link to post Share on other sites
bluehash 1,581 Posted January 28, 2014 Author Share Posted January 28, 2014 @@cubeberg : The jagged line maked me guess this is a touch slider. The H on it's side below a C(?) on it's side makes me guess it's some form of HVAC or hottub control. How close am I? @roadrunner84 Close, but yet so far. Quote Link to post Share on other sites
spirilis 1,265 Posted January 28, 2014 Share Posted January 28, 2014 My current "night time coding projects" are: (1) implementing AES128-CCM cipher for non-aligned frames. (2) Building a binary serial terminal app in pure, POSIX C for good-old command line shell. Why is it that all the binary serial terminals are married to one horrible OO graphical framework or another? I do enough hardware stuff during the day. As much as I despise Solaris, the "tip" command was rather nice. I just use minicom under linux but even it uses the fullscreen-terminal ncurses library. Sent from my Galaxy Note II with Tapatalk 4 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.