void main() { initSystem(); initSC1602(); initPSW(); while(1) { if(10 =< SysTick - PrevSysTick) { PushedSW = diffsw(PORTB()); if(PORTBbits.RB5 == 1) IfSettingPSW = IfSettingPSW ^ 1; PrevSysTick = SysTick; } if(IfSettingPSW == 1) { settingPSW(PushedSW); } else { PSW(PushedSW); } } }
uint8_t *lastByte; } i2c_i; static i2c_i i2cInst[I2C_NUM_INSTANCES] = { { TWI0, 0, 0 }, { TWI1, 0, 0 } }; static char sdaRd(uint8_t instance); static void sdaLo(uint8_t instance); static void sdaHi(uint8_t instance); static void sclLo(uint8_t instance); static void sclHi(uint8_t instance); static void i2cBitTx(uint8_t instance, char bit); static void i2cStop(uint8_t instance); static void i2cPdcDisable(Twi *pTwi); //sda first please static const uint8_t pins[I2C_NUM_INSTANCES][2] = { { PORTA(17), PORTA(18) }, { PORTB(12), PORTB(13) } }; static uint32_t delayTicks[I2C_NUM_INSTANCES]; static void i2cDelay(uint8_t instance){ fwkDelay(delayTicks[instance]); } void i2cClock(uint8_t instance, uint32_t clock){ #if I2C_BITBANG delayTicks[instance] = (TICKS_PER_MS * 1000) / (8 * clock * 2); #else Twi *pTwi; uint32_t dwCkDiv = 0; uint32_t dwClDiv;
* You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define ADK_INTERNAL #include "LEDs.h" #include "fwk.h" static const uint8_t blanks[] = {PORTB(8), PORTC(25), PORTC(26), PORTC(27)}; #define MISO PORTA(25) #define MOSI PORTA(26) #define SCLK PORTA(27) #define XLAT PORTA(28) #define DBGLED PORTC(9) static const uint16_t led_gamma[256] = { 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 11, 12, 14, 15, 17, 19, 21, 23, 25, 27, 29, 32, 34, 37, 40, 43, 46, 49, 52, 55, 59, 62, 66, 70, 73, 77, 82, 86, 90, 95, 99, 104, 109, 114, 119, 124, 129, 135, 140, 146, 152, 158, 164, 170, 176, 182, 189, 196, 202, 209, 216, 224, 231, 238, 246, 254, 261, 269, 277, 286, 294, 302, 311, 320, 328, 337, 347, 356, 365, 375, 384, 394, 404, 414, 424, 435, 445, 456, 467, 477, 488, 500, 511, 522, 534, 545, 557, 569, 581, 594, 606, 619, 631, 644, 657, 670, 683, 697, 710, 724, 738,