OpenSprinkler Forums OpenSprinkler Mobile and Web App OpenSprinker with Pine64 Reply To: OpenSprinker with Pine64

#43965

cremeikas
Participant

<quote> To adapt to pin64, the main modifications I believe would be to provide the pin definitions in defines.h and change gpio.h/.cpp to match gpio commands on pine64.</quote>

A quick follow up to this Ray,

Got my pine all setup to start trying to build and test on, and curious about some of the defines.

I think most of the functions in gpio.h/cpp are fine, calling the gpio pins through sysfs is pretty much the same from pi to pine. My question is about some of the defines:

I’m assuming these are the pin definitions

#define OS_HW_VERSION    OSPI_HW_VERSION_BASE
#define PIN_SR_LATCH      22    // shift register latch pin
#define PIN_SR_DATA       27    // shift register data pin
#define PIN_SR_DATA_ALT   21    // shift register data pin (alternative, for RPi 1 rev. 1 boards)
#define PIN_SR_CLOCK       4    // shift register clock pin
#define PIN_SR_OE         17    // shift register output enable pin
#define PIN_RAINSENSOR    14    // rain sensor
#define PIN_FLOWSENSOR    14    // flow sensor (currently shared with rain sensor, change if using a different pin)
#define PIN_RF_DATA       15    // RF transmitter pin
#define PIN_BUTTON_1      23    // button 1
#define PIN_BUTTON_2      24    // button 2
#define PIN_BUTTON_3      25    // button 3

#define PIN_FREE_LIST		{5,6,7,8,9,10,11,12,13,16,18,19,20,21,23,24,25,26}

But I’m a little unsure of some of the specifics. I’m using all of my own hardware for this, and from reading through the firmware code it seems as if there is some sort of controller that is used to control the valves indirectly.

I’m assuming SR_DATA and SR_LATCH are the primary pins that are providing the action for toggling on / off valves?

From the apply_all_station_bits function:


for(s=0;s<8;s++) {
   ...
   digitalWrite(PIN_SR_DATA, (sbits & ((byte)1<<(7-s))) ? HIGH : LOW );
   ...
}

In this context, does a station equate to a valve?

I feel like I’m missing some sort of relationship between the PIN_SR_DATA and each of the valves

Edit: So I think I understand a bit, it seems you are using some additional hardware to control the valves indirectly through some sort of relay that possibly takes an 8bit value to control the 1 available valves?

Thanks!