Add explicit typecast for ESC SM addressing
Add explicit typecast for uint16_t address for ESC_read/WAC_write. The ESC RAM address space is limited to 16Bit.pull/149/head
parent
60e397aebc
commit
ac198e05b1
14
soes/esc.c
14
soes/esc.c
|
@ -136,7 +136,7 @@ uint32_t ESC_ALeventread (void)
|
|||
void ESC_SMack (uint8_t n)
|
||||
{
|
||||
uint8_t dummy;
|
||||
ESC_read (ESCREG_SM0ACTIVATE + (n << 3), &dummy, 1);
|
||||
ESC_read ((uint16_t)(ESCREG_SM0ACTIVATE + (n << 3)), &dummy, 1);
|
||||
}
|
||||
|
||||
/** Read SM Status register 0x805(+ offset to SyncManager n) and save the
|
||||
|
@ -148,7 +148,7 @@ void ESC_SMstatus (uint8_t n)
|
|||
{
|
||||
_ESCsm2 *sm;
|
||||
sm = (_ESCsm2 *)&ESCvar.SM[n];
|
||||
ESC_read (ESCREG_SM0STATUS + (n << 3), &(sm->Status), 1);
|
||||
ESC_read ((uint16_t)(ESCREG_SM0STATUS + (n << 3)), &(sm->Status), 1);
|
||||
}
|
||||
|
||||
/** Write ESCvar.SM[n] data to ESC PDI control register 0x807(+ offset to SyncManager n).
|
||||
|
@ -159,7 +159,7 @@ void ESC_SMwritepdi (uint8_t n)
|
|||
{
|
||||
_ESCsm2 *sm;
|
||||
sm = (_ESCsm2 *)&ESCvar.SM[n];
|
||||
ESC_write (ESCREG_SM0PDI + (n << 3), &(sm->ActPDI), 1);
|
||||
ESC_write ((uint16_t)(ESCREG_SM0PDI + (n << 3)), &(sm->ActPDI), 1);
|
||||
}
|
||||
|
||||
/** Write 0 to Bit0 in SM PDI control register 0x807(+ offset to SyncManager n) to Activate the Sync Manager n.
|
||||
|
@ -414,9 +414,9 @@ void ESC_readmbx (void)
|
|||
|
||||
if (length > (ESC_MBX0_sml - ESC_MBXHSIZE))
|
||||
{
|
||||
length = ESC_MBX0_sml - ESC_MBXHSIZE;
|
||||
length = (uint16_t)(ESC_MBX0_sml - ESC_MBXHSIZE);
|
||||
}
|
||||
ESC_read (ESC_MBX0_sma + ESC_MBXHSIZE, MB->b, length);
|
||||
ESC_read ((uint16_t)(ESC_MBX0_sma + ESC_MBXHSIZE), MB->b, length);
|
||||
if (length + ESC_MBXHSIZE < ESC_MBX0_sml)
|
||||
{
|
||||
ESC_read (ESC_MBX0_sme, &length, 1);
|
||||
|
@ -439,9 +439,9 @@ void ESC_writembx (uint8_t n)
|
|||
|
||||
if (length > (ESC_MBX1_sml - ESC_MBXHSIZE))
|
||||
{
|
||||
length = ESC_MBX1_sml - ESC_MBXHSIZE;
|
||||
length = (uint16_t)(ESC_MBX1_sml - ESC_MBXHSIZE);
|
||||
}
|
||||
ESC_write (ESC_MBX1_sma, MBh, ESC_MBXHSIZE + length);
|
||||
ESC_write (ESC_MBX1_sma, MBh, (uint16_t)(ESC_MBXHSIZE + length));
|
||||
if (length + ESC_MBXHSIZE < ESC_MBX1_sml)
|
||||
{
|
||||
ESC_write (ESC_MBX1_sme, &dummy, 1);
|
||||
|
|
Loading…
Reference in New Issue