Cardiff announced the signing on their website on Tuesday after the Italian striker successfully completed a medical.
Macheda said: "Last season I had a good spell on loan at Birmingham City, but this is a new chapter of my career now and I can't wait to get started and show everyone who I am.
"Knowing Ole, he wants to get back into the Premier League as soon as possible and the recent signings show that.
"I'm here for the same reason. I feel that this is a great team and if we can have a good season and work hard then we can go straight back up."
For the big stories and the banter follow us on Twitter: @tribalfootball