Simulated the CD changer of a Saab to implement a bluetooth connection to the car stereo. Control of playback device (phone) with steering wheel buttons. Needs a RN52 bluetooth transciever and a CAN transiever. So far only audio playback and control via steering wheel buttons implemented. Hands free calling planned.
CDC.h@16:7bb8b161e00b, 2016-03-18 (annotated)
- Committer:
- petter
- Date:
- Fri Mar 18 20:58:36 2016 +0000
- Revision:
- 16:7bb8b161e00b
- Parent:
- 13:968af0520530
Added can.monitor in a trial to get the sleep mode working
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
petter | 0:6cf6e566c0da | 1 | |
petter | 0:6cf6e566c0da | 2 | |
petter | 0:6cf6e566c0da | 3 | #ifndef CDC_H |
petter | 0:6cf6e566c0da | 4 | #define CDC_H |
petter | 0:6cf6e566c0da | 5 | |
petter | 0:6cf6e566c0da | 6 | #include "mbed.h" |
petter | 0:6cf6e566c0da | 7 | |
petter | 0:6cf6e566c0da | 8 | typedef enum |
petter | 0:6cf6e566c0da | 9 | { |
petter | 0:6cf6e566c0da | 10 | IBUS_NO_MESSAGE, |
petter | 0:6cf6e566c0da | 11 | IBUS_OTHER_MESSAGE, |
petter | 0:6cf6e566c0da | 12 | IBUS_CDC_ON, |
petter | 0:6cf6e566c0da | 13 | IBUS_CDC_OFF, |
petter | 0:6cf6e566c0da | 14 | IBUS_NEXT, |
petter | 0:6cf6e566c0da | 15 | IBUS_VOLUME_UP, |
petter | 0:6cf6e566c0da | 16 | IBUS_VOLUME_DOWN, |
petter | 0:6cf6e566c0da | 17 | IBUS_SKIP_FW, |
petter | 0:6cf6e566c0da | 18 | IBUS_SKIP_BW, |
petter | 0:6cf6e566c0da | 19 | IBUS_SET, |
petter | 0:6cf6e566c0da | 20 | IBUS_CLEAR, |
petter | 11:74844f6ca8cf | 21 | IBUS_HEAD_UNIT_OFF, |
petter | 11:74844f6ca8cf | 22 | IBUS_HEAD_UNIT_ON, |
petter | 0:6cf6e566c0da | 23 | |
petter | 0:6cf6e566c0da | 24 | IBUS_COMMAND_LAST |
petter | 0:6cf6e566c0da | 25 | |
petter | 0:6cf6e566c0da | 26 | } IBUS_COMMAND; |
petter | 0:6cf6e566c0da | 27 | |
petter | 0:6cf6e566c0da | 28 | //---------------------------------------------------------------------------- |
petter | 0:6cf6e566c0da | 29 | // CLASS |
petter | 0:6cf6e566c0da | 30 | //---------------------------------------------------------------------------- |
petter | 0:6cf6e566c0da | 31 | |
petter | 0:6cf6e566c0da | 32 | class CDC |
petter | 0:6cf6e566c0da | 33 | { |
petter | 0:6cf6e566c0da | 34 | public: |
petter | 13:968af0520530 | 35 | void enable(); |
petter | 13:968af0520530 | 36 | void disable(); |
petter | 0:6cf6e566c0da | 37 | void init(); |
petter | 0:6cf6e566c0da | 38 | IBUS_COMMAND get_cmd(); |
petter | 0:6cf6e566c0da | 39 | IBUS_COMMAND get_ihu_cmd(); |
petter | 0:6cf6e566c0da | 40 | IBUS_COMMAND get_steering_wheel_cmd(); |
petter | 11:74844f6ca8cf | 41 | void display(char text[]); |
petter | 11:74844f6ca8cf | 42 | void display_update(); |
petter | 2:10c60edc8573 | 43 | void update_elapsed_time(); |
petter | 2:10c60edc8573 | 44 | void reset_elapsed_time(); |
petter | 2:10c60edc8573 | 45 | void start_elapsed_time(); |
petter | 2:10c60edc8573 | 46 | void stop_elapsed_time(); |
petter | 6:c454f88524d6 | 47 | void set_track(char track_number); |
petter | 0:6cf6e566c0da | 48 | void send_can_frame(int message_id, int *msg); |
petter | 0:6cf6e566c0da | 49 | void print_can_frame(CANMessage *msg); |
petter | 0:6cf6e566c0da | 50 | void CAN_wrFilter(uint32_t ctrl, uint32_t id); |
petter | 0:6cf6e566c0da | 51 | }; |
petter | 0:6cf6e566c0da | 52 | |
petter | 0:6cf6e566c0da | 53 | #endif |