include/ecrt.h
changeset 165 51dea253c49d
parent 150 36530399236b
child 195 674071846ee3
equal deleted inserted replaced
164:ed85368b2b2e 165:51dea253c49d
   107 int ecrt_slave_write_alias(ec_slave_t *slave, uint16_t alias);
   107 int ecrt_slave_write_alias(ec_slave_t *slave, uint16_t alias);
   108 
   108 
   109 /*****************************************************************************/
   109 /*****************************************************************************/
   110 // Bitwise read/write macros
   110 // Bitwise read/write macros
   111 
   111 
   112 #define EC_READ_BIT(PD, CH) (*((uint8_t *) (PD)) >> (CH)) & 0x01)
   112 #define EC_READ_BIT(PD, CH) ((*((uint8_t *) (PD)) >> (CH)) & 0x01)
   113 
   113 
   114 #define EC_WRITE_BIT(PD, CH, VAL) \
   114 #define EC_WRITE_BIT(PD, CH, VAL) \
   115     do { \
   115     do { \
   116         if (VAL) *((uint8_t *) (PD)) |=  (1 << (CH)); \
   116         if (VAL) *((uint8_t *) (PD)) |=  (1 << (CH)); \
   117         else     *((uint8_t *) (PD)) &= ~(1 << (CH)); \
   117         else     *((uint8_t *) (PD)) &= ~(1 << (CH)); \