These are chat archives for SmingHub/Sming

17th
Nov 2015
robotiko
@robotiko
Nov 17 2015 09:18
@all anyone have any idea of how to set two pins hihg at same time
*high
soemthing like GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, pin_mask)
or gpio_output_set(1<<pin,0,1<<pin,0); should do it
but I cannot find much infor about how to really use
any help?
Alexander V. Ribchansky
@avr39-ripe
Nov 17 2015 09:33
@robotiko GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, pin_mask) should work.. pin_mask has "1" on pins which you want to set HIGH
robotiko
@robotiko
Nov 17 2015 09:33
and to set low ?
I need to toggle the pins
Alexander V. Ribchansky
@avr39-ripe
Nov 17 2015 09:34
^) this is SECOND question.. another 0.3333 cents :)
robotiko
@robotiko
Nov 17 2015 09:34
GPIO_OUT_W1TC_ADDRESS?
Alexander V. Ribchansky
@avr39-ripe
Nov 17 2015 09:34
wait please one moment!
yeh!
robotiko
@robotiko
Nov 17 2015 09:35
thanks
now I do get the meanign of such weirdo naming :D
@avr39-ripe thanks a lot
Alexander V. Ribchansky
@avr39-ripe
Nov 17 2015 09:36
W1TS = .. guess what??? Write 1 To Set :) and W1TC = Write 1 To Clear...
robotiko
@robotiko
Nov 17 2015 09:37
yep I went thought that .. but is quite ofuscated for understanding first time
yep I go tit
got it
Alexander V. Ribchansky
@avr39-ripe
Nov 17 2015 09:37
chineees are so chinees :)
robotiko
@robotiko
Nov 17 2015 09:37
TS = set
TC = clear
;)
thanks
Alexander V. Ribchansky
@avr39-ripe
Nov 17 2015 09:38
they name registers in such way to not forget : ) :) :)
robotiko
@robotiko
Nov 17 2015 09:38
yes .. very friendly
:D
then there is the other way .. gpio_output_set(0,BIT2|BIT12, BIT2|BIT12,0); ... that even better
Alexander V. Ribchansky
@avr39-ripe
Nov 17 2015 09:40
where gpio_output_set is defined?
robotiko
@robotiko
Nov 17 2015 09:40
esp doc
Alexander V. Ribchansky
@avr39-ripe
Nov 17 2015 09:41
the most straightforward way is W1TS and W1TC... it is DIRECT registers manipulation... fast and furryous :)
robotiko
@robotiko
Nov 17 2015 09:51
@avr39-ripe thanks..
zhivko
@zhivko
Nov 17 2015 10:28
If anybody is doing self PCB board and have any experience - maybe anybody knows which ebay provider pf pcb fr4 copper clad to choose to have flattest pcb?
@robotiko so in theory you will do one call to WRITE_PERI_REG with multiple pins and one uint8_t val ?
robotiko
@robotiko
Nov 17 2015 10:31
well I'm just facing that issue
uint8_t
zhivko
@zhivko
Nov 17 2015 10:32
I'm also interested in that because I wanna drive multiple motors at same exact time.
robotiko
@robotiko
Nov 17 2015 10:32
I know
zhivko
@zhivko
Nov 17 2015 10:32
whats the issue with uint8_t ?
robotiko
@robotiko
Nov 17 2015 10:33
teh reg types
zhivko
@zhivko
Nov 17 2015 10:33
If I have digital val should be just 1 or 0 no ?
robotiko
@robotiko
Nov 17 2015 10:33
uint32_t pin_mask_left, pin_mask_right, pin_mask_leftright;
pin_mask_left = 1 << digitalPinToBitMask(stepPinLeftMotor);
sompiler shouts
c:/tools/Sming/Sming/SmingCore/../Wiring/../SmingCore/pins_arduino.h:29:93: error: left shift count >= width of type [-Werror]

define digitalPinToBitMask(P) ( (int)P < 8 ? _BV((int)P) : ( P < 16 ? _BV( (int)P-8 ) : 1) )

I know that there is a issue dicussion about regs if they should be 32bits or just plain 8
but .. bitmask of 15 pins with 8 bit reg..
doesn't sound reasonable
zhivko
@zhivko
Nov 17 2015 10:36
ughhh... as I understand 8 bit should be enough on both sides and then level shift should not be issue
robotiko
@robotiko
Nov 17 2015 10:39
?
@tprochazka was on similar issu
issue
@zhivko what is weird is .. how do you set pin 15 on a 8 bits reg?
zhivko
@zhivko
Nov 17 2015 10:40
sorry I think I cannot help this topic is over my head... :) But will follow discussion with big interest.
robotiko
@robotiko
Nov 17 2015 10:40
if it is a bit mask
zhivko
@zhivko
Nov 17 2015 10:41
@robotiko this is not possible ofcourse... program logic should contain ...if... sentence but that is already another call and than it is not at same time - yes ?
robotiko
@robotiko
Nov 17 2015 10:43
@zhivko you must eb talkign abotu soemthing completely different
I don't understand
zhivko
@zhivko
Nov 17 2015 10:57
@robotiko never mind - I will follow debate with great interest.
robotiko
@robotiko
Nov 17 2015 11:07
ok I see the issue
working on example
I keep you updated
Alexander V. Ribchansky
@avr39-ripe
Nov 17 2015 11:17
@robotiko if I understand you right, you should use uint32_t for pin_bitmask not uint8_t.. according to

define WRITE_PERI_REG(addr, val) (((volatile uint32_t )ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val) from eagle_soc.h from sdk

so both addr and value are uint32_t values..
robotiko
@robotiko
Nov 17 2015 11:18
yes
it was an overflow
Alexander V. Ribchansky
@avr39-ripe
Nov 17 2015 11:18
so whole 15 pins fit into 32bit value
robotiko
@robotiko
Nov 17 2015 11:18
sure
the thing is that if look at examples and libs in sming..
they use typedef volatile uint8_t PortReg;
typedef uint8_t PortMask;
Alexander V. Ribchansky
@avr39-ripe
Nov 17 2015 11:19
in Sming we manipulate pins itself... so uint8_t is enough for pin numbers...
robotiko
@robotiko
Nov 17 2015 11:19
taken from adadfruit ssd example
ok
Alexander V. Ribchansky
@avr39-ripe
Nov 17 2015 11:19
there was something in PR about PortMask overfolov...
robotiko
@robotiko
Nov 17 2015 11:19
yes
looks like
it is used 8 bits to later overflow with pointers
for arduino backwards compatibility ..
that is the current discussion with anakod
Alexander V. Ribchansky
@avr39-ripe
Nov 17 2015 11:20
I think we (I mean Sming-ers (NOT Swingers!! :)) should cooperate with esp8266/Arduino for some common Wiring-based low-level...
I must go.. will talk here later.. :)
both projects have much in common on low level..
robotiko
@robotiko
Nov 17 2015 11:21
yes
Terrific!
it works nicely
blob
uS resolution
zhivko
@zhivko
Nov 17 2015 11:27
This is pic from logic analyzer - not from scope? Evrey line is so flat :)
robotiko
@robotiko
Nov 17 2015 11:31
yes
Tomáš Procházka
@tprochazka
Nov 17 2015 23:16
@avr39-ripe A fully agree with you. ESP8266/Arduino has much better compatibility with existing Arduino Libs, they have much better Serial, I2C and ISP support, in Sming is missing many methods. I already mentioned it in many issues on Github. I think that it allows to speed up Sming development...
Tomáš Procházka
@tprochazka
Nov 17 2015 23:22
And I have some issue, maybe someone will know solution. I have interrupt handler for the button. I need to react on long press. So I start the Timer in the interrupt handler on button press and stop it on the button release event. If press take more than timer time it cause to call timer callback. It works correctly. But I need in the time callback call WifiStation.config() and it cause to crash Fatal exception 28(LoadProhibitedCause): The explanation of this crash is "A load referenced a page mapped with an attribute that does not permit loads". The same happen if I call WifiStation directly from the interrupt handler, where I understand it, but why from the timer? How I can call WifiStation from timer event?