Comments (12)
these?
from vwcdavr.
Yes
But also I needed to add SetStateIdleThenPlay();
after init Init_VWCDC();
to get radio playing, I feel that I'm missing something
from vwcdavr.
what exactly do you need to do with them? if you press button on MFSW or on radio then emulator will change track
from vwcdavr.
Ok, then that is not happening, I'm using Arduino Uno (AVR_ATmega328P)
defs and things I changed in code
// #define DUMPMODE
// #define DUMPMODE2
//#define DISC_TRACK_NUMBER_FROM_MPD
// #define BLUETOOTH
#define RADIO_COMMAND PB0 //ICP
#define RADIO_COMMAND_DDR DDRB
#define RADIO_COMMAND_PORT PORTB
#define RADIO_COMMAND_PIN PINB
//standard pinout 8,11,13
#define RADIO_CLOCK PB5
#define RADIO_CLOCK_DDR DDRB
#define RADIO_CLOCK_PORT PORTB
#if defined(__AVR_ATmega328PB__) //cannot use pb3 with serial1
#define RADIO_DATA PB2
#else
#define RADIO_DATA PB3
#endif
#define RADIO_DATA_DDR DDRB
#define RADIO_DATA_PORT PORTB
//my pinout, 8,6,A0
//#define RADIO_CLOCK PD4
//#define RADIO_CLOCK_DDR DDRD
//#define RADIO_CLOCK_PORT PORTD
//#define RADIO_DATA PC3
//#define RADIO_DATA_DDR DDRC
//#define RADIO_DATA_PORT PORTC
//#define RADIO_ACC 3 // PD3 = INT1
int main()
{
Serial.begin(9600);
pinMode(D_CTRL_PREV_PIN, OUTPUT);
pinMode(D_CTRL_NEXT_PIN, OUTPUT);
pinMode(D_CTRL_LED_PIN, OUTPUT);
digitalWrite(D_CTRL_PREV_PIN, LOW);
digitalWrite(D_CTRL_NEXT_PIN, LOW);
digitalWrite(D_CTRL_LED_PIN, LOW);
#ifdef BLUETOOTH
#if defined(__AVR_ATmega324__) || defined(__AVR_ATmega324A__) || defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega324PB__) || defined(__AVR_ATmega324PB__) || defined(__AVR_ATmega328PB__)
Serial1.begin(9600);
#else
Serial.begin(9600);
//
#endif
#endif
#ifdef DISC_TRACK_NUMBER_FROM_MPD
#if defined(__AVR_ATmega324__) || defined(__AVR_ATmega324A__) || defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega324PB__) || defined(__AVR_ATmega324PB__)
Serial1.begin(115200);
#else
Serial.begin(115200);
#endif
#endif
//Serial.println("COM+SNAME+VWCDPIC1");
unsigned long delay_time = 0;
int next_high = 0;
int prev_high = 0;
Init_VWCDC();
// starts playing Bluetooth stream
// SetStateIdleThenPlay();
//#if defined(__AVR_ATmega328P__)
// Serial.println("__AVR_ATmega328P__ board");
//#endif
// my board __AVR_ATmega328P__
#ifdef DISC_TRACK_NUMBER_FROM_MPD
//start in idle mode
SetStateIdle();
#endif
//Serial.println("COM+TONEOFF");
while (1)
{
CDC_Protocol();
if (D_CTRL_LED_STATE == 1) {
digitalWrite(D_CTRL_LED_PIN, HIGH);
} else {
digitalWrite(D_CTRL_LED_PIN, LOW);
}
if (D_CTRL_NEXT > 0) {
Serial.println("D_CTRL_NEXT press");
if (delay_time == 0) {
delay_time = millis();
digitalWrite(D_CTRL_NEXT_PIN, HIGH);
next_high = 1;
} else if (delay_time + 200 <= millis()) {
digitalWrite(D_CTRL_NEXT_PIN, LOW);
next_high = 0;
delay_time = 0;
D_CTRL_NEXT = 0;
}
} else if (next_high == 1) {
digitalWrite(D_CTRL_NEXT_PIN, LOW);
next_high = 0;
}
if (D_CTRL_PREV > 0) {
Serial.println("D_CTRL_PREV press");
int delay_plus = 150;
if(D_CTRL_PREV == 1) delay_plus = 250;
if (delay_time == 0) {
delay_time = millis();
digitalWrite(D_CTRL_PREV_PIN, HIGH);
prev_high = 1;
} else if (delay_time + delay_plus <= millis()) {
digitalWrite(D_CTRL_PREV_PIN, LOW);
prev_high = 0;
delay_time = 0;
if (D_CTRL_PREV == 2) {
D_CTRL_PREV = 0;
} else {
D_CTRL_PREV = 2;
}
}
} else if (prev_high == 1) {
digitalWrite(D_CTRL_NEXT_PIN, LOW);
prev_high = 0;
}
}
}
from vwcdavr.
is it working without your changes ?
from vwcdavr.
Regarding this, how could I test that these buttons are working and I'm receiving those bytes?
DUMPMODE and DUMPMODE2 must be enabled?
from vwcdavr.
No, not working no data from head unit
from vwcdavr.
arduino pin 8 is connected to dataout on the radio?
RADIO PIN -> arduino pin
DataOut -> digital 8 (ICP1)
DataIn -> digital 11(PB3) (10 for atmega328PB)
Clock -> digital 13(PB5)
from vwcdavr.
Yes, Double checked
from vwcdavr.
you should see some commands on serial at startup of radio, mainly disable and enable, depends on state in which radio started
from vwcdavr.
Looks like my head unit is not providing any data, closing
from vwcdavr.
radio must be coded to have cdc enabled, try it
http://wiki.ross-tech.com/wiki/index.php/Audi_Radio_Generation_I#Coding
from vwcdavr.
Related Issues (17)
- [Question] XS-3868 connect to arduino. HOT 1
- [audi concert 1] SCAN is blinking and muting sound HOT 3
- single timer version
- No CDC detected using ATtiny85 HOT 14
- CDC Emulator - sw and hw solution HOT 6
- help in making pcb HOT 1
- I think I need some help HOT 3
- Serial Print and theyre meanings HOT 7
- Atmega328 HOT 9
- Debugging 'dataerr' messages HOT 5
- arduino uno HOT 2
- Updated to Arduino 1.8.5 Still not compiling HOT 2
- Cdc mode activated. No play function HOT 8
- MPD Controls HOT 2
- TP-INFO mode hangs emu
- check output timing on analyzer! HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vwcdavr.