Browse Source

Merge pull request #41 from FrankBoesing/patch-1

Use CCM_CBCMR instead "/7"
main
Paul Stoffregen 5 years ago
parent
commit
7bb5933cf4
No account linked to committer's email address
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      SPI.h

+ 2
- 1
SPI.h View File

__attribute__((__always_inline__)) { __attribute__((__always_inline__)) {
// TODO: Need to check timings as related to chip selects? // TODO: Need to check timings as related to chip selects?


uint32_t d, div, clkhz = 528000000/7; // LPSPI peripheral clock
uint32_t d, div;
uint32_t clkhz = 528000000u / (((CCM_CBCMR >> 26 ) & 0x07 ) + 1); // LPSPI peripheral clock
if (clock == 0) clock =1; if (clock == 0) clock =1;
d= clkhz/clock; d= clkhz/clock;
if (d && clkhz/d > clock) d++; if (d && clkhz/d > clock) d++;

Loading…
Cancel
Save