SFEMP3Shield  1.02.15
Arduino Library for VS10xx shield
Public Attributes | List of all members
twobyte Union Reference

A handler for accessing bytes of a word. More...

#include <SFEMP3Shield.h>

Public Attributes

uint16_t word
 whole word value More...
 
uint8_t byte [2]
 individual bytes More...
 

Detailed Description

A handler for accessing bytes of a word.

Often individual bytes of a word are handled by bit shifting e.g.

Mp3WriteRegister(SCI_MODE, ((MP3SCI_MODE >> 8) & 0xFF), (MP3SCI_MODE & 0xFF) );

This may lead to excessive shifts and worse; signed carries of the second shift, If the casting is not correct. This union allows a more efficient and simpler method to directly access the individual bytes of the word. And is convienent for handeling Endian issues. Where byte[0..1] can be assigned specific endian and the word (aka uint16_t) can be used.

Definition at line 818 of file SFEMP3Shield.h.

Member Data Documentation

◆ byte

uint8_t twobyte::byte[2]

individual bytes

allows access and handeling of individual uint8_t (aka bytes), either MSB or LSB byte of word

Definition at line 833 of file SFEMP3Shield.h.

◆ word

uint16_t twobyte::word

whole word value

allows access and handeling of whole uint16_t (aka word) value

Definition at line 825 of file SFEMP3Shield.h.


The documentation for this union was generated from the following file: